2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
|
|
|
pythonOlder,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
hatchling,
|
|
|
|
hatch-fancy-pypi-readme,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# native dependencies
|
|
|
|
libxcrypt,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
annotated-types,
|
|
|
|
pydantic-core,
|
|
|
|
typing-extensions,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
cloudpickle,
|
|
|
|
email-validator,
|
|
|
|
dirty-equals,
|
|
|
|
faker,
|
|
|
|
pytestCheckHook,
|
|
|
|
pytest-mock,
|
|
|
|
eval-type-backport,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pydantic";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "2.6.3";
|
2024-01-13 08:15:51 +00:00
|
|
|
pyproject = true;
|
2022-07-18 16:21:45 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
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-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-neTdG/IcXopCmevzFY5/XDlhPHmOb6dhyAnzaobmeG8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
# https://github.com/pydantic/pydantic/pull/8678
|
|
|
|
name = "fix-pytest8-compatibility.patch";
|
|
|
|
url = "https://github.com/pydantic/pydantic/commit/825a6920e177a3b65836c13c7f37d82b810ce482.patch";
|
|
|
|
hash = "sha256-Dap5DtDzHw0jS/QUo5CRI9sLDJ719GRyC4ZNDWEdzus=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
build-system = [
|
2024-01-13 08:15:51 +00:00
|
|
|
hatch-fancy-pypi-readme
|
|
|
|
hatchling
|
2022-02-20 05:27:41 +00:00
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
dependencies = [
|
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 = {
|
2024-06-05 15:53:02 +00:00
|
|
|
email = [ email-validator ];
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
nativeCheckInputs =
|
|
|
|
[
|
|
|
|
cloudpickle
|
|
|
|
dirty-equals
|
|
|
|
faker
|
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
]
|
|
|
|
++ lib.flatten (lib.attrValues passthru.optional-dependencies)
|
|
|
|
++ lib.optionals (pythonOlder "3.10") [ eval-type-backport ];
|
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-04-21 15:54:59 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
# suppress warnings with pytest>=8
|
|
|
|
"-Wignore::pydantic.warnings.PydanticDeprecatedSince20"
|
|
|
|
"-Wignore::pydantic.json_schema.PydanticJsonSchemaWarning"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# disable failing test with pytest>=8
|
|
|
|
"test_assert_raises_validation_error"
|
|
|
|
];
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|