From 66f3989a37d57da0044c59d79e24bc20c347c418 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 10:01:03 +0200 Subject: [PATCH 01/18] [ENH]: added installation instructions and metadata in a pyproject.toml file --- pyproject.toml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bd3d52a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "shanoir-downloader" +version = "0.0.1" +dynamic = ["version"] +dynamic = ["dependencies", "optional-dependencies"] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} +optional-dependencies = {dev = { file = ["requirements-dev.txt"] }} + +requires-python = ">=3.8 <3.12" + +authors = [ + {name = "Arthur Masson"}, + {name = "Quentin Duché"}, + {name = "Malo Gaubert"}, +] +maintainers = [ + {name = "Quentin Duché", email = "quentin.duche@inria.fr"} +] +description = "Download Shanoir Datasets in various format using Python" +readme = "README.md" +license = {file = "LICENSE"} +keywords = ["Shanoir", "DICOM", "NIFTI", "BIDS"] +classifiers = [ + "Programming Language :: Python" +] + +[project.urls] +Repository = "https://github.com/Inria-Empenn/shanoir_downloader.git" +"Bug Tracker" = "https://github.com/Inria-Empenn/shanoir_downloader/issues" +Changelog = "https://github.com/Inria-Empenn/shanoir_downloader/blob/master/CHANGELOG.md" + +[project.scripts] +spam-cli = "shanoir-downloader:main_cli" + + +[project.entry-points."spam.magical"] +tomatoes = "spam:main_tomatoes" \ No newline at end of file From 5b8367baf44e1dededf7e25d7880b40c68f593b1 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 10:47:25 +0200 Subject: [PATCH 02/18] [ENH]: fixed dependencies and build backend issue --- pyproject.toml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bd3d52a..37a6d78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,14 +5,10 @@ build-backend = "setuptools.build_meta" [project] name = "shanoir-downloader" version = "0.0.1" -dynamic = ["version"] -dynamic = ["dependencies", "optional-dependencies"] -[tool.setuptools.dynamic] -dependencies = {file = ["requirements.txt"]} -optional-dependencies = {dev = { file = ["requirements-dev.txt"] }} +dynamic = ["dependencies", "optional-dependencies"] -requires-python = ">=3.8 <3.12" +requires-python = ">=3.8, <3.12" authors = [ {name = "Arthur Masson"}, @@ -35,9 +31,16 @@ Repository = "https://github.com/Inria-Empenn/shanoir_downloader.git" "Bug Tracker" = "https://github.com/Inria-Empenn/shanoir_downloader/issues" Changelog = "https://github.com/Inria-Empenn/shanoir_downloader/blob/master/CHANGELOG.md" -[project.scripts] -spam-cli = "shanoir-downloader:main_cli" +[tool.setuptools] +py-modules = [] + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} +#optional-dependencies = {dev = { file = ["requirements-dev.txt"] }} +#[project.scripts] +#spam-cli = "shanoir-downloader:main_cli" -[project.entry-points."spam.magical"] -tomatoes = "spam:main_tomatoes" \ No newline at end of file +# +#[project.entry-points."spam.magical"] +#tomatoes = "spam:main_tomatoes" \ No newline at end of file From 2525fe98758ee2385d83ed0ee274d059d58cc5da Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 10:47:40 +0200 Subject: [PATCH 03/18] [ENH]: fixed dependencies and build backend issue --- Readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Readme.md => README.md (100%) diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md From f3c572317438f8a28498a7fa462b71b001447df6 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 10:51:47 +0200 Subject: [PATCH 04/18] [ENH]: added authors emails --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 37a6d78..5f8e986 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,12 +11,12 @@ dynamic = ["dependencies", "optional-dependencies"] requires-python = ">=3.8, <3.12" authors = [ - {name = "Arthur Masson"}, - {name = "Quentin Duché"}, - {name = "Malo Gaubert"}, + {name = "Arthur Masson",email = "arthur.masson@inria.fr"}, + {name = "Quentin Duché", email = "quentin.duche@irisa.fr"}, + {name = "Malo Gaubert", email = "malo.gaubert@irisa.fr"}, ] maintainers = [ - {name = "Quentin Duché", email = "quentin.duche@inria.fr"} + {name = "Quentin Duché", email = "quentin.duche@irisa.fr"} ] description = "Download Shanoir Datasets in various format using Python" readme = "README.md" From a9f76fb0ed7d5761d0e367eb4b628ecbce1c1533 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 10:53:40 +0200 Subject: [PATCH 05/18] [ENH]: adapted installations instructions in the README to new mechanism --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0c2ea88..779f271 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The scripts `convert_dicoms_to_niftis.py` and `create_previews.py` enable to con It is advised to install the project in [a virtual environment](https://docs.python.org/3/tutorial/venv.html). -[Install python with pip](https://www.python.org/downloads/) ; then use `pip install -r requirements.txt` to install python dependencies. +[Install python with pip](https://www.python.org/downloads/) ; then use `pip install .` to install python dependencies. Optionally, rename the `.env.example` to `.env` and set the variables (`shanoir_password`, `gpg_recipient`) to your needs. From dec799ddcacfdd2a0264c51b7f5bfc0044484346 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 11:27:12 +0200 Subject: [PATCH 06/18] [ENH]: added CI to test shanoir downloader basic installation --- .github/workflows/python-installation.yml | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/python-installation.yml diff --git a/.github/workflows/python-installation.yml b/.github/workflows/python-installation.yml new file mode 100644 index 0000000..8263f98 --- /dev/null +++ b/.github/workflows/python-installation.yml @@ -0,0 +1,36 @@ +name: Python installation + +on: [push] + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: ["3.8", "3.9", "3.10", "3.11"] + #TODO: use github action to read python version from pyproject.toml + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Setup Python # Set Python version + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + # Create virtual env under each python version + # (optional and a bit redundant because we are already on a specific python) + # it insures installation instruction provided in README are working + - name: Install dependencies + run: | + python -m venv test-env --clear + source test-env/bin/activate + python -m pip install --upgrade pip + python -m pip install -e . +# - name: Test with pytest +# run: pytest tests.py --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml +# - name: Upload pytest test results +# uses: actions/upload-artifact@v4 +# with: +# name: pytest-results-${{ matrix.python-version }} +# path: junit/test-results-${{ matrix.python-version }}.xml +# # Use always() to always run this step to publish test results when there are test failures +# if: ${{ always() }} From 582a005d4e7fbc55998e3c905ba17035c7239756 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 11:40:40 +0200 Subject: [PATCH 07/18] [ENH]: restrained to ubuntu in the first time --- .github/workflows/python-installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-installation.yml b/.github/workflows/python-installation.yml index 8263f98..da42404 100644 --- a/.github/workflows/python-installation.yml +++ b/.github/workflows/python-installation.yml @@ -6,7 +6,7 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, macos-latest] + os: [ubuntu-latest] python-version: ["3.8", "3.9", "3.10", "3.11"] #TODO: use github action to read python version from pyproject.toml runs-on: ${{ matrix.os }} From f0e9a716b23752bd010672bee1365a53daa68731 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 11:53:04 +0200 Subject: [PATCH 08/18] [BF]: try fix bug with python 3.11 installation --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5f8e986..909ff39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64", "setuptools_scm>=8"] build-backend = "setuptools.build_meta" [project] @@ -34,9 +34,13 @@ Changelog = "https://github.com/Inria-Empenn/shanoir_downloader/blob/master/CHAN [tool.setuptools] py-modules = [] +[tool.setuptools_scm] +version_file = "pkg/_version.py" + [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} + #optional-dependencies = {dev = { file = ["requirements-dev.txt"] }} #[project.scripts] #spam-cli = "shanoir-downloader:main_cli" From d54e6b3d549d8d4cf7804c2c1680904dae4e3df9 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 11:54:26 +0200 Subject: [PATCH 09/18] [BF]: fix syntax --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 909ff39..af25598 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ Changelog = "https://github.com/Inria-Empenn/shanoir_downloader/blob/master/CHAN py-modules = [] [tool.setuptools_scm] -version_file = "pkg/_version.py" + [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} From 784718c23ba7bd285ca98ec1109891c485d93520 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Tue, 16 Jul 2024 12:03:51 +0200 Subject: [PATCH 10/18] [BF]: restrained python version to python<3.11 --- .github/workflows/python-installation.yml | 2 +- pyproject.toml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-installation.yml b/.github/workflows/python-installation.yml index da42404..47530d9 100644 --- a/.github/workflows/python-installation.yml +++ b/.github/workflows/python-installation.yml @@ -7,7 +7,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10"] #TODO: use github action to read python version from pyproject.toml runs-on: ${{ matrix.os }} steps: diff --git a/pyproject.toml b/pyproject.toml index af25598..9ce4885 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ version = "0.0.1" dynamic = ["dependencies", "optional-dependencies"] -requires-python = ">=3.8, <3.12" +requires-python = ">=3.8, <3.11" authors = [ {name = "Arthur Masson",email = "arthur.masson@inria.fr"}, @@ -36,7 +36,6 @@ py-modules = [] [tool.setuptools_scm] - [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} From 147e3ac283f43b82c3cb55cbddc7467812cdfd63 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 15:11:52 +0200 Subject: [PATCH 11/18] [BF]: added environment.yml corresponding to requirements.txt --- environment.yml | 208 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 environment.yml diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..2465de7 --- /dev/null +++ b/environment.yml @@ -0,0 +1,208 @@ +name: test-install +channels: + - conda-forge + - defaults +dependencies: + - _libgcc_mutex=0.1=conda_forge + - _openmp_mutex=4.5=2_gnu + - annexremote=1.6.5=py310hff52083_0 + - atk-1.0=2.36.0=h516909a_2 + - backports=1.0=pyhd8ed1ab_3 + - backports.tarfile=1.0.0=pyhd8ed1ab_1 + - boto3=1.34.144=pyhd8ed1ab_0 + - botocore=1.34.144=pyge310_1234567_0 + - brotli=1.1.0=hd590300_1 + - brotli-bin=1.1.0=hd590300_1 + - brotli-python=1.0.9=py310hd8f1fbe_7 + - bz2file=0.98=py_0 + - bzip2=1.0.8=h5eee18b_6 + - c-ares=1.32.2=h4bc722e_0 + - ca-certificates=2024.7.4=hbcca054_0 + - cached-property=1.5.2=hd8ed1ab_1 + - cached_property=1.5.2=pyha770c72_1 + - cairo=1.16.0=hb05425b_5 + - cffi=1.16.0=py310h2fee648_0 + - chardet=5.2.0=py310hff52083_1 + - ci-info=0.3.0=pyhd8ed1ab_0 + - click=8.1.7=unix_pyh707e725_0 + - colorama=0.4.6=pyhd8ed1ab_0 + - cryptography=42.0.8=py310hb1bd9d3_0 + - curl=8.7.1=hdbd6064_0 + - cycler=0.12.1=pyhd8ed1ab_0 + - datalad=1.1.1=py310hff52083_0 + - dbus=1.13.6=he372182_0 + - dcm2niix=1.0.20211006=h4bd325d_0 + - dcmstack=0.8.0=pyhd8ed1ab_3 + - distro=1.9.0=pyhd8ed1ab_0 + - etelemetry=0.3.1=pyhd8ed1ab_0 + - exifread=3.0.0=pyhd8ed1ab_0 + - expat=2.6.2=h59595ed_0 + - fasteners=0.17.3=pyhd8ed1ab_0 + - filelock=3.15.4=pyhd8ed1ab_0 + - font-ttf-dejavu-sans-mono=2.37=hab24e00_0 + - font-ttf-inconsolata=3.000=h77eed37_0 + - font-ttf-source-code-pro=2.038=h77eed37_0 + - font-ttf-ubuntu=0.83=h77eed37_2 + - fontconfig=2.14.1=h4c34cd2_2 + - fonts-conda-ecosystem=1=0 + - fonts-conda-forge=1=0 + - fonttools=4.53.1=py310h5b4e0ec_0 + - freetype=2.10.4=h0708190_1 + - fribidi=1.0.10=h36c2ea0_0 + - gdk-pixbuf=2.42.10=h5eee18b_0 + - gettext=0.21.1=h27087fc_0 + - git=2.33.0=pl5321hf874766_1 + - git-annex=10.20230626=nodep_h1234567_1 + - glib=2.69.1=he621ea3_2 + - gobject-introspection=1.72.0=py310hbb6d50b_2 + - graphite2=1.3.14=h295c915_1 + - graphviz=2.50.0=h3cd0ef9_0 + - gtk2=2.24.33=h73c1081_2 + - gts=0.7.6=h08bb679_0 + - h2=4.1.0=pyhd8ed1ab_0 + - h5py=3.7.0=nompi_py310h06dffec_100 + - harfbuzz=4.3.0=hf52aaf7_2 + - hdf5=1.12.1=h2b7332f_3 + - heudiconv=1.1.6=pyhd8ed1ab_0 + - hpack=4.0.0=pyh9f0ad1d_0 + - humanize=4.10.0=pyhd8ed1ab_0 + - hyperframe=6.0.1=pyhd8ed1ab_0 + - icu=73.1=h6a678d5_0 + - importlib_metadata=8.0.0=hd8ed1ab_0 + - importlib_resources=6.4.0=pyhd8ed1ab_0 + - iso8601=2.1.0=pyhd8ed1ab_0 + - isodate=0.6.1=pyhd8ed1ab_0 + - jaraco.classes=3.4.0=pyhd8ed1ab_1 + - jaraco.context=5.3.0=pyhd8ed1ab_1 + - jaraco.functools=4.0.0=pyhd8ed1ab_0 + - jeepney=0.8.0=pyhd8ed1ab_0 + - jmespath=1.0.1=pyhd8ed1ab_0 + - jpeg=9e=h0b41bf4_3 + - keyring=25.2.1=pyha804496_0 + - keyrings.alt=5.0.1=pyhd8ed1ab_1 + - kiwisolver=1.4.2=py310hbf28c38_1 + - krb5=1.20.1=h143b758_1 + - lcms2=2.15=hfd0df8a_0 + - ld_impl_linux-64=2.38=h1181459_1 + - lerc=3.0=h9c3ff4c_0 + - libblas=3.9.0=20_linux64_openblas + - libbrotlicommon=1.1.0=hd590300_1 + - libbrotlidec=1.1.0=hd590300_1 + - libbrotlienc=1.1.0=hd590300_1 + - libcblas=3.9.0=20_linux64_openblas + - libcurl=8.7.1=h251f7ec_0 + - libdeflate=1.17=h0b41bf4_0 + - libedit=3.1.20230828=h5eee18b_0 + - libev=4.33=hd590300_2 + - libexpat=2.6.2=h59595ed_0 + - libffi=3.4.4=h6a678d5_1 + - libgcc-ng=14.1.0=h77fa898_0 + - libgd=2.3.3=h695aa2c_1 + - libgfortran-ng=14.1.0=h69a702a_0 + - libgfortran5=14.1.0=hc5f4f2c_0 + - libgomp=14.1.0=h77fa898_0 + - libiconv=1.17=hd590300_2 + - liblapack=3.9.0=20_linux64_openblas + - libnghttp2=1.57.0=h2d74bed_0 + - libopenblas=0.3.25=pthreads_h413a1c8_0 + - libpng=1.6.39=h5eee18b_0 + - librsvg=2.54.4=h36cc946_3 + - libssh2=1.10.0=ha35d2d1_2 + - libstdcxx-ng=11.2.0=h1234567_1 + - libtiff=4.5.1=h6a678d5_0 + - libtool=2.4.7=h27087fc_0 + - libuuid=1.41.5=h5eee18b_0 + - libwebp-base=1.4.0=hd590300_0 + - libxcb=1.16=hd590300_0 + - libxcrypt=4.4.36=hd590300_1 + - libxml2=2.10.4=hfdd30dd_2 + - libxslt=1.1.37=h873f0b0_0 + - looseversion=1.3.0=pyhd8ed1ab_0 + - lxml=4.9.1=py310h5764c6d_0 + - lz4-c=1.9.4=h6a678d5_1 + - matplotlib-base=3.5.2=py310h5701ce4_0 + - more-itertools=10.3.0=pyhd8ed1ab_0 + - msgpack-python=1.0.3=py310hbf28c38_1 + - munkres=1.1.4=pyh9f0ad1d_0 + - mutagen=1.47.0=pyhd8ed1ab_0 + - ncurses=6.4=h6a678d5_0 + - networkx=3.2=pyhd8ed1ab_0 + - nipype=1.8.6=py310hff52083_0 + - numpy=1.22.3=py310h4ef5377_2 + - openjpeg=2.4.0=h9ca470c_2 + - openssl=3.3.1=h4bc722e_2 + - p7zip=16.02=h9c3ff4c_1001 + - packaging=24.1=pyhd8ed1ab_0 + - pango=1.50.7=h05da053_0 + - pathlib=1.0.1=py310hff52083_7 + - patool=2.3.0=pyhd8ed1ab_0 + - pcre=8.45=h9c3ff4c_0 + - pcre2=10.37=h032f7d1_0 + - perl=5.32.1=7_hd590300_perl5 + - pip=24.0=py310h06a4308_0 + - pixman=0.40.0=h36c2ea0_0 + - platformdirs=4.2.2=pyhd8ed1ab_0 + - prov=2.0.0=pyhd3deb0d_0 + - psutil=6.0.0=py310hc51659f_0 + - pthread-stubs=0.4=h36c2ea0_1001 + - pycparser=2.22=pyhd8ed1ab_0 + - pydot=3.0.1=py310hff52083_0 + - pyparsing=3.1.2=pyhd8ed1ab_0 + - pyperclip=1.8.2=pyhd8ed1ab_2 + - pysocks=1.7.1=pyha2e5f31_6 + - python=3.10.14=h955ad1f_1 + - python-gitlab=4.8.0=pyhd8ed1ab_0 + - python_abi=3.10=2_cp310 + - rdflib=7.0.0=pyhd8ed1ab_0 + - readline=8.2=h5eee18b_0 + - requests-ftp=0.3.1=py_1 + - requests-toolbelt=1.0.0=pyhd8ed1ab_0 + - s3transfer=0.10.2=pyhd8ed1ab_0 + - secretstorage=3.3.3=py310hff52083_2 + - setuptools=69.5.1=py310h06a4308_0 + - simplejson=3.19.2=py310h2372a71_0 + - six=1.16.0=pyh6c4a22f_0 + - sqlite=3.45.3=h5eee18b_0 + - tk=8.6.14=h39e8969_0 + - traits=6.3.2=py310h5764c6d_1 + - typing_extensions=4.12.2=pyha770c72_0 + - tzdata=2024a=h04d1e81_0 + - unicodedata2=15.1.0=py310h2372a71_0 + - wheel=0.43.0=py310h06a4308_0 + - whoosh=2.7.4=py310hff52083_8 + - xorg-libxau=1.0.11=hd590300_0 + - xorg-libxdmcp=1.1.3=h7f98852_0 + - xvfbwrapper=0.2.9=pyhd8ed1ab_1005 + - xz=5.4.6=h5eee18b_1 + - zlib=1.2.13=h5eee18b_1 + - zstandard=0.22.0=py310h1275a96_0 + - zstd=1.5.5=hc292b87_2 + - pip: + - certifi==2021.10.8 + - charset-normalizer==2.0.8 + - dicom2nifti==2.3.0 + - dicomanonymizer==0.0.1 + - idna==3.3 + - importlib-metadata==4.8.2 + - multivolumefile==0.2.3 + - nibabel==5.2.1 + - pandas==1.4.2 + - pillow==9.0.0 + - py7zr==0.17.0 + - pybcj==0.5.0 + - pycryptodomex==3.12.0 + - pydicom==2.2.2 + - pyppmd==0.17.3 + - python-dateutil==2.8.2 + - python-dotenv==0.19.2 + - pytz==2021.3 + - pyzstd==0.15.0 + - requests==2.26.0 + - scipy==1.11.4 + - simpleitk==2.1.1.2 + - texttable==1.6.4 + - tqdm==4.62.3 + - typing-extensions==4.0.1 + - urllib3==1.26.7 + - zipp==3.6.0 +prefix: /home/alpron/softs/miniconda3/envs/test From 736e320b5264c4f5ffd1abf9061957f39a8ab49f Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 15:22:37 +0200 Subject: [PATCH 12/18] [BF]: fix pip and conda installation syntax --- .github/workflows/conda-installation.yml | 34 +++++++++++++++++++ ...-installation.yml => pip-installation.yml} | 0 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/conda-installation.yml rename .github/workflows/{python-installation.yml => pip-installation.yml} (100%) diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml new file mode 100644 index 0000000..132af25 --- /dev/null +++ b/.github/workflows/conda-installation.yml @@ -0,0 +1,34 @@ +name: Python installation + +on: [push] + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.8", "3.9", "3.10"] + #TODO: use github action to read python version from pyproject.toml + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + environment-file: environment.yml + activate-environment: test-install + python-version: ${{ matrix.python-version }} + + # Create virtual env under each python version + # (optional and a bit redundant because we are already on a specific python) + # it insures installation instruction provided in README are working +# - name: Test with pytest +# run: pytest tests.py --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml +# - name: Upload pytest test results +# uses: actions/upload-artifact@v4 +# with: +# name: pytest-results-${{ matrix.python-version }} +# path: junit/test-results-${{ matrix.python-version }}.xml +# # Use always() to always run this step to publish test results when there are test failures +# if: ${{ always() }} diff --git a/.github/workflows/python-installation.yml b/.github/workflows/pip-installation.yml similarity index 100% rename from .github/workflows/python-installation.yml rename to .github/workflows/pip-installation.yml From f9a438a546a0fb1baaf14e3b75e80365e0bbd932 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 15:34:16 +0200 Subject: [PATCH 13/18] [BF]: fix pip and conda installation syntax --- .github/workflows/conda-installation.yml | 2 +- .github/workflows/pip-installation.yml | 4 ++-- README.md | 9 +++++++-- environment.yml | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml index 132af25..d8becbc 100644 --- a/.github/workflows/conda-installation.yml +++ b/.github/workflows/conda-installation.yml @@ -17,7 +17,7 @@ jobs: with: auto-update-conda: true environment-file: environment.yml - activate-environment: test-install + activate-environment: working-env python-version: ${{ matrix.python-version }} # Create virtual env under each python version diff --git a/.github/workflows/pip-installation.yml b/.github/workflows/pip-installation.yml index 47530d9..50c97b9 100644 --- a/.github/workflows/pip-installation.yml +++ b/.github/workflows/pip-installation.yml @@ -21,8 +21,8 @@ jobs: # it insures installation instruction provided in README are working - name: Install dependencies run: | - python -m venv test-env --clear - source test-env/bin/activate + python -m venv working-env --clear + source working-env/bin/activate python -m pip install --upgrade pip python -m pip install -e . # - name: Test with pytest diff --git a/README.md b/README.md index 779f271..e0c44ab 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,19 @@ The scripts `convert_dicoms_to_niftis.py` and `create_previews.py` enable to con ## Install -It is advised to install the project in [a virtual environment](https://docs.python.org/3/tutorial/venv.html). - +It is advised to install the project in python virtual environment relying either on [venv](https://docs.python.org/3/tutorial/venv.html) or preferably [(mini)conda](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) +### Installation with pip [Install python with pip](https://www.python.org/downloads/) ; then use `pip install .` to install python dependencies. Optionally, rename the `.env.example` to `.env` and set the variables (`shanoir_password`, `gpg_recipient`) to your needs. *See the "Installing DicomAnonymizer" section if you want to use DicomAnonymizer for the dicom anonymization instead of PyDicom.* +### Installation with conda +> [!IMPORTANT] +> This installation is required if shanoir2bids.py is used + +After installing a (mini)conda distribution type in a terminal `conda create -f environment.yml` then activate the environment using `conda activate working-env` where `working-env` is the default name of the created environment ## Usage There are three scripts to download datasets: diff --git a/environment.yml b/environment.yml index 2465de7..7a0d5fd 100644 --- a/environment.yml +++ b/environment.yml @@ -1,4 +1,4 @@ -name: test-install +name: working-env channels: - conda-forge - defaults From 4b13f024e79646b742941954a2f7dbb1f70943c6 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 16:28:41 +0200 Subject: [PATCH 14/18] [BF]: fix pip and conda installation syntax --- .github/workflows/conda-installation.yml | 5 +- environment.yml | 208 ----------------------- 2 files changed, 4 insertions(+), 209 deletions(-) delete mode 100644 environment.yml diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml index d8becbc..198d557 100644 --- a/.github/workflows/conda-installation.yml +++ b/.github/workflows/conda-installation.yml @@ -16,9 +16,12 @@ jobs: uses: conda-incubator/setup-miniconda@v3 with: auto-update-conda: true - environment-file: environment.yml activate-environment: working-env python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install -e . + conda install -c conda-forge heudiconv git-annex=*alldep datalaad # Create virtual env under each python version # (optional and a bit redundant because we are already on a specific python) diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 7a0d5fd..0000000 --- a/environment.yml +++ /dev/null @@ -1,208 +0,0 @@ -name: working-env -channels: - - conda-forge - - defaults -dependencies: - - _libgcc_mutex=0.1=conda_forge - - _openmp_mutex=4.5=2_gnu - - annexremote=1.6.5=py310hff52083_0 - - atk-1.0=2.36.0=h516909a_2 - - backports=1.0=pyhd8ed1ab_3 - - backports.tarfile=1.0.0=pyhd8ed1ab_1 - - boto3=1.34.144=pyhd8ed1ab_0 - - botocore=1.34.144=pyge310_1234567_0 - - brotli=1.1.0=hd590300_1 - - brotli-bin=1.1.0=hd590300_1 - - brotli-python=1.0.9=py310hd8f1fbe_7 - - bz2file=0.98=py_0 - - bzip2=1.0.8=h5eee18b_6 - - c-ares=1.32.2=h4bc722e_0 - - ca-certificates=2024.7.4=hbcca054_0 - - cached-property=1.5.2=hd8ed1ab_1 - - cached_property=1.5.2=pyha770c72_1 - - cairo=1.16.0=hb05425b_5 - - cffi=1.16.0=py310h2fee648_0 - - chardet=5.2.0=py310hff52083_1 - - ci-info=0.3.0=pyhd8ed1ab_0 - - click=8.1.7=unix_pyh707e725_0 - - colorama=0.4.6=pyhd8ed1ab_0 - - cryptography=42.0.8=py310hb1bd9d3_0 - - curl=8.7.1=hdbd6064_0 - - cycler=0.12.1=pyhd8ed1ab_0 - - datalad=1.1.1=py310hff52083_0 - - dbus=1.13.6=he372182_0 - - dcm2niix=1.0.20211006=h4bd325d_0 - - dcmstack=0.8.0=pyhd8ed1ab_3 - - distro=1.9.0=pyhd8ed1ab_0 - - etelemetry=0.3.1=pyhd8ed1ab_0 - - exifread=3.0.0=pyhd8ed1ab_0 - - expat=2.6.2=h59595ed_0 - - fasteners=0.17.3=pyhd8ed1ab_0 - - filelock=3.15.4=pyhd8ed1ab_0 - - font-ttf-dejavu-sans-mono=2.37=hab24e00_0 - - font-ttf-inconsolata=3.000=h77eed37_0 - - font-ttf-source-code-pro=2.038=h77eed37_0 - - font-ttf-ubuntu=0.83=h77eed37_2 - - fontconfig=2.14.1=h4c34cd2_2 - - fonts-conda-ecosystem=1=0 - - fonts-conda-forge=1=0 - - fonttools=4.53.1=py310h5b4e0ec_0 - - freetype=2.10.4=h0708190_1 - - fribidi=1.0.10=h36c2ea0_0 - - gdk-pixbuf=2.42.10=h5eee18b_0 - - gettext=0.21.1=h27087fc_0 - - git=2.33.0=pl5321hf874766_1 - - git-annex=10.20230626=nodep_h1234567_1 - - glib=2.69.1=he621ea3_2 - - gobject-introspection=1.72.0=py310hbb6d50b_2 - - graphite2=1.3.14=h295c915_1 - - graphviz=2.50.0=h3cd0ef9_0 - - gtk2=2.24.33=h73c1081_2 - - gts=0.7.6=h08bb679_0 - - h2=4.1.0=pyhd8ed1ab_0 - - h5py=3.7.0=nompi_py310h06dffec_100 - - harfbuzz=4.3.0=hf52aaf7_2 - - hdf5=1.12.1=h2b7332f_3 - - heudiconv=1.1.6=pyhd8ed1ab_0 - - hpack=4.0.0=pyh9f0ad1d_0 - - humanize=4.10.0=pyhd8ed1ab_0 - - hyperframe=6.0.1=pyhd8ed1ab_0 - - icu=73.1=h6a678d5_0 - - importlib_metadata=8.0.0=hd8ed1ab_0 - - importlib_resources=6.4.0=pyhd8ed1ab_0 - - iso8601=2.1.0=pyhd8ed1ab_0 - - isodate=0.6.1=pyhd8ed1ab_0 - - jaraco.classes=3.4.0=pyhd8ed1ab_1 - - jaraco.context=5.3.0=pyhd8ed1ab_1 - - jaraco.functools=4.0.0=pyhd8ed1ab_0 - - jeepney=0.8.0=pyhd8ed1ab_0 - - jmespath=1.0.1=pyhd8ed1ab_0 - - jpeg=9e=h0b41bf4_3 - - keyring=25.2.1=pyha804496_0 - - keyrings.alt=5.0.1=pyhd8ed1ab_1 - - kiwisolver=1.4.2=py310hbf28c38_1 - - krb5=1.20.1=h143b758_1 - - lcms2=2.15=hfd0df8a_0 - - ld_impl_linux-64=2.38=h1181459_1 - - lerc=3.0=h9c3ff4c_0 - - libblas=3.9.0=20_linux64_openblas - - libbrotlicommon=1.1.0=hd590300_1 - - libbrotlidec=1.1.0=hd590300_1 - - libbrotlienc=1.1.0=hd590300_1 - - libcblas=3.9.0=20_linux64_openblas - - libcurl=8.7.1=h251f7ec_0 - - libdeflate=1.17=h0b41bf4_0 - - libedit=3.1.20230828=h5eee18b_0 - - libev=4.33=hd590300_2 - - libexpat=2.6.2=h59595ed_0 - - libffi=3.4.4=h6a678d5_1 - - libgcc-ng=14.1.0=h77fa898_0 - - libgd=2.3.3=h695aa2c_1 - - libgfortran-ng=14.1.0=h69a702a_0 - - libgfortran5=14.1.0=hc5f4f2c_0 - - libgomp=14.1.0=h77fa898_0 - - libiconv=1.17=hd590300_2 - - liblapack=3.9.0=20_linux64_openblas - - libnghttp2=1.57.0=h2d74bed_0 - - libopenblas=0.3.25=pthreads_h413a1c8_0 - - libpng=1.6.39=h5eee18b_0 - - librsvg=2.54.4=h36cc946_3 - - libssh2=1.10.0=ha35d2d1_2 - - libstdcxx-ng=11.2.0=h1234567_1 - - libtiff=4.5.1=h6a678d5_0 - - libtool=2.4.7=h27087fc_0 - - libuuid=1.41.5=h5eee18b_0 - - libwebp-base=1.4.0=hd590300_0 - - libxcb=1.16=hd590300_0 - - libxcrypt=4.4.36=hd590300_1 - - libxml2=2.10.4=hfdd30dd_2 - - libxslt=1.1.37=h873f0b0_0 - - looseversion=1.3.0=pyhd8ed1ab_0 - - lxml=4.9.1=py310h5764c6d_0 - - lz4-c=1.9.4=h6a678d5_1 - - matplotlib-base=3.5.2=py310h5701ce4_0 - - more-itertools=10.3.0=pyhd8ed1ab_0 - - msgpack-python=1.0.3=py310hbf28c38_1 - - munkres=1.1.4=pyh9f0ad1d_0 - - mutagen=1.47.0=pyhd8ed1ab_0 - - ncurses=6.4=h6a678d5_0 - - networkx=3.2=pyhd8ed1ab_0 - - nipype=1.8.6=py310hff52083_0 - - numpy=1.22.3=py310h4ef5377_2 - - openjpeg=2.4.0=h9ca470c_2 - - openssl=3.3.1=h4bc722e_2 - - p7zip=16.02=h9c3ff4c_1001 - - packaging=24.1=pyhd8ed1ab_0 - - pango=1.50.7=h05da053_0 - - pathlib=1.0.1=py310hff52083_7 - - patool=2.3.0=pyhd8ed1ab_0 - - pcre=8.45=h9c3ff4c_0 - - pcre2=10.37=h032f7d1_0 - - perl=5.32.1=7_hd590300_perl5 - - pip=24.0=py310h06a4308_0 - - pixman=0.40.0=h36c2ea0_0 - - platformdirs=4.2.2=pyhd8ed1ab_0 - - prov=2.0.0=pyhd3deb0d_0 - - psutil=6.0.0=py310hc51659f_0 - - pthread-stubs=0.4=h36c2ea0_1001 - - pycparser=2.22=pyhd8ed1ab_0 - - pydot=3.0.1=py310hff52083_0 - - pyparsing=3.1.2=pyhd8ed1ab_0 - - pyperclip=1.8.2=pyhd8ed1ab_2 - - pysocks=1.7.1=pyha2e5f31_6 - - python=3.10.14=h955ad1f_1 - - python-gitlab=4.8.0=pyhd8ed1ab_0 - - python_abi=3.10=2_cp310 - - rdflib=7.0.0=pyhd8ed1ab_0 - - readline=8.2=h5eee18b_0 - - requests-ftp=0.3.1=py_1 - - requests-toolbelt=1.0.0=pyhd8ed1ab_0 - - s3transfer=0.10.2=pyhd8ed1ab_0 - - secretstorage=3.3.3=py310hff52083_2 - - setuptools=69.5.1=py310h06a4308_0 - - simplejson=3.19.2=py310h2372a71_0 - - six=1.16.0=pyh6c4a22f_0 - - sqlite=3.45.3=h5eee18b_0 - - tk=8.6.14=h39e8969_0 - - traits=6.3.2=py310h5764c6d_1 - - typing_extensions=4.12.2=pyha770c72_0 - - tzdata=2024a=h04d1e81_0 - - unicodedata2=15.1.0=py310h2372a71_0 - - wheel=0.43.0=py310h06a4308_0 - - whoosh=2.7.4=py310hff52083_8 - - xorg-libxau=1.0.11=hd590300_0 - - xorg-libxdmcp=1.1.3=h7f98852_0 - - xvfbwrapper=0.2.9=pyhd8ed1ab_1005 - - xz=5.4.6=h5eee18b_1 - - zlib=1.2.13=h5eee18b_1 - - zstandard=0.22.0=py310h1275a96_0 - - zstd=1.5.5=hc292b87_2 - - pip: - - certifi==2021.10.8 - - charset-normalizer==2.0.8 - - dicom2nifti==2.3.0 - - dicomanonymizer==0.0.1 - - idna==3.3 - - importlib-metadata==4.8.2 - - multivolumefile==0.2.3 - - nibabel==5.2.1 - - pandas==1.4.2 - - pillow==9.0.0 - - py7zr==0.17.0 - - pybcj==0.5.0 - - pycryptodomex==3.12.0 - - pydicom==2.2.2 - - pyppmd==0.17.3 - - python-dateutil==2.8.2 - - python-dotenv==0.19.2 - - pytz==2021.3 - - pyzstd==0.15.0 - - requests==2.26.0 - - scipy==1.11.4 - - simpleitk==2.1.1.2 - - texttable==1.6.4 - - tqdm==4.62.3 - - typing-extensions==4.0.1 - - urllib3==1.26.7 - - zipp==3.6.0 -prefix: /home/alpron/softs/miniconda3/envs/test From d705257d8ea1cf7292250da97f91e4b842e071c2 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 16:37:50 +0200 Subject: [PATCH 15/18] [BF]: fix pip and conda installation syntax --- .github/workflows/conda-installation.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml index 198d557..28bb172 100644 --- a/.github/workflows/conda-installation.yml +++ b/.github/workflows/conda-installation.yml @@ -18,9 +18,11 @@ jobs: auto-update-conda: true activate-environment: working-env python-version: ${{ matrix.python-version }} + auto-activate-base: false - name: Install dependencies + shell: bash -el {0} run: | - python -m pip install -e . + python -m pip install . conda install -c conda-forge heudiconv git-annex=*alldep datalaad # Create virtual env under each python version From 376fb2015e9d5c6c67bd79423814b46f28023943 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 16:41:13 +0200 Subject: [PATCH 16/18] [BF]: fix conda syntax for build --- .github/workflows/conda-installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml index 28bb172..c87cba9 100644 --- a/.github/workflows/conda-installation.yml +++ b/.github/workflows/conda-installation.yml @@ -23,7 +23,7 @@ jobs: shell: bash -el {0} run: | python -m pip install . - conda install -c conda-forge heudiconv git-annex=*alldep datalaad + conda install -c conda-forge heudiconv git-annex=*=alldep* datalad # Create virtual env under each python version # (optional and a bit redundant because we are already on a specific python) From 957746ae109fe774df2f3a4b3874a62e304a53cf Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Thu, 18 Jul 2024 16:50:38 +0200 Subject: [PATCH 17/18] [BF]: updated installation instructions --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e0c44ab..28fb461 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,13 @@ Optionally, rename the `.env.example` to `.env` and set the variables (`shanoir_ ### Installation with conda > [!IMPORTANT] -> This installation is required if shanoir2bids.py is used +> This installation method is required if shanoir2bids.py is used -After installing a (mini)conda distribution type in a terminal `conda create -f environment.yml` then activate the environment using `conda activate working-env` where `working-env` is the default name of the created environment +In an active conda virtual environment type +``` +pip install . +conda install -c conda-forge heudiconv git-annex=*=alldep* datalad +``` ## Usage There are three scripts to download datasets: From cbbe985aed8a75b3f826062100a0b75b853e4378 Mon Sep 17 00:00:00 2001 From: Alexandre Pron Date: Fri, 19 Jul 2024 14:26:43 +0200 Subject: [PATCH 18/18] [BF]: updated conda installation and instructions so that pip packages are conda dependencies --- .github/workflows/conda-installation.yml | 4 +++- README.md | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/conda-installation.yml b/.github/workflows/conda-installation.yml index c87cba9..c7d1079 100644 --- a/.github/workflows/conda-installation.yml +++ b/.github/workflows/conda-installation.yml @@ -22,8 +22,10 @@ jobs: - name: Install dependencies shell: bash -el {0} run: | + conda config --set pip_interop_enabled True python -m pip install . - conda install -c conda-forge heudiconv git-annex=*=alldep* datalad + conda update --all + conda install -c conda-forge heudiconv bids-validator dcm2niix git-annex=*=alldep* datalad # Create virtual env under each python version # (optional and a bit redundant because we are already on a specific python) diff --git a/README.md b/README.md index 28fb461..eaeb567 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,13 @@ Optionally, rename the `.env.example` to `.env` and set the variables (`shanoir_ > This installation method is required if shanoir2bids.py is used In an active conda virtual environment type -``` +```bash +#use pip packages as dependencies +conda config --set pip_interop_enabled True pip install . +#replace pip packages with conda packages when equivalent +conda update --all +# install missing conda packages (far simpler than using pip) conda install -c conda-forge heudiconv git-annex=*=alldep* datalad ``` ## Usage