2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, attrs
|
2021-07-14 22:03:04 +00:00
|
|
|
, bson
|
|
|
|
, pythonOlder
|
2021-02-05 17:12:51 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, hypothesis
|
2021-07-14 22:03:04 +00:00
|
|
|
, immutables
|
|
|
|
, msgpack
|
|
|
|
, poetry-core
|
2021-02-05 17:12:51 +00:00
|
|
|
, pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
, pyyaml
|
|
|
|
, tomlkit
|
|
|
|
, ujson
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cattrs";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "1.7.0";
|
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
# https://cattrs.readthedocs.io/en/latest/history.html#id33:
|
|
|
|
# "Python 2, 3.5 and 3.6 support removal. If you need it, use a version below 1.1.0."
|
|
|
|
disabled = pythonOlder "3.7";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Tinche";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-07-14 22:03:04 +00:00
|
|
|
sha256 = "sha256-7F4S4IeApbULXhkEZ0oab3Y7sk20Ag2fCYxsyi4WbWw=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
|
|
|
];
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
bson
|
2021-02-05 17:12:51 +00:00
|
|
|
hypothesis
|
2021-07-14 22:03:04 +00:00
|
|
|
immutables
|
|
|
|
msgpack
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
pyyaml
|
|
|
|
tomlkit
|
|
|
|
ujson
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "-l --benchmark-sort=fullname --benchmark-warmup=true --benchmark-warmup-iterations=5 --benchmark-group-by=fullname" ""
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'orjson = "^3.5.2"' ""
|
|
|
|
substituteInPlace tests/test_preconf.py \
|
|
|
|
--replace "from orjson import dumps as orjson_dumps" "" \
|
|
|
|
--replace "from orjson import loads as orjson_loads" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
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"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "cattr" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python custom class converters for attrs";
|
|
|
|
homepage = "https://github.com/Tinche/cattrs";
|
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|