From 06c714e0fd6b994d3f0f91a0c889cf4efd4e3b04 Mon Sep 17 00:00:00 2001 From: Constantin Pape Date: Wed, 13 Nov 2019 19:30:31 +0100 Subject: [PATCH 1/2] Change conda and pip dependency handling --- conda-recipe/meta.yaml | 2 +- setup.py | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 4625eb4..9c7730f 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -31,7 +31,7 @@ requirements: {% for dep in data['install_requires'] %} - {{ dep.lower() }} {% endfor %} - {% for dep in data['extras_require']['all'] %} + {% for dep in data['extras_require']['conda'] %} - {{ dep.lower() }} {% endfor %} diff --git a/setup.py b/setup.py index fd32054..bfb92b3 100644 --- a/setup.py +++ b/setup.py @@ -2,34 +2,34 @@ import itertools from setuptools import setup, find_packages -__version__ = runpy.run_path('elf/__version__.py')['__version__'] +__version__ = runpy.run_path("elf/__version__.py")["__version__"] requires = [ "numpy", "imageio", "scikit-image", - "skan" + "skan", + "h5py", + "zarr" ] -extras = { - "hdf5": ["h5py"], - "zarr": ["zarr"], - "vigra": ["vigra"], # conda-only - "nifty": ["nifty"], # conda-only; name clash w/ different PyPI package - # "n5": ["pyn5"], # PyPI-only -} +# extras that are only available on conda +extras_conda = ["vigra", "nifty", "z5py"] +# extras that are only available on pip +extras_pip = ["pyn5"] + +extras = {"conda": extras_conda, "pip": extras_pip} -extras["all"] = list(itertools.chain.from_iterable(extras.values())) setup( - name='elf', - packages=find_packages(exclude=['test']), + name="elf", + packages=find_packages(exclude=["test"]), version=__version__, - author='Constantin Pape', + author="Constantin Pape", install_requires=requires, extras_require=extras, - url='https://github.com/constantinpape/elf', - license='MIT' + url="https://github.com/constantinpape/elf", + license="MIT" # we will probably have scripts at some point, so I am leaving this for reference # entry_points={ # "console_scripts": ["view_container = heimdall.scripts.view_container:main"] From 27642ffffc153aca984ceec20fcdd23419a9bc4e Mon Sep 17 00:00:00 2001 From: Constantin Pape Date: Wed, 13 Nov 2019 21:13:18 +0100 Subject: [PATCH 2/2] Rearange dependencies --- .travis.yml | 3 +-- conda-recipe/meta.yaml | 2 +- setup.py | 30 ++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 001f782..db8f3df 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,7 @@ install: before_script: - conda create -n test-env -c conda-forge -c defaults -c cpape --use-local elf - conda activate test-env - - conda install -c conda-forge -c defaults -c cpape nifty - - conda install -c conda-forge -c defaults z5py + # we still need to install zarr and pyn5, because they are not included by conda - conda install -c conda-forge -c defaults zarr - pip install pyn5 diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 9c7730f..798b97a 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -31,7 +31,7 @@ requirements: {% for dep in data['install_requires'] %} - {{ dep.lower() }} {% endfor %} - {% for dep in data['extras_require']['conda'] %} + {% for dep in data['extras_require']['conda_all'] %} - {{ dep.lower() }} {% endfor %} diff --git a/setup.py b/setup.py index bfb92b3..b5a668b 100644 --- a/setup.py +++ b/setup.py @@ -8,18 +8,32 @@ "numpy", "imageio", "scikit-image", - "skan", - "h5py", - "zarr" + "skan" ] -# extras that are only available on conda -extras_conda = ["vigra", "nifty", "z5py"] -# extras that are only available on pip -extras_pip = ["pyn5"] -extras = {"conda": extras_conda, "pip": extras_pip} +# optional dependencies for setuptools +extras = { + "hdf5": "h5py", + "zarr": "zarr", + "n5": "pyn5" +} +# dependencies only available via conda, +# we still collect them here, because the conda recipe +# gets it's requirements from setuptools. +conda_only = ["vigra", "nifty", "z5py"] + +# collect all dependencies for conda +conda_exclude = [ + "zarr", # we don't need zarr dependencies in conda, because we use z5py + "pyn5" # pyn5 is not available on conda (and not needed due to z5py) +] +conda_all = conda_only + [v for v in extras.values() if v not in conda_exclude] +extras["conda_all"] = conda_all + +# NOTE in case we want to support different conda flavors at some point, we +# can add keys to 'extras', e.g. 'conda_no_hdf5' without h5py setup( name="elf",