depot/third_party/nixpkgs/pkgs/development/python-modules/pydantic/1.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

80 lines
1.8 KiB
Nix

{
lib,
buildPythonPackage,
cython_0,
email-validator,
fetchFromGitHub,
pytest-mock,
pytest7CheckHook,
python-dotenv,
pythonAtLeast,
pythonOlder,
setuptools,
typing-extensions,
libxcrypt,
}:
buildPythonPackage rec {
pname = "pydantic";
version = "1.10.16";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "pydantic";
repo = "pydantic";
rev = "refs/tags/v${version}";
hash = "sha256-dn/ZsxbkyK2sJxpo6IsoMBRjq1STdu+xuqHXoNG+Kzk=";
};
nativeBuildInputs = [
setuptools
cython_0
];
buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ];
propagatedBuildInputs = [ typing-extensions ];
passthru.optional-dependencies = {
dotenv = [ python-dotenv ];
email = [ email-validator ];
};
nativeCheckInputs = [
pytest-mock
pytest7CheckHook
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
pytestFlagsArray = [
# https://github.com/pydantic/pydantic/issues/4817
"-W"
"ignore::pytest.PytestReturnNotNoneWarning"
];
preCheck = ''
export HOME=$(mktemp -d)
'';
disabledTests = lib.optionals (pythonAtLeast "3.12") [
# depends on distuils
"test_cython_function_untouched"
# AssertionError on exact types and wording
"test_model_subclassing_abstract_base_classes_without_implementation_raises_exception"
"test_partial_specification_name"
"test_secretfield"
];
enableParallelBuilding = true;
pythonImportsCheck = [ "pydantic" ];
meta = with lib; {
description = "Data validation and settings management using Python type hinting";
homepage = "https://github.com/pydantic/pydantic";
changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
license = licenses.mit;
maintainers = with maintainers; [ wd15 ];
};
}