odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/
Mozilla Public License 2.0
368 stars 105 forks source link

Where to add extra dependencies? #38

Closed kohr-h closed 8 years ago

kohr-h commented 8 years ago

For some reason, we needed the requirements in text files instead of a string in setup.py. What about extra dependencies? For example, the Fourier transform operator will depend on pyfftw, and the wavelet transform will use PyWavelets. I'd want to be able to pull the dependencies by writing

pip install --user -e .[fft,wavelets]

This actually works and asks for the extras_require dictionary for the dependencies, so the dependency info goes there.

Question is: also into a file? Or in a string? Or is it perhaps possible to create extra sections in the requirements file? I could not find anything on the web treating the last topic.

adler-j commented 8 years ago

To my knowledge you can simply write (in requirements.txt):

pyfftw >= 0.1 [wavelets]

this is according to the pip documentation

kohr-h commented 8 years ago

Hm, I'll try that, but I read that as an extra requirement passed to the pyfftw install.

kohr-h commented 8 years ago

It's not working. Inequality requirements do not seem to work at all, and when I add the dependency

Pywavelets [wavelets]

pip tries to hand the wavelets option on to the setup file of Pywavelets as an extras_require argument, i.e. it expects an entry

setup(
    ...
    extras_require={
        'wavelets': 'something'
    }
    ...
)

in the Pywavelets setup file. Consequently, I get the warning

PyWavelets 0.3.0 does not provide the extra 'wavelets'

during install. So this is not a solution.

Remaining alternatives are extra requirements files (possibly in the odl/solvers folder) or giving them directly as strings in the setup.py. Maybe we need to mock those packages, too, for RTD.

adler-j commented 8 years ago

Regarding RTD, I changed the behaviour of cu_ntuples so that it is always imported. Instead, calling any of It's functions (really only CudaRn since this is the sole entry point) should give a "nice" error message. I think this is more appropriate behaviour, AND it works better with RTD.

kohr-h commented 8 years ago

So then there's no problem, right? I'll just add the stuff as extra dependencies.

adler-j commented 8 years ago

Sure add then as extras_require for now, we'll have to look into this for PyPI later.

kohr-h commented 8 years ago

Closed by dfc8f493d1d6ae0edd529c6fbb4ab744bb842c3f.