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