I have a main package (say package A) that I want to have an optional dependency. I know that I can use extras_require
to define optional package dependencies, however I want this optional dependency to use the Extension
module to build using f2py with additional data files. Is there a way to define an extras_require
statement to take an extension module? In other words, when I run my setup.py
file, I can optionally specify that I want to install my wind model, and then it compiles my fortran code using f2py. If the optional wind model dependency is not desired, then the setup.py file runs normally and does not compile the fortran code (useful if a user does not have a fotran compiler installed and does not need this dependency).
The only way I can think to do this currently is by creating a separate package with the wind model and putting this package in the extras_require
for the main package. The downside to this, is that a user would have to run a separate setup.py
file for the wind model, and then return to the main package and run the main setup.py
. To me this is undesirable, and there feels like there should be a way to do this. I have seen this question, however if the cython extension can be downloaded it is downloaded rather than the cython extension needing to be specified by the user.