1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 hatchling,
7 pydantic,
8 python-dotenv,
9 pytestCheckHook,
10 pytest-examples,
11 pytest-mock,
12}:
13
14let
15 self = buildPythonPackage rec {
16 pname = "pydantic-settings";
17 version = "2.10.1";
18 pyproject = true;
19
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "pydantic";
24 repo = "pydantic-settings";
25 tag = version;
26 hash = "sha256-Bi5MIXB9fVE5hoyk8QxxaGa9+puAlW+YGdi/WMNf/RQ=";
27 };
28
29 build-system = [ hatchling ];
30
31 dependencies = [
32 pydantic
33 python-dotenv
34 ];
35
36 pythonImportsCheck = [ "pydantic_settings" ];
37
38 nativeCheckInputs = [
39 pytestCheckHook
40 pytest-examples
41 pytest-mock
42 ];
43
44 disabledTests = [
45 # expected to fail
46 "test_docs_examples[docs/index.md:212-246]"
47 ];
48
49 preCheck = ''
50 export HOME=$TMPDIR
51 '';
52
53 # ruff is a dependency of pytest-examples which is required to run the tests.
54 # We do not want all of the downstream packages that depend on pydantic-settings to also depend on ruff.
55 doCheck = false;
56 passthru.tests = {
57 pytest = self.overridePythonAttrs { doCheck = true; };
58 };
59
60 meta = with lib; {
61 description = "Settings management using pydantic";
62 homepage = "https://github.com/pydantic/pydantic-settings";
63 license = licenses.mit;
64 broken = lib.versionOlder pydantic.version "2.0.0";
65 maintainers = [ ];
66 };
67 };
68in
69self