2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, pythonOlder
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
, hatchling
|
|
|
|
, hatch-fancy-pypi-readme
|
|
|
|
|
|
|
|
# native dependencies
|
2023-03-15 16:39:30 +00:00
|
|
|
, libxcrypt
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# dependencies
|
|
|
|
, annotated-types
|
|
|
|
, pydantic-core
|
|
|
|
, typing-extensions
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, cloudpickle
|
|
|
|
, email-validator
|
|
|
|
, dirty-equals
|
|
|
|
, faker
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-mock
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pydantic";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "2.5.2";
|
|
|
|
pyproject = true;
|
2022-07-18 16:21:45 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "pydantic";
|
2024-01-13 08:15:51 +00:00
|
|
|
repo = "pydantic";
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-D0gYcyrKVVDhBgV9sCVTkGq/kFmIoT9l0i5bRM1qxzM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
buildInputs = lib.optionals (pythonOlder "3.9") [
|
|
|
|
libxcrypt
|
|
|
|
];
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
nativeBuildInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
hatch-fancy-pypi-readme
|
|
|
|
hatchling
|
2022-02-20 05:27:41 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
annotated-types
|
|
|
|
pydantic-core
|
2020-04-24 23:36:52 +00:00
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
email = [
|
|
|
|
email-validator
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2024-01-13 08:15:51 +00:00
|
|
|
cloudpickle
|
|
|
|
dirty-equals
|
|
|
|
faker
|
2020-12-29 15:07:52 +00:00
|
|
|
pytest-mock
|
2021-03-09 03:18:52 +00:00
|
|
|
pytestCheckHook
|
2023-05-24 13:37:59 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
2024-01-13 08:15:51 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace "'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations'," "" \
|
|
|
|
--replace "'--benchmark-group-by', 'group'," "" \
|
|
|
|
--replace "'--benchmark-warmup', 'on'," "" \
|
|
|
|
--replace "'--benchmark-disable'," ""
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
"tests/benchmarks"
|
2022-06-26 10:26:21 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# avoid cyclic dependency
|
|
|
|
"tests/test_docs.py"
|
|
|
|
];
|
2022-04-27 09:35:20 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
pythonImportsCheck = [ "pydantic" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Data validation and settings management using Python type hinting";
|
2023-07-15 17:15:38 +00:00
|
|
|
homepage = "https://github.com/pydantic/pydantic";
|
|
|
|
changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ wd15 ];
|
|
|
|
};
|
|
|
|
}
|