summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/typed-settings/default.nix
blob: 933a37720917a0d90a383e3405d289bd91bed1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
  lib,
  attrs,
  buildPythonPackage,
  cattrs,
  click-option-group,
  click,
  fetchPypi,
  hatch-vcs,
  hatchling,
  hypothesis,
  jinja2,
  pydantic,
  pytest-cov-stub,
  pytestCheckHook,
  python-dotenv,
  pythonAtLeast,
  pythonOlder,
  rich-click,
  sybil,
  tomli,
  typing-extensions,
}:
buildPythonPackage rec {
  pname = "typed-settings";
  version = "25.3.0";
  pyproject = true;

  src = fetchPypi {
    pname = "typed_settings";
    inherit version;
    hash = "sha256-hl61LDGE9GdwVkWh5Y251xngi515V0SKKtjLvCLtIaY=";
  };

  build-system = [ hatchling ];

  dependencies = lib.optionals (pythonOlder "3.11") [ tomli ];

  optional-dependencies = {
    all = [
      attrs
      cattrs
      click
      click-option-group
      jinja2
      pydantic
    ];
    attrs = [ attrs ];
    cattrs = [ cattrs ];
    click = [ click ];
    option-groups = [
      click
      click-option-group
    ];
    jinja = [ jinja2 ];
    pydantic = [ pydantic ];
  };

  nativeBuildInputs = [ hatch-vcs ];

  nativeCheckInputs = [
    hypothesis
    pytest-cov-stub
    pytestCheckHook
    python-dotenv
    rich-click
    sybil
  ]
  ++ (lib.optional (pythonOlder "3.11") typing-extensions)
  ++ (lib.concatAttrValues optional-dependencies);

  enabledTestPaths = [ "tests" ];

  disabledTests = [
    # 1Password CLI is not available
    "TestOnePasswordLoader"
    "test_handle_op"
  ];

  disabledTestPaths = [
    # 1Password CLI is not available
    "tests/test_onepassword.py"
  ]
  ++ lib.optionals (pythonAtLeast "3.14") [
    # All the CLI help messages begin with python3.14 instead of python3
    "tests/test_cli_argparse.py"
  ];

  pythonImportsCheck = [ "typed_settings" ];

  meta = {
    description = "Typed settings based on attrs classes";
    homepage = "https://gitlab.com/sscherfke/typed-settings";
    changelog = "https://gitlab.com/sscherfke/typed-settings/-/blob/${version}/CHANGELOG.rst";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}