You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some python applications use optional dependencies / extras_requires to represent support for non-essential features.
Being able to set extraDependencies = [ "feat1" "feat2" ] or something in a derivation would be nice, similar to how buildFeatures = [] works in buildRustPackage.
Technical details
The setuptools build hook calls pip install -e . directly and does not allow any environment variables to customize the invocation. Installing optional dependencies seems to require running pip install -e '.[feat1,feat2,etc]' instead.
The text was updated successfully, but these errors were encountered:
optional-dependencies was introduced to deal with optional requirements of Python module (see 17.27.2.3.2. Optional extra dependencies in the manual for details).
Note that I am specifically referring to derivations that end users will interact with (applications mainly), not modules used by other python projects/derivations. The difference is that while another python module/application/etc can enable extras by depending on dask[complete], a derivation building a final package that isn't used as a python dependency cannot.
So this is mainly useful for buildPythonApplication (and hybrid toPythonApplication modules probably too, as well as modules that act as dynamic plugins rather than dependencies). For example, a python application might optionally support sqlite as a database backend, and mark it as an optional feature. Even though you can just shove the dependencies into propagatedBuildInputs anyway and it will be in the closure/PYTHONPATH, you lose various checks and safety that can result in runtime failures (but successful builds).
Thanks for pointing that out though, it is relevant and helpful!
arcnmx
changed the title
python/setuptools extras_requires optional feature support
python optional-dependencies build-time support
Nov 26, 2022
Some python applications use optional dependencies /
extras_requires
to represent support for non-essential features.Being able to set
extraDependencies = [ "feat1" "feat2" ]
or something in a derivation would be nice, similar to howbuildFeatures = []
works inbuildRustPackage
.Technical details
The setuptools build hook calls
pip install -e .
directly and does not allow any environment variables to customize the invocation. Installing optional dependencies seems to require runningpip install -e '.[feat1,feat2,etc]'
instead.The text was updated successfully, but these errors were encountered: