Skip to content

Commit cb66adb

Browse files
committed
force input/output folders
1 parent c06394d commit cb66adb

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

.github/workflows/dryrun.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111
jobs:
1212
dry_run:
13-
environment: dry
13+
environment: stage
1414
runs-on: ubuntu-latest-large
1515
timeout-minutes: 25
1616
steps:
@@ -31,17 +31,21 @@ jobs:
3131
uv run pymetrics collect-pypi \
3232
--max-days 30 \
3333
--add-metrics \
34+
--output-folder $${{ secrets.PYPI_OUTPUT_FOLDER }} \
3435
--dry-run
3536
env:
3637
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
3738
BIGQUERY_CREDENTIALS: ${{ secrets.BIGQUERY_CREDENTIALS }}
39+
PYPI_OUTPUT_FOLDER: ${{ secrets.PYPI_OUTPUT_FOLDER }}
3840
- name: Collect Anaconda Downloads - Dry Run
3941
run: |
4042
uv run pymetrics collect-anaconda \
4143
--max-days 90 \
44+
--output-folder $${{ secrets.ANACONDA_OUTPUT_FOLDER }} \
4245
--dry-run
4346
env:
4447
PYDRIVE_CREDENTIALS: ${{ secrets.PYDRIVE_CREDENTIALS }}
48+
ANACONDA_OUTPUT_FOLDER: ${{ secrets.ANACONDA_OUTPUT_FOLDER }}
4549
- name: Summarize - Dry Run
4650
run: |
4751
uv run pymetrics summarize \

pymetrics/__main__.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ def _summarize(args):
8585
summarize_downloads(
8686
projects=projects,
8787
vendors=vendors,
88-
input_file=args.input_file,
8988
output_folder=output_folder,
9089
dry_run=args.dry_run,
9190
verbose=args.verbose,
@@ -127,7 +126,7 @@ def _get_parser():
127126
action = parser.add_subparsers(title='action')
128127
action.required = True
129128

130-
# collect
129+
# collect PyPI
131130
collect_pypi = action.add_parser(
132131
'collect-pypi', help='Collect download data from PyPi.', parents=[logging_args]
133132
)
@@ -137,7 +136,7 @@ def _get_parser():
137136
'-o',
138137
'--output-folder',
139138
type=str,
140-
required=False,
139+
required=True,
141140
help=(
142141
'Path to the folder where data will be stored. It can be a local path or a'
143142
' Google Drive folder path in the format gdrive://<folder-id>'
@@ -191,7 +190,7 @@ def _get_parser():
191190
help='Compute the aggregation metrics and create the corresponding spreadsheets.',
192191
)
193192

194-
# collect
193+
# summarize
195194
summarize = action.add_parser(
196195
'summarize', help='Summarize the downloads data.', parents=[logging_args]
197196
)
@@ -203,25 +202,18 @@ def _get_parser():
203202
default='summarize_config.yaml',
204203
help='Path to the configuration file.',
205204
)
206-
summarize.add_argument(
207-
'-i',
208-
'--input-file',
209-
type=str,
210-
default=None,
211-
help='Path to the pypi.csv. Default None, which means to use output-folder for pypi.csv',
212-
)
213205
summarize.add_argument(
214206
'-o',
215207
'--output-folder',
216208
type=str,
217-
required=False,
209+
required=True,
218210
help=(
219-
'Path to the folder where data will be outputted. It can be a local path or a'
211+
'Path to the folder where data will be pypi.csv exists. It can be a local path or a'
220212
' Google Drive folder path in the format gdrive://<folder-id>'
221213
),
222214
)
223215

224-
# collect
216+
# collect Anaconda
225217
collect_anaconda = action.add_parser(
226218
'collect-anaconda', help='Collect download data from Anaconda.', parents=[logging_args]
227219
)
@@ -237,7 +229,7 @@ def _get_parser():
237229
'-o',
238230
'--output-folder',
239231
type=str,
240-
required=False,
232+
required=True,
241233
help=(
242234
'Path to the folder where data will be outputted. It can be a local path or a'
243235
' Google Drive folder path in the format gdrive://<folder-id>'

pymetrics/summarize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ def get_previous_pypi_downloads(input_file, output_folder):
142142
LOGGER.info('Parsing version column to Version class objects')
143143
if data and 'version' in data.columns:
144144
data['version'] = data['version'].apply(parse)
145+
if not data:
146+
data = pd.DataFrame()
145147
return data
146148

147149

@@ -223,7 +225,6 @@ def summarize_downloads(
223225
projects,
224226
vendors,
225227
output_folder,
226-
input_file=None,
227228
dry_run=False,
228229
verbose=False,
229230
):

0 commit comments

Comments
 (0)