Merge pull request #174000 from mweinelt/pep621-optional-dependencies

Changed files
+97 -96
doc
languages-frameworks
pkgs
applications
networking
syncplay
office
paperless-ngx
development
python-modules
Mako
adb-shell
androidtv
autobahn
buildbot
clize
dask
datashader
django_modelcluster
fastapi
flask-security-too
httpcore
httpx
httpx-socks
ibis-framework
ldaptor
magic-wormhole
magic-wormhole-mailbox-server
passlib
pure-python-adb
pygatt
python-barcode
pytradfri
rdflib
redis
relatorio
requests-aws4auth
samsungctl
samsungtvws
treq
trytond
twisted
txtorcon
vivisect
volvooncall
tools
devpi-server
servers
tools
networking
p2p
tahoe-lafs
security
wapiti
+4 -3
doc/languages-frameworks/python.section.md
···
#### Optional extra dependencies
Some packages define optional dependencies for additional features. With
-
`setuptools` this is called `extras_require` and `flit` calls it `extras-require`. A
+
`setuptools` this is called `extras_require` and `flit` calls it
+
`extras-require`, while PEP 621 calls these `optional-dependencies`. A
method for supporting this is by declaring the extras of a package in its
`passthru`, e.g. in case of the package `dask`
```nix
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
complete = [ distributed ];
};
```
···
```nix
propagatedBuildInputs = [
...
-
] ++ dask.extras-require.complete;
+
] ++ dask.optional-dependencies.complete;
```
Note this method is preferred over adding parameters to builders, as that can
+1 -1
pkgs/applications/networking/syncplay/default.nix
···
};
propagatedBuildInputs = [ twisted certifi ]
-
++ twisted.extras-require.tls
+
++ twisted.optional-dependencies.tls
++ lib.optional enableGUI pyside2;
nativeBuildInputs = lib.optionals enableGUI [ qt5.wrapQtAppsHook ];
+1 -1
pkgs/applications/office/paperless-ngx/default.nix
···
threadpoolctl
tika
tqdm
-
twisted.extras-require.tls
+
twisted.optional-dependencies.tls
txaio
tzlocal
urllib3
+2 -2
pkgs/development/python-modules/Mako/default.nix
···
markupsafe
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
babel = [
babel
];
···
checkInputs = [
pytestCheckHook
mock
-
] ++ passthru.extras-require.babel;
+
] ++ passthru.optional-dependencies.babel;
disabledTests = lib.optionals isPyPy [
# https://github.com/sqlalchemy/mako/issues/315
+3 -3
pkgs/development/python-modules/adb-shell/default.nix
···
rsa
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
async = [
aiofiles
];
···
pycryptodome
pytestCheckHook
]
-
++ passthru.extras-require.async
-
++ passthru.extras-require.usb;
+
++ passthru.optional-dependencies.async
+
++ passthru.optional-dependencies.usb;
disabledTests = lib.optionals (pythonAtLeast "3.10") [
# Tests are failing with Python 3.10
+4 -4
pkgs/development/python-modules/androidtv/default.nix
···
pure-python-adb
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
async = [
aiofiles
];
-
inherit (adb-shell.extras-require) usb;
+
inherit (adb-shell.optional-dependencies) usb;
};
checkInputs = [
mock
pytestCheckHook
]
-
++ passthru.extras-require.async
-
++ passthru.extras-require.usb;
+
++ passthru.optional-dependencies.async
+
++ passthru.optional-dependencies.usb;
disabledTests = [
# Requires git but fails anyway
+3 -3
pkgs/development/python-modules/autobahn/default.nix
···
mock
pytest-asyncio
pytestCheckHook
-
] ++ passthru.extras-require.scram
-
++ passthru.extras-require.serialization;
+
] ++ passthru.optional-dependencies.scram
+
++ passthru.optional-dependencies.serialization;
postPatch = ''
substituteInPlace setup.py \
···
"autobahn"
];
-
passthru.extras-require = rec {
+
passthru.optional-dependencies = rec {
all = accelerate ++ compress ++ encryption ++ nvx ++ serialization ++ scram ++ twisted ++ ui ++ xbr;
accelerate = [ /* wsaccel */ ];
compress = [ python-snappy ];
+1 -1
pkgs/development/python-modules/buildbot/default.nix
···
pyyaml
]
# tls
-
++ twisted.extras-require.tls;
+
++ twisted.optional-dependencies.tls;
checkInputs = [
treq
+1 -1
pkgs/development/python-modules/clize/default.nix
···
six
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
datetime = [
python-dateutil
];
+1 -1
pkgs/development/python-modules/dask/default.nix
···
"dask.diagnostics"
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
complete = [ distributed ];
};
+1 -1
pkgs/development/python-modules/datashader/default.nix
···
param
pyct
scipy
-
] ++ dask.extras-require.complete;
+
] ++ dask.optional-dependencies.complete;
checkInputs = [
pytestCheckHook
+2 -2
pkgs/development/python-modules/django_modelcluster/default.nix
···
pytz
];
-
passthru.extras-require.taggit = [
+
passthru.optional-dependencies.taggit = [
django-taggit
];
-
checkInputs = passthru.extras-require.taggit;
+
checkInputs = passthru.optional-dependencies.taggit;
checkPhase = ''
runHook preCheck
+1 -1
pkgs/development/python-modules/fastapi/default.nix
···
pytest-asyncio
sqlalchemy
trio
-
] ++ passlib.extras-require.bcrypt;
+
] ++ passlib.optional-dependencies.bcrypt;
patches = [
# Bump starlette, https://github.com/tiangolo/fastapi/pull/4483
+5 -5
pkgs/development/python-modules/flask-security-too/default.nix
···
passlib
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
babel = [
babel
flask-babel
···
pytestCheckHook
zxcvbn
]
-
++ passthru.extras-require.babel
-
++ passthru.extras-require.common
-
++ passthru.extras-require.fsqla
-
++ passthru.extras-require.mfa;
+
++ passthru.optional-dependencies.babel
+
++ passthru.optional-dependencies.common
+
++ passthru.optional-dependencies.fsqla
+
++ passthru.optional-dependencies.mfa;
pythonImportsCheck = [ "flask_security" ];
+3 -3
pkgs/development/python-modules/httpcore/default.nix
···
sniffio
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
http2 = [ h2 ];
socks = [ socksio ];
};
···
trio
trustme
uvicorn
-
] ++ passthru.extras-require.http2
-
++ passthru.extras-require.socks;
+
] ++ passthru.optional-dependencies.http2
+
++ passthru.optional-dependencies.socks;
pythonImportsCheck = [ "httpcore" ];
+1 -1
pkgs/development/python-modules/httpx-socks/default.nix
···
python-socks
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
asyncio = [ async-timeout ];
trio = [ trio ];
};
+4 -4
pkgs/development/python-modules/httpx/default.nix
···
async_generator
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
http2 = [ h2 ];
socks = [ socksio ];
brotli = if isPyPy then [ brotlicffi ] else [ brotli ];
···
trustme
typing-extensions
uvicorn
-
] ++ passthru.extras-require.http2
-
++ passthru.extras-require.brotli
-
++ passthru.extras-require.socks;
+
] ++ passthru.optional-dependencies.http2
+
++ passthru.optional-dependencies.brotli
+
++ passthru.optional-dependencies.socks;
postPatch = ''
substituteInPlace setup.py \
+2 -2
pkgs/development/python-modules/ibis-framework/default.nix
···
pytest-mock
pytest-randomly
pytest-xdist
-
] ++ lib.concatMap (name: passthru.extras-require.${name}) testBackends;
+
] ++ lib.concatMap (name: passthru.optional-dependencies.${name}) testBackends;
preBuild = ''
# setup.py exists only for developer convenience and is automatically generated
···
] ++ map (backend: "ibis.backends.${backend}") testBackends;
passthru = {
-
extras-require = {
+
optional-dependencies = {
clickhouse = [ clickhouse-cityhash clickhouse-driver lz4 ];
dask = [ dask pyarrow ];
datafusion = [ datafusion ];
+1 -1
pkgs/development/python-modules/ldaptor/default.nix
···
six
twisted
zope_interface
-
] ++ twisted.extras-require.tls;
+
] ++ twisted.optional-dependencies.tls;
checkInputs = [
twisted
+2 -2
pkgs/development/python-modules/magic-wormhole-mailbox-server/default.nix
···
six
twisted
autobahn
-
] ++ autobahn.extras-require.twisted
-
++ twisted.extras-require.tls;
+
] ++ autobahn.optional-dependencies.twisted
+
++ twisted.optional-dependencies.tls;
checkInputs = [
treq
+2 -2
pkgs/development/python-modules/magic-wormhole/default.nix
···
click
humanize
txtorcon
-
] ++ autobahn.extras-require.twisted
-
++ twisted.extras-require.tls;
+
] ++ autobahn.optional-dependencies.twisted
+
++ twisted.optional-dependencies.tls;
checkInputs = [
mock
+4 -4
pkgs/development/python-modules/passlib/default.nix
···
sha256 = "defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04";
};
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
argon2 = [ argon2-cffi ];
bcrypt = [ bcrypt ];
totp = [ cryptography ];
···
checkInputs = [
pytestCheckHook
-
] ++ passthru.extras-require.argon2
-
++ passthru.extras-require.bcrypt
-
++ passthru.extras-require.totp;
+
] ++ passthru.optional-dependencies.argon2
+
++ passthru.optional-dependencies.bcrypt
+
++ passthru.optional-dependencies.totp;
meta = with lib; {
description = "A password hashing library for Python";
+2 -2
pkgs/development/python-modules/pure-python-adb/default.nix
···
sha256 = "0kdr7w2fhgjpcf1k3l6an9im583iqkr6v8hb4q1zw30nh3bqkk0f";
};
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
async = [
aiofiles
];
···
checkInputs = [
pytestCheckHook
]
-
++ passthru.extras-require.async;
+
++ passthru.optional-dependencies.async;
pythonImportsCheck = [
"ppadb.client"
+2 -2
pkgs/development/python-modules/pygatt/default.nix
···
pyserial
];
-
passthru.extras-require.GATTTOOL = [
+
passthru.optional-dependencies.GATTTOOL = [
pexpect
];
···
nose
pytestCheckHook
]
-
++ passthru.extras-require.GATTTOOL;
+
++ passthru.optional-dependencies.GATTTOOL;
postPatch = ''
# Not support for Python < 3.4
+2 -2
pkgs/development/python-modules/python-barcode/default.nix
···
setuptools-scm
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
images = [
pillow
];
···
checkInputs = [
pytestCheckHook
-
] ++ passthru.extras-require.images;
+
] ++ passthru.optional-dependencies.images;
pythonImportsCheck = [ "barcode" ];
+2 -2
pkgs/development/python-modules/pytradfri/default.nix
···
hash = "sha256-12ol+2CnoPfkxmDGJJAkoafHGpQuWC4lh0N7lSvx2DE=";
};
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
async = [
aiocoap
dtlssocket
···
checkInputs = [
pytestCheckHook
]
-
++ passthru.extras-require.async;
+
++ passthru.optional-dependencies.async;
pythonImportsCheck = [
"pytradfri"
+3 -3
pkgs/development/python-modules/rdflib/default.nix
···
importlib-metadata
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
html = [
html5lib
];
···
checkInputs = [
pytestCheckHook
]
-
++ passthru.extras-require.networkx
-
++ passthru.extras-require.html;
+
++ passthru.optional-dependencies.networkx
+
++ passthru.optional-dependencies.html;
pytestFlagsArray = [
# requires network access
+1 -1
pkgs/development/python-modules/redis/default.nix
···
importlib-metadata
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
hidredis = [
hiredis
];
+2 -2
pkgs/development/python-modules/relatorio/default.nix
···
lxml
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
chart = [ /* pycha */ pyyaml ];
fodt = [ python-magic ];
};
checkInputs = [
pytestCheckHook
-
] ++ passthru.extras-require.fodt;
+
] ++ passthru.optional-dependencies.fodt;
pythonImportsCheck = [ "relatorio" ];
+2 -2
pkgs/development/python-modules/requests-aws4auth/default.nix
···
six
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
httpx = [ httpx ];
};
checkInputs = [
pytestCheckHook
-
] ++ passthru.extras-require.httpx;
+
] ++ passthru.optional-dependencies.httpx;
pythonImportsCheck = [
"requests_aws4auth"
+1 -1
pkgs/development/python-modules/samsungctl/default.nix
···
sha256 = "0ipz3fd65rqkxlb02sql0awc3vnslrwb2pfrsnpfnf8bfgxpbh9g";
};
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
websocket = [
websocket-client
];
+3 -3
pkgs/development/python-modules/samsungtvws/default.nix
···
websocket-client
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
async = [
aiohttp
websockets
···
pytest-asyncio
pytestCheckHook
]
-
++ passthru.extras-require.async
-
++ passthru.extras-require.encrypted;
+
++ passthru.optional-dependencies.async
+
++ passthru.optional-dependencies.encrypted;
pythonImportsCheck = [ "samsungtvws" ];
+1 -1
pkgs/development/python-modules/treq/default.nix
···
requests
incremental
twisted
-
] ++ twisted.extras-require.tls;
+
] ++ twisted.optional-dependencies.tls;
checkInputs = [
httpbin
+3 -3
pkgs/development/python-modules/trytond/default.nix
···
weasyprint
gevent
pillow
-
] ++ relatorio.extras-require.fodt
-
++ passlib.extras-require.bcrypt
-
++ passlib.extras-require.argon2
+
] ++ relatorio.optional-dependencies.fodt
+
++ passlib.optional-dependencies.bcrypt
+
++ passlib.optional-dependencies.argon2
++ lib.optional withPostgresql psycopg2;
checkPhase = ''
+1 -1
pkgs/development/python-modules/twisted/default.nix
···
propagatedBuildInputs = [ zope_interface incremental automat constantly hyperlink pyhamcrest attrs setuptools typing-extensions ];
-
passthru.extras-require = rec {
+
passthru.optional-dependencies = rec {
tls = [ pyopenssl service-identity idna ];
conch = [ pyasn1 cryptography appdirs bcrypt ];
conch_nacl = conch ++ [ pynacl ];
+1 -1
pkgs/development/python-modules/txtorcon/default.nix
···
propagatedBuildInputs = [
incremental twisted automat zope_interface
-
] ++ twisted.extras-require.tls
+
] ++ twisted.optional-dependencies.tls
++ lib.optionals (!isPy3k) [ ipaddress ];
checkInputs = [ pytestCheckHook mock lsof GeoIP ];
+2 -2
pkgs/development/python-modules/vivisect/default.nix
···
cxxfilt
msgpack
pycparser
-
] ++ lib.optionals (withGui) passthru.extras-require.gui;
+
] ++ lib.optionals (withGui) passthru.optional-dependencies.gui;
-
passthru.extras-require.gui = [
+
passthru.optional-dependencies.gui = [
pyqt5
pyqtwebengine
];
+2 -2
pkgs/development/python-modules/volvooncall/default.nix
···
aiohttp
];
-
passthru.extras-require = {
+
passthru.optional-dependencies = {
console = [
certifi
docopt
···
asynctest
pytest-asyncio
pytestCheckHook
-
] ++ passthru.extras-require.mqtt;
+
] ++ passthru.optional-dependencies.mqtt;
pythonImportsCheck = [ "volvooncall" ];
+1 -1
pkgs/development/tools/devpi-server/default.nix
···
pyramid
strictyaml
waitress
-
] ++ passlib.extras-require.argon2;
+
] ++ passlib.optional-dependencies.argon2;
checkInputs = [
beautifulsoup4
+9 -9
pkgs/servers/home-assistant/component-packages.nix
···
androidtv
pure-python-adb
]
-
++ adb-shell.extras-require.async
-
++ androidtv.extras-require.async
-
++ pure-python-adb.extras-require.async;
+
++ adb-shell.optional-dependencies.async
+
++ androidtv.optional-dependencies.async
+
++ pure-python-adb.optional-dependencies.async;
"anel_pwrctrl" = ps: with ps; [
]; # missing inputs: anel_pwrctrl-homeassistant
"anthemav" = ps: with ps; [
···
"bluetooth_le_tracker" = ps: with ps; [
pygatt
]
-
++ pygatt.extras-require.GATTTOOL;
+
++ pygatt.optional-dependencies.GATTTOOL;
"bluetooth_tracker" = ps: with ps; [
bt-proximity
pybluez
···
wakeonlan
zeroconf
-
++ samsungctl.extras-require.websocket
-
++ samsungtvws.extras-require.async
-
++ samsungtvws.extras-require.encrypted;
+
++ samsungctl.optional-dependencies.websocket
+
++ samsungtvws.optional-dependencies.async
+
++ samsungtvws.optional-dependencies.encrypted;
"satel_integra" = ps: with ps; [
]; # missing inputs: satel_integra
"scene" = ps: with ps; [
···
"skybeacon" = ps: with ps; [
pygatt
-
++ pygatt.extras-require.GATTTOOL;
+
++ pygatt.optional-dependencies.GATTTOOL;
"skybell" = ps: with ps; [
skybellpy
];
···
"tradfri" = ps: with ps; [
pytradfri
-
++ pytradfri.extras-require.async;
+
++ pytradfri.optional-dependencies.async;
"trafikverket_ferry" = ps: with ps; [
pytrafikverket
];
+3 -3
pkgs/servers/home-assistant/parse-requirements.py
···
return os.path.abspath(sys.argv[0] + "/../../../..")
-
# For a package attribute and and an extra, check if the package exposes it via passthru.extras-require
+
# For a package attribute and and an extra, check if the package exposes it via passthru.optional-dependencies
def has_extra(package: str, extra: str):
cmd = [
"nix-instantiate",
repository_root(),
"-A",
-
f"{package}.extras-require.{extra}",
+
f"{package}.optional-dependencies.{extra}",
]
try:
subprocess.run(
···
attr_paths.append(pname)
for extra in extras:
# Check if package advertises extra requirements
-
extra_attr = f"{pname}.extras-require.{extra}"
+
extra_attr = f"{pname}.optional-dependencies.{extra}"
if has_extra(attr_path, extra):
extra_attrs.append(extra_attr)
else:
+1 -1
pkgs/servers/radicale/3.x.nix
···
vobject
python-dateutil
pytz # https://github.com/Kozea/Radicale/issues/816
-
] ++ passlib.extras-require.bcrypt;
+
] ++ passlib.optional-dependencies.bcrypt;
checkInputs = with python3.pkgs; [
pytestCheckHook
+2 -2
pkgs/tools/networking/p2p/tahoe-lafs/default.nix
···
html5lib magic-wormhole netifaces pyasn1 pycrypto pyutil pyyaml recommonmark
service-identity simplejson sphinx_rtd_theme testtools treq twisted zfec
zope_interface
-
] ++ twisted.extras-require.tls
-
++ twisted.extras-require.conch;
+
] ++ twisted.optional-dependencies.tls
+
++ twisted.optional-dependencies.conch;
checkInputs = with python3Packages; [ mock hypothesis twisted ];
+2 -2
pkgs/tools/security/wapiti/default.nix
···
yaswfp
] ++ lib.optionals (python3.pythonOlder "3.8") [
importlib-metadata
-
] ++ httpx.extras-require.brotli
-
++ httpx.extras-require.socks;
+
] ++ httpx.optional-dependencies.brotli
+
++ httpx.optional-dependencies.socks;
checkInputs = with python3.pkgs; [
respx