diff --git a/pkgs/development/python-modules/asyncua/default.nix b/pkgs/development/python-modules/asyncua/default.nix index 774569543628..e2417b6a2463 100644 --- a/pkgs/development/python-modules/asyncua/default.nix +++ b/pkgs/development/python-modules/asyncua/default.nix @@ -6,7 +6,7 @@ , cryptography , fetchFromGitHub , pyopenssl -, pytest-asyncio +, pytest-asyncio_0_21 , pytest-mock , pytestCheckHook , python-dateutil @@ -60,7 +60,7 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook - pytest-asyncio + pytest-asyncio_0_21 pytest-mock ]; diff --git a/pkgs/development/python-modules/autobahn/default.nix b/pkgs/development/python-modules/autobahn/default.nix index 429082e442b8..2bfbc16e8f91 100644 --- a/pkgs/development/python-modules/autobahn/default.nix +++ b/pkgs/development/python-modules/autobahn/default.nix @@ -27,7 +27,7 @@ , pygobject3 , pyopenssl , qrcode -, pytest-asyncio +, pytest-asyncio_0_21 , python-snappy , pytestCheckHook , pythonOlder @@ -72,7 +72,7 @@ buildPythonPackage rec { nativeCheckInputs = [ mock - pytest-asyncio + pytest-asyncio_0_21 pytestCheckHook ] ++ passthru.optional-dependencies.scram ++ passthru.optional-dependencies.serialization diff --git a/pkgs/development/python-modules/beartype/default.nix b/pkgs/development/python-modules/beartype/default.nix index 3eba6f3317a4..b5091bf519d0 100644 --- a/pkgs/development/python-modules/beartype/default.nix +++ b/pkgs/development/python-modules/beartype/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, setuptools , pytestCheckHook , pythonOlder , typing-extensions @@ -8,16 +9,20 @@ buildPythonPackage rec { pname = "beartype"; - version = "0.16.4"; + version = "0.17.2"; format = "setuptools"; disabled = pythonOlder "3.7"; src = fetchPypi { inherit pname version; - hash = "sha256-GtqJzy1usw624Vbu0utUkzV3gpN5ENdDgJGOU8Lq4L8="; + hash = "sha256-6RHhrn3kvM0VdF92Q2CdhzL2TeXC+4ROicu+0cWo1JU="; }; + nativeBuildInputs = [ + setuptools + ]; + nativeCheckInputs = [ pytestCheckHook typing-extensions diff --git a/pkgs/development/python-modules/black/default.nix b/pkgs/development/python-modules/black/default.nix index 52cc36e989cc..73ce7f8d30fd 100644 --- a/pkgs/development/python-modules/black/default.nix +++ b/pkgs/development/python-modules/black/default.nix @@ -5,7 +5,6 @@ , pythonOlder , pytestCheckHook , aiohttp -, aiohttp-cors , click , colorama , hatch-fancy-pypi-readme @@ -19,7 +18,6 @@ , platformdirs , tokenize-rt , tomli -, typed-ast , typing-extensions , uvloop }: @@ -78,6 +76,10 @@ buildPythonPackage rec { parameterized ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + pytestFlagsArray = [ + "-W" "ignore::DeprecationWarning" + ]; + preCheck = '' export PATH="$PATH:$out/bin" diff --git a/pkgs/development/python-modules/eth-typing/default.nix b/pkgs/development/python-modules/eth-typing/default.nix index 434fc6d8c10d..60bafffaea2a 100644 --- a/pkgs/development/python-modules/eth-typing/default.nix +++ b/pkgs/development/python-modules/eth-typing/default.nix @@ -3,12 +3,13 @@ , buildPythonPackage , pythonOlder , pytestCheckHook +, setuptools }: buildPythonPackage rec { pname = "eth-typing"; - version = "3.2.0"; - format = "setuptools"; + version = "4.0.0"; + pyproject = true; disabled = pythonOlder "3.6"; @@ -16,9 +17,13 @@ buildPythonPackage rec { owner = "ethereum"; repo = "eth-typing"; rev = "refs/tags/v${version}"; - hash = "sha256-klN38pIQ9ZOFV7dzXNvylPGfifR8pXRLTJ3VE579AY0="; + hash = "sha256-JT/2bCPYFSRNt3V7QnHSAJR7HrZ1JpRKdU7gQpoYIn0="; }; + nativeBuildInputs = [ + setuptools + ]; + nativeCheckInputs = [ pytestCheckHook ]; diff --git a/pkgs/development/python-modules/eth-utils/default.nix b/pkgs/development/python-modules/eth-utils/default.nix index 6d4cbf930f56..8686da98d92a 100644 --- a/pkgs/development/python-modules/eth-utils/default.nix +++ b/pkgs/development/python-modules/eth-utils/default.nix @@ -8,22 +8,27 @@ , isPyPy , pytestCheckHook , pythonOlder +, setuptools , toolz }: buildPythonPackage rec { pname = "eth-utils"; - version = "2.1.1"; - format = "setuptools"; + version = "4.0.0"; + pyproject = true; disabled = pythonOlder "3.6"; src = fetchFromGitHub { owner = "ethereum"; - repo = pname; + repo = "eth-utils"; rev = "v${version}"; - hash = "sha256-Ogp4o99smw5qVwDec6zd/xVqqKMyNk41iBfRNzrwuvE="; + hash = "sha256-k2pHM1eKPzoGxZlU6yT7bZMv4CCWGaZaSnFHSbT76Zo="; }; + nativeBuildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ eth-hash eth-typing @@ -44,6 +49,7 @@ buildPythonPackage rec { pythonImportsCheck = [ "eth_utils" ]; meta = { + changelog = "https://github.com/ethereum/eth-utils/blob/${src.rev}/docs/release_notes.rst"; description = "Common utility functions for codebases which interact with ethereum"; homepage = "https://github.com/ethereum/eth-utils"; license = lib.licenses.mit; diff --git a/pkgs/development/python-modules/mypy/default.nix b/pkgs/development/python-modules/mypy/default.nix index 0087fa650d7a..ba8b5a276197 100644 --- a/pkgs/development/python-modules/mypy/default.nix +++ b/pkgs/development/python-modules/mypy/default.nix @@ -2,6 +2,7 @@ , stdenv , buildPythonPackage , fetchFromGitHub +, pythonAtLeast , pythonOlder # build-system @@ -100,6 +101,11 @@ buildPythonPackage rec { tomli ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + disabledTests = lib.optionals (pythonAtLeast "3.12") [ + # requires distutils + "test_c_unit_test" + ]; + disabledTestPaths = [ # fails to find tyoing_extensions "mypy/test/testcmdline.py" diff --git a/pkgs/development/python-modules/openai/default.nix b/pkgs/development/python-modules/openai/default.nix index dab58b533265..78ace71a3575 100644 --- a/pkgs/development/python-modules/openai/default.nix +++ b/pkgs/development/python-modules/openai/default.nix @@ -74,6 +74,10 @@ buildPythonPackage rec { dirty-equals ]; + pytestFlagsArray = [ + "-W" "ignore::DeprecationWarning" + ]; + disabledTests = [ # Tests make network requests "test_streaming_response" diff --git a/pkgs/development/python-modules/param/default.nix b/pkgs/development/python-modules/param/default.nix index f6bbbf3b78ff..638a3182ca1b 100644 --- a/pkgs/development/python-modules/param/default.nix +++ b/pkgs/development/python-modules/param/default.nix @@ -40,6 +40,10 @@ buildPythonPackage rec { pytestCheckHook ]; + pytestFlagsArray = [ + "-W" "ignore::DeprecationWarning" + ]; + pythonImportsCheck = [ "param" ]; diff --git a/pkgs/development/python-modules/partd/default.nix b/pkgs/development/python-modules/partd/default.nix index 728ed09b735c..b5f8afce9d3b 100644 --- a/pkgs/development/python-modules/partd/default.nix +++ b/pkgs/development/python-modules/partd/default.nix @@ -1,14 +1,24 @@ { lib , buildPythonPackage -, fetchPypi -, isPy27 +, fetchFromGitHub +, fetchpatch2 +, pythonOlder + +# build-system , setuptools -, pytest + +# dependencies , locket +, toolz + +# optional-dependencies +, blosc2 , numpy , pandas , pyzmq -, toolz + +# tests +, pytestCheckHook }: buildPythonPackage rec { @@ -16,25 +26,44 @@ buildPythonPackage rec { version = "1.4.1"; pyproject = true; - disabled = isPy27; + disabled = pythonOlder "3.7"; - src = fetchPypi { - inherit pname version; - hash = "sha256-VsJd1J5v6lcn5zEgPEZsbgkvMI2PACThmdAvaqIWf2c="; + src = fetchFromGitHub { + owner = "dask"; + repo = "partd"; + rev = "refs/tags/${version}"; + hash = "sha256-EK+HNSPh2b7jwpc6jwH/n+6HDgHhRfBeaRuiDIWVG28="; }; + patches = [ + (fetchpatch2 { + # python 3.12 support; https://github.com/dask/partd/pull/70 + url = "https://github.com/dask/partd/pull/70/commits/c96a034367cb9fee0a0900f758b802aeef8a8a41.patch"; + hash = "sha256-QlSIrFQQQo9We/gf7WSgmWrxdt3rxXQcyvJnFm8R5cM="; + }) + ]; + nativeBuildInputs = [ setuptools ]; - nativeCheckInputs = [ pytest ]; + propagatedBuildInputs = [ + locket + toolz + ]; - propagatedBuildInputs = [ locket numpy pandas pyzmq toolz ]; + passthru.optional-dependencies = { + complete = [ + blosc2 + numpy + pandas + pyzmq + ]; + }; - checkPhase = '' - rm partd/tests/test_zmq.py # requires network & fails - py.test -k "not test_serialize" - ''; + nativeCheckInputs = [ + pytestCheckHook + ]; meta = { description = "Appendable key-value storage"; diff --git a/pkgs/development/python-modules/py-ecc/default.nix b/pkgs/development/python-modules/py-ecc/default.nix index 7845bfe17501..d7769ea4873d 100644 --- a/pkgs/development/python-modules/py-ecc/default.nix +++ b/pkgs/development/python-modules/py-ecc/default.nix @@ -4,38 +4,55 @@ , cached-property , eth-typing , eth-utils -, mypy-extensions , pytestCheckHook +, pythonAtLeast , pythonOlder +, setuptools }: buildPythonPackage rec { pname = "py-ecc"; - version = "6.0.0"; - format = "setuptools"; - disabled = pythonOlder "3.6"; + version = "7.0.0"; + pyproject = true; + disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "ethereum"; repo = "py_ecc"; rev = "v${version}"; - hash = "sha256-638otYA3e/Ld4mcM69yrqHQnGoK/Sfl/UA9FWnjgO/U="; + hash = "sha256-DKe+bI1GEzXg4Y4n5OA1/hWYz9L3X1AvaOFPEnCaAfs="; }; + nativeBuildInputs = [ + setuptools + ]; + propagatedBuildInputs = [ cached-property eth-typing eth-utils - mypy-extensions ]; nativeCheckInputs = [ pytestCheckHook ]; + disabledTests = lib.optionals (pythonAtLeast "3.12") [ + # https://github.com/ethereum/py_ecc/issues/133 + "test_FQ2_object" + "test_pairing_bilinearity_on_G1" + "test_pairing_bilinearity_on_G2" + "test_pairing_composit_check" + "test_pairing_is_non_degenerate" + "test_pairing_negative_G1" + "test_pairing_negative_G2" + "test_pairing_output_order" + ]; + pythonImportsCheck = [ "py_ecc" ]; meta = with lib; { + changelog = "https://github.com/ethereum/py_ecc/blob/${src.rev}/CHANGELOG.rst"; description = "ECC pairing and bn_128 and bls12_381 curve operations"; homepage = "https://github.com/ethereum/py_ecc"; license = licenses.mit; diff --git a/pkgs/development/python-modules/pytest-benchmark/default.nix b/pkgs/development/python-modules/pytest-benchmark/default.nix index f9011b6d721b..dc2c27137169 100644 --- a/pkgs/development/python-modules/pytest-benchmark/default.nix +++ b/pkgs/development/python-modules/pytest-benchmark/default.nix @@ -14,16 +14,16 @@ , pytestCheckHook , pytest-xdist , pythonOlder -, isPy311 +, setuptools }: buildPythonPackage rec { pname = "pytest-benchmark"; version = "4.0.0"; + pyproject = true; disabled = pythonOlder "3.7"; - format = "setuptools"; src = fetchFromGitHub { owner = "ionelmc"; @@ -33,10 +33,24 @@ buildPythonPackage rec { }; patches = [ + # replace distutils.spawn.find_executable with shutil.which (fetchpatch { url = "https://github.com/ionelmc/pytest-benchmark/commit/728752d2976ef53fde7e40beb3e55f09cf4d4736.patch"; hash = "sha256-WIQADCLey5Y79UJUj9J5E02HQ0O86xBh/3IeGLpVrWI="; }) + # fix tests with python3.11+; https://github.com/ionelmc/pytest-benchmark/pull/232 + (fetchpatch { + url = "https://github.com/ionelmc/pytest-benchmark/commit/b2f624afd68a3090f20187a46284904dd4baa4f6.patch"; + hash = "sha256-cylxPj/d0YzvOGw+ncVSCnQHwq2cukrgXhBHePPwjO0="; + }) + (fetchpatch { + url = "https://github.com/ionelmc/pytest-benchmark/commit/2b987f5be1873617f02f24cb6d76196f9aed21bd.patch"; + hash = "sha256-92kWEd935Co6uc/1y5OGKsc5/or81bORSdaiQFjDyTw="; + }) + ]; + + nativeBuildInputs = [ + setuptools ]; buildInputs = [ @@ -64,24 +78,23 @@ buildPythonPackage rec { mercurial pytestCheckHook pytest-xdist - ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); + ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); + + pytestFlagsArray = [ + "-W" "ignore::DeprecationWarning" + ]; preCheck = '' export PATH="$out/bin:$PATH" ''; - disabledTests = [ + disabledTests = lib.optionals (pythonOlder "3.12") [ # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec' "test_compare_1" "test_compare_2" "test_regression_checks" + "test_regression_checks_inf" "test_rendering" - ] - # tests are broken in 3.11 - # https://github.com/ionelmc/pytest-benchmark/issues/231 - ++ lib.optionals isPy311 [ - "test_abort_broken" - "test_clonefunc" ]; meta = with lib; { diff --git a/pkgs/development/python-modules/sanic/default.nix b/pkgs/development/python-modules/sanic/default.nix index 752802df209c..fb1d5aba58db 100644 --- a/pkgs/development/python-modules/sanic/default.nix +++ b/pkgs/development/python-modules/sanic/default.nix @@ -3,6 +3,7 @@ , buildPythonPackage , fetchFromGitHub , fetchpatch +, pythonAtLeast # build-system , setuptools @@ -145,6 +146,9 @@ buildPythonPackage rec { "test_websocket_route_with_subprotocols" # Socket closes early "test_no_exceptions_when_cancel_pending_request" + ] ++ lib.optionals (pythonAtLeast "3.12") [ + # AttributeError: 'has_calls' is not a valid assertion. Use a spec for the mock if 'has_calls' is meant to be an attribute. + "test_ws_frame_put_message_into_queue" ]; disabledTestPaths = [ diff --git a/pkgs/development/python-modules/sip/4.x.nix b/pkgs/development/python-modules/sip/4.x.nix index 0e1db82e8af0..879dc6cd125a 100644 --- a/pkgs/development/python-modules/sip/4.x.nix +++ b/pkgs/development/python-modules/sip/4.x.nix @@ -5,7 +5,8 @@ buildPythonPackage rec { version = "4.19.25"; format = "other"; - disabled = isPyPy; + # relies on distutils + disabled = isPyPy || pythonAtLeast "3.12"; src = fetchurl { url = "https://www.riverbankcomputing.com/static/Downloads/sip/${version}/sip-${version}.tar.gz"; diff --git a/pkgs/development/python-modules/sip/default.nix b/pkgs/development/python-modules/sip/default.nix index 32c28211cd06..30dd904f1396 100644 --- a/pkgs/development/python-modules/sip/default.nix +++ b/pkgs/development/python-modules/sip/default.nix @@ -1,10 +1,8 @@ { lib -, stdenv , buildPythonPackage , fetchPypi , pythonOlder , setuptools -, wheel , packaging , ply , toml @@ -18,21 +16,22 @@ buildPythonPackage rec { pname = "sip"; - version = "6.8.1"; - - format = "pyproject"; + version = "6.8.3"; + pyproject = true; src = fetchPypi { inherit pname version; - hash = "sha256-MALfQV4WisP/45OULbxxMcuCreUAAOFSb0aoit4m9Zg="; + hash = "sha256-iIVHsBi7JMNq3tUZ6T0+UT1MaqC6VbfMGv+9Rc8Qdiw="; }; nativeBuildInputs = [ setuptools - wheel ]; - propagatedBuildInputs = [ packaging ply toml ] ++ lib.optionals (pythonOlder "3.11") [ + propagatedBuildInputs = [ + packaging + setuptools + ] ++ lib.optionals (pythonOlder "3.11") [ tomli ]; diff --git a/pkgs/development/python-modules/smartypants/default.nix b/pkgs/development/python-modules/smartypants/default.nix index 0e5ef76927e4..d2ca5f297322 100644 --- a/pkgs/development/python-modules/smartypants/default.nix +++ b/pkgs/development/python-modules/smartypants/default.nix @@ -1,7 +1,9 @@ { lib , buildPythonPackage , fetchFromGitHub +, fetchpatch2 , isPyPy +, setuptools , docutils , pygments , pytestCheckHook @@ -9,8 +11,9 @@ buildPythonPackage rec { version = "2.0.1"; - format = "setuptools"; pname = "smartypants"; + pyproject = true; + disabled = isPyPy; src = fetchFromGitHub { @@ -20,6 +23,19 @@ buildPythonPackage rec { sha256 = "00p1gnb9pzb3svdq3c5b9b332gsp50wrqqa39gj00m133zadanjp"; }; + patches = [ + (fetchpatch2 { + # https://github.com/leohemsted/smartypants.py/pull/21 + name = "smartypants-3.12-compat.patch"; + url = "https://github.com/leohemsted/smartypants.py/commit/ea46bf36343044a7a61ba3acce4a7f188d986ec5.patch"; + hash = "sha256-9lsiiZKFFKHLy7j3y9ff4gt01szY+2AHpWPAKQgKwZg="; + }) + ]; + + nativeBuildInputs = [ + setuptools + ]; + nativeCheckInputs = [ docutils pygments diff --git a/pkgs/development/python-modules/spake2/default.nix b/pkgs/development/python-modules/spake2/default.nix index 87d05612e712..2ccd62fcdf15 100644 --- a/pkgs/development/python-modules/spake2/default.nix +++ b/pkgs/development/python-modules/spake2/default.nix @@ -1,26 +1,50 @@ -{ lib, buildPythonPackage, fetchPypi, hkdf, pytest }: +{ lib +, buildPythonPackage +, fetchPypi +, fetchpatch2 +, setuptools +, hkdf +, pytestCheckHook +}: buildPythonPackage rec { pname = "spake2"; version = "0.8"; - format = "setuptools"; + pyproject = true; src = fetchPypi { inherit pname version; sha256 = "c17a614b29ee4126206e22181f70a406c618d3c6c62ca6d6779bce95e9c926f4"; }; - nativeCheckInputs = [ pytest ]; + patches = [ + # https://github.com/warner/python-spake2/pull/16 + (fetchpatch2 { + name = "python312-compat.patch"; + url = "https://github.com/warner/python-spake2/commit/1b04d33106b105207c97c64b2589c45790720b0b.patch"; + hash = "sha256-OoBz0lN17VyVGg6UfT+Zj9M1faFTNpPIhxrwCgUwMc8="; + }) + ]; - propagatedBuildInputs = [ hkdf ]; + nativeBuildInputs = [ + setuptools + ]; - checkPhase = '' - py.test $out - ''; + propagatedBuildInputs = [ + hkdf + ]; + + pythonImportsCheck = [ "spake2" ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; meta = with lib; { + changelog = "https://github.com/warner/python-spake2/blob/v${version}/NEWS"; description = "SPAKE2 password-authenticated key exchange library"; homepage = "https://github.com/warner/python-spake2"; license = licenses.mit; + maintainers = with maintainers; [ dotlambda ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ae9c32c5fa8f..34a88f68f95f 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11614,6 +11614,16 @@ self: super: with self; { pytest-asyncio = callPackage ../development/python-modules/pytest-asyncio { }; + pytest-asyncio_0_21 = pytest-asyncio.overridePythonAttrs (old: rec { + version = "0.21.1"; + src = pkgs.fetchFromGitHub { + owner = "pytest-dev"; + repo = "pytest-asyncio"; + rev = "refs/tags/v${version}"; + hash = "sha256-Wpo8MpCPGiXrckT2x5/yBYtGlzso/L2urG7yGc7SPkA="; + }; + }); + pytest-bdd = callPackage ../development/python-modules/pytest-bdd { }; pytest-benchmark = callPackage ../development/python-modules/pytest-benchmark { };