From cff500b2e99829c74ebb6406fd4cf0591ea72b6a Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 12 Jul 2026 21:13:42 +0200 Subject: [PATCH] python3Packages.cattrs: 25.3.0 -> 26.1.0 https://github.com/python-attrs/cattrs/blob/v26.1.0/HISTORY.md --- .../python-modules/cattrs/default.nix | 86 ++++++++++--------- 1 file changed, 47 insertions(+), 39 deletions(-) diff --git a/pkgs/development/python-modules/cattrs/default.nix b/pkgs/development/python-modules/cattrs/default.nix index 078a9fc50324..ae180c7cf45d 100644 --- a/pkgs/development/python-modules/cattrs/default.nix +++ b/pkgs/development/python-modules/cattrs/default.nix @@ -12,27 +12,34 @@ msgpack, msgspec, orjson, + pymongo, pytest-xdist, pytestCheckHook, - pythonAtLeast, pyyaml, + tomli-w, tomlkit, typing-extensions, ujson, + writableTmpDirAsHomeHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "cattrs"; - version = "25.3.0"; + version = "26.1.0"; pyproject = true; src = fetchFromGitHub { owner = "python-attrs"; repo = "cattrs"; - tag = "v${version}"; - hash = "sha256-6oQblSanvSZOMD5ossCP7fNjyxF54SRbU1cQrW1I5Ps="; + tag = "v${finalAttrs.version}"; + hash = "sha256-i1C7TvtQhiEZPi4YELxPHkiz33nNw2rtgRTqs98PVlc="; }; + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" + ''; + build-system = [ hatchling hatch-vcs @@ -43,57 +50,58 @@ buildPythonPackage rec { typing-extensions ]; + optional-dependencies = { + ujson = [ + ujson + ]; + orjson = [ + orjson + ]; + msgpack = [ + msgpack + ]; + pyyaml = [ + pyyaml + ]; + tomlkit = [ + tomlkit + ]; + cbor2 = [ + cbor2 + ]; + bson = [ + pymongo + ]; + msgspec = [ + msgspec + ]; + tomllib = [ + tomli-w + ]; + }; + nativeCheckInputs = [ - cbor2 hypothesis immutables motor - msgpack - msgspec - orjson pytest-xdist pytestCheckHook - pyyaml - tomlkit - ujson - ]; - - postPatch = '' - substituteInPlace pyproject.toml \ - --replace-fail "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" - substituteInPlace tests/test_preconf.py \ - --replace-fail "from orjson import dumps as orjson_dumps" "" \ - --replace-fail "from orjson import loads as orjson_loads" "" - ''; - - preCheck = '' - export HOME=$(mktemp -d); - ''; + writableTmpDirAsHomeHook + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; disabledTestPaths = [ # Don't run benchmarking tests "bench" ]; - disabledTests = [ - # orjson is not available as it requires Rust nightly features to compile its requirements - "test_orjson" - # msgspec causes a segmentation fault for some reason - "test_simple_classes" - "test_msgspec_json_converter" - ] - ++ lib.optionals (pythonAtLeast "3.13") [ - # https://github.com/python-attrs/cattrs/pull/543 - "test_unstructure_deeply_nested_generics_list" - ]; - pythonImportsCheck = [ "cattr" ]; meta = { + changelog = "https://github.com/python-attrs/cattrs/blob/${finalAttrs.src.tag}/HISTORY.md"; description = "Python custom class converters for attrs"; homepage = "https://github.com/python-attrs/cattrs"; - changelog = "https://github.com/python-attrs/cattrs/blob/${src.tag}/HISTORY.md"; license = with lib.licenses; [ mit ]; maintainers = with lib.maintainers; [ fab ]; }; -} +})