2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
attrs,
|
|
|
|
buildPythonPackage,
|
|
|
|
cbor2,
|
|
|
|
fetchFromGitHub,
|
|
|
|
exceptiongroup,
|
|
|
|
hatchling,
|
|
|
|
hatch-vcs,
|
|
|
|
hypothesis,
|
|
|
|
immutables,
|
|
|
|
motor,
|
|
|
|
msgpack,
|
|
|
|
orjson,
|
|
|
|
pytest-xdist,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
pyyaml,
|
|
|
|
tomlkit,
|
|
|
|
typing-extensions,
|
|
|
|
ujson,
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cattrs";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "23.2.3";
|
2021-07-14 22:03:04 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-02-10 20:34:41 +00:00
|
|
|
owner = "python-attrs";
|
2021-02-05 17:12:51 +00:00
|
|
|
repo = pname;
|
2024-01-13 08:15:51 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-zWM5zmZr2EiJb/4Dc6KjDL89p0C1V0Dsz949byz5OVM=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
hatchling
|
|
|
|
hatch-vcs
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs =
|
|
|
|
[ attrs ]
|
|
|
|
++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
exceptiongroup
|
|
|
|
typing-extensions
|
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-08-10 07:59:29 +00:00
|
|
|
cbor2
|
2021-02-05 17:12:51 +00:00
|
|
|
hypothesis
|
2021-07-14 22:03:04 +00:00
|
|
|
immutables
|
2021-08-22 07:53:02 +00:00
|
|
|
motor
|
2021-07-14 22:03:04 +00:00
|
|
|
msgpack
|
2022-08-12 12:06:08 +00:00
|
|
|
orjson
|
2022-04-15 01:41:22 +00:00
|
|
|
pytest-xdist
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
pyyaml
|
|
|
|
tomlkit
|
2023-08-10 07:59:29 +00:00
|
|
|
typing-extensions
|
2021-07-14 22:03:04 +00:00
|
|
|
ujson
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2024-01-13 08:15:51 +00:00
|
|
|
--replace "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" ""
|
2021-07-14 22:03:04 +00:00
|
|
|
substituteInPlace tests/test_preconf.py \
|
|
|
|
--replace "from orjson import dumps as orjson_dumps" "" \
|
|
|
|
--replace "from orjson import loads as orjson_loads" ""
|
|
|
|
'';
|
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d);
|
|
|
|
'';
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# Don't run benchmarking tests
|
|
|
|
"bench/test_attrs_collections.py"
|
|
|
|
"bench/test_attrs_nested.py"
|
|
|
|
"bench/test_attrs_primitives.py"
|
|
|
|
"bench/test_primitives.py"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# orjson is not available as it requires Rust nightly features to compile its requirements
|
|
|
|
"test_orjson"
|
2022-04-15 01:41:22 +00:00
|
|
|
# tomlkit is pinned to an older version and newer versions raise InvalidControlChar exception
|
|
|
|
"test_tomlkit"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "cattr" ];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python custom class converters for attrs";
|
2022-02-10 20:34:41 +00:00
|
|
|
homepage = "https://github.com/python-attrs/cattrs";
|
2023-08-10 07:59:29 +00:00
|
|
|
changelog = "https://github.com/python-attrs/cattrs/blob/${src.rev}/HISTORY.md";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|