2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, attrs
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2022-08-12 12:06:08 +00:00
|
|
|
, exceptiongroup
|
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
|
2021-07-14 22:03:04 +00:00
|
|
|
, poetry-core
|
2022-04-15 01:41:22 +00:00
|
|
|
, pytest-xdist
|
2021-02-05 17:12:51 +00:00
|
|
|
, pytestCheckHook
|
2021-08-22 07:53:02 +00:00
|
|
|
, pythonOlder
|
2021-07-14 22:03:04 +00:00
|
|
|
, pyyaml
|
|
|
|
, tomlkit
|
2022-02-10 20:34:41 +00:00
|
|
|
, typing-extensions
|
2021-07-14 22:03:04 +00:00
|
|
|
, ujson
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cattrs";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "22.2.0";
|
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;
|
|
|
|
rev = "v${version}";
|
2022-11-21 17:40:18 +00:00
|
|
|
hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
2022-08-12 12:06:08 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
exceptiongroup
|
2022-02-10 20:34:41 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
typing-extensions
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
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
|
|
|
|
ujson
|
|
|
|
];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
2022-02-10 20:34:41 +00:00
|
|
|
--replace "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" "" \
|
|
|
|
--replace 'orjson = "^3.5.2"' "" \
|
|
|
|
--replace "[tool.poetry.group.dev.dependencies]" "[tool.poetry.dev-dependencies]"
|
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
|
|
|
];
|
|
|
|
|
2022-02-10 20:34:41 +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";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|