Skip to content

Commit

Permalink
Use click
Browse files Browse the repository at this point in the history
  • Loading branch information
GianlucaFicarelli committed Mar 8, 2024
1 parent 7d2ebe1 commit 5f9f285
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 60 deletions.
1 change: 1 addition & 0 deletions custom_analyses/src/a00/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
click
1 change: 1 addition & 0 deletions custom_analyses/src/a00/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
click==8.1.7
3 changes: 2 additions & 1 deletion custom_analyses/src/a01/requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bluepysnap>=2.0.0
blueetl>=0.4.0
bluepysnap>=2.0.0
click
54 changes: 27 additions & 27 deletions custom_analyses/src/a01/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
annotated-types==0.6.0
attrs==23.1.0
blueetl==0.4.3
attrs==23.2.0
blueetl==0.7.1
blueetl-core==0.1.7
bluepysnap==2.0.2
bluepysnap==3.0.1
cached-property==1.5.2
click==8.1.7
contourpy==1.2.0
cycler==0.12.1
deprecation==2.1.0
fonttools==4.46.0
fonttools==4.49.0
h5py==3.10.0
importlib-resources==6.1.1
importlib_resources==6.1.3
joblib==1.3.2
jsonschema==4.20.0
jsonschema-specifications==2023.11.2
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
kiwisolver==1.4.5
libsonata==0.1.24
matplotlib==3.8.2
more-itertools==10.1.0
morph-tool==2.9.1
matplotlib==3.8.3
more-itertools==10.2.0
morph-tool==2.10.2
MorphIO==3.3.7
neurom==3.2.5
numpy==1.26.2
neurom==3.2.8
numpy==1.26.4
packaging==23.2
pandas==2.1.4
Pillow==10.1.0
pyarrow==14.0.1
pydantic==2.5.2
pydantic_core==2.14.5
pyparsing==3.1.1
python-dateutil==2.8.2
pytz==2023.3.post1
pandas==2.2.1
pillow==10.2.0
pyarrow==15.0.1
pydantic==2.6.3
pydantic_core==2.16.3
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
referencing==0.32.0
rpds-py==0.13.2
scipy==1.11.4
referencing==0.33.0
rpds-py==0.18.0
scipy==1.12.0
six==1.16.0
tqdm==4.66.1
typing_extensions==4.9.0
tzdata==2023.3
xarray==2023.12.0
tqdm==4.66.2
typing_extensions==4.10.0
tzdata==2024.1
xarray==2024.2.0
xmltodict==0.13.0
1 change: 1 addition & 0 deletions custom_analyses/src/a02/requirements.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
blueetl>=0.4.0
bluepysnap>=2.0.0
blueetl>=0.4.0
submitit>=1.5.1
54 changes: 27 additions & 27 deletions custom_analyses/src/a02/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
annotated-types==0.6.0
attrs==23.1.0
blueetl==0.4.3
attrs==23.2.0
blueetl==0.7.1
blueetl-core==0.1.7
bluepysnap==2.0.2
bluepysnap==3.0.1
cached-property==1.5.2
click==8.1.7
cloudpickle==3.0.0
contourpy==1.2.0
cycler==0.12.1
deprecation==2.1.0
fonttools==4.46.0
fonttools==4.49.0
h5py==3.10.0
importlib-resources==6.1.1
importlib_resources==6.1.3
joblib==1.3.2
jsonschema==4.20.0
jsonschema-specifications==2023.11.2
jsonschema==4.21.1
jsonschema-specifications==2023.12.1
kiwisolver==1.4.5
libsonata==0.1.24
matplotlib==3.8.2
more-itertools==10.1.0
morph-tool==2.9.1
matplotlib==3.8.3
more-itertools==10.2.0
morph-tool==2.10.2
MorphIO==3.3.7
neurom==3.2.5
numpy==1.26.2
neurom==3.2.8
numpy==1.26.4
packaging==23.2
pandas==2.1.4
Pillow==10.1.0
pyarrow==14.0.1
pydantic==2.5.2
pydantic_core==2.14.5
pyparsing==3.1.1
python-dateutil==2.8.2
pytz==2023.3.post1
pandas==2.2.1
pillow==10.2.0
pyarrow==15.0.1
pydantic==2.6.3
pydantic_core==2.16.3
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
referencing==0.32.0
rpds-py==0.13.2
scipy==1.11.4
referencing==0.33.0
rpds-py==0.18.0
scipy==1.12.0
six==1.16.0
submitit==1.5.1
tqdm==4.66.1
typing_extensions==4.9.0
tzdata==2023.3
xarray==2023.12.0
tqdm==4.66.2
typing_extensions==4.10.0
tzdata==2024.1
xarray==2024.2.0
xmltodict==0.13.0
28 changes: 23 additions & 5 deletions custom_analyses/src/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import logging
import multiprocessing
import os
import sys
import time
from collections.abc import Callable
from pathlib import Path

import click

L = logging.getLogger("analysis")


Expand Down Expand Up @@ -58,11 +59,28 @@ def wrapper(
return result

if func.__module__ == "__main__":
# if the script is called directly, automatically execute the function
wrapper(
analysis_config=load_json(Path(sys.argv[1])),
analysis_output=Path(sys.argv[2]),
# if the script is called directly, automatically wrap and execute the function
@click.command()
@click.option(
"--log-level",
default="INFO",
help="Log level",
type=click.Choice(
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
case_sensitive=False,
),
show_default=True,
)
@click.argument("analysis_config_file", type=click.Path(exists=True))
@click.argument("analysis_output_file", type=click.Path(exists=False))
def cli_wrapper(analysis_config_file, analysis_output_file, log_level):
wrapper(
analysis_config=load_json(Path(analysis_config_file)),
analysis_output=Path(analysis_output_file),
log_level=log_level,
)

cli_wrapper()

return wrapper

Expand Down
1 change: 1 addition & 0 deletions custom_analyses/src/emodel_00/requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
bluecellulab<2.3.2
click
joblib
matplotlib
neuron
1 change: 1 addition & 0 deletions custom_analyses/src/emodel_01/requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bluepyemodel
click
neuron

0 comments on commit 5f9f285

Please sign in to comment.