2024-02-02 10:51:31 +01:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
cargo,
|
|
|
|
rustPlatform,
|
|
|
|
rustc,
|
|
|
|
libiconv,
|
|
|
|
typing-extensions,
|
|
|
|
pytestCheckHook,
|
|
|
|
hypothesis,
|
|
|
|
pytest-timeout,
|
|
|
|
pytest-mock,
|
|
|
|
dirty-equals,
|
2023-12-12 19:18:57 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
pydantic-core = buildPythonPackage rec {
|
|
|
|
pname = "pydantic-core";
|
|
|
|
version = "2.14.5";
|
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pydantic";
|
|
|
|
repo = "pydantic-core";
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-UguZpA3KEutOgIavjx8Ie//0qJq+4FTZNQTwb/ZIgb8=";
|
|
|
|
};
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
patches = [ ./01-remove-benchmark-flags.patch ];
|
2023-12-12 19:18:57 +01:00
|
|
|
|
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
hash = "sha256-mMgw922QjHmk0yimXfolLNiYZntTsGydQywe7PTNnwc=";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cargo
|
|
|
|
rustPlatform.cargoSetupHook
|
|
|
|
rustPlatform.maturinBuildHook
|
|
|
|
rustc
|
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
2023-12-12 19:18:57 +01:00
|
|
|
|
2024-02-02 10:51:31 +01:00
|
|
|
propagatedBuildInputs = [ typing-extensions ];
|
2023-12-12 19:18:57 +01:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "pydantic_core" ];
|
|
|
|
|
|
|
|
# escape infinite recursion with pydantic via dirty-equals
|
|
|
|
doCheck = false;
|
|
|
|
passthru.tests.pytest = pydantic-core.overrideAttrs { doCheck = true; };
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
hypothesis
|
|
|
|
pytest-timeout
|
|
|
|
dirty-equals
|
|
|
|
pytest-mock
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# RecursionError: maximum recursion depth exceeded while calling a Python object
|
|
|
|
"test_recursive"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# no point in benchmarking in nixpkgs build farm
|
|
|
|
"tests/benchmarks"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
changelog = "https://github.com/pydantic/pydantic-core/releases/tag/v${version}";
|
|
|
|
description = "Core validation logic for pydantic written in rust";
|
|
|
|
homepage = "https://github.com/pydantic/pydantic-core";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ blaggacao ];
|
|
|
|
};
|
|
|
|
};
|
2024-02-02 10:51:31 +01:00
|
|
|
in
|
|
|
|
pydantic-core
|