nixpkgs/pkgs/development/python-modules/cattrs/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

91 lines
1.9 KiB
Nix
Raw Normal View History

2021-01-22 08:33:10 +00:00
{ lib
, attrs
, buildPythonPackage
, fetchFromGitHub
, hypothesis
2021-07-03 23:02:07 +01:00
, immutables
2021-08-20 22:35:08 +01:00
, motor
2021-07-03 23:02:07 +01:00
, msgpack
, poetry-core
2021-01-22 08:33:10 +00:00
, pytestCheckHook
2021-08-20 22:35:08 +01:00
, pythonOlder
2021-07-03 23:02:07 +01:00
, pyyaml
, tomlkit
, typing-extensions
2021-07-03 23:02:07 +01:00
, ujson
2021-01-22 08:33:10 +00:00
}:
buildPythonPackage rec {
pname = "cattrs";
version = "1.10.0";
2021-07-03 23:02:07 +01:00
format = "pyproject";
2021-01-22 08:33:10 +00:00
disabled = pythonOlder "3.7";
2021-01-22 08:33:10 +00:00
src = fetchFromGitHub {
owner = "python-attrs";
2021-01-22 08:33:10 +00:00
repo = pname;
rev = "v${version}";
hash = "sha256-VbfQMMDO03eeUHAACxoX6a3DKmzoF9EfLuTpvaY6bWs=";
2021-01-22 08:33:10 +00:00
};
2021-07-03 23:02:07 +01:00
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [
attrs
] ++ lib.optionals (pythonOlder "3.7") [
typing-extensions
2021-07-03 23:02:07 +01:00
];
2021-01-22 08:33:10 +00:00
checkInputs = [
hypothesis
2021-07-03 23:02:07 +01:00
immutables
2021-08-20 22:35:08 +01:00
motor
2021-07-03 23:02:07 +01:00
msgpack
2021-01-22 08:33:10 +00:00
pytestCheckHook
2021-07-03 23:02:07 +01:00
pyyaml
tomlkit
ujson
];
postPatch = ''
substituteInPlace pyproject.toml \
--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-03 23:02:07 +01:00
substituteInPlace tests/test_preconf.py \
--replace "from orjson import dumps as orjson_dumps" "" \
--replace "from orjson import loads as orjson_loads" ""
'';
2021-08-20 22:35:08 +01:00
preCheck = ''
export HOME=$(mktemp -d);
'';
2021-07-03 23:02:07 +01: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"
2021-01-22 08:33:10 +00:00
];
pythonImportsCheck = [
"cattr"
];
2021-01-22 08:33:10 +00:00
meta = with lib; {
description = "Python custom class converters for attrs";
homepage = "https://github.com/python-attrs/cattrs";
2021-01-22 08:33:10 +00:00
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}