summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/typer-config/default.nix
blob: b3447e2bfc9d308d62a81abb1f0d7b73ebc71472 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pydantic,
  pytestCheckHook,
  python-dotenv,
  pyyaml,
  schema,
  toml,
  typer,
  uv-build,
}:

buildPythonPackage rec {
  pname = "typer-config";
  version = "1.4.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "maxb2";
    repo = "typer-config";
    tag = version;
    hash = "sha256-pR32E6zdlfNpzIS4u/WOCxuqrnjDWZYiroUu92RBHVM=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "uv_build>=0.7.19,<0.8.0" "uv_build"
  '';

  build-system = [ uv-build ];

  dependencies = [ typer ];

  optional-dependencies = {
    all = [
      python-dotenv
      pyyaml
      toml
    ];
    python-dotenv = [ python-dotenv ];
    toml = [ toml ];
    yaml = [ pyyaml ];
  };

  nativeCheckInputs = [
    pydantic
    pytestCheckHook
    schema
  ]
  ++ lib.flatten (builtins.attrValues optional-dependencies);

  pythonImportsCheck = [ "typer_config" ];

  disabledTestPaths = [
    # Don't test the example
    "tests/test_example.py"
  ];

  meta = {
    description = "Utilities for working with configuration files in typer CLIs";
    homepage = "https://github.com/maxb2/typer-config";
    changelog = "https://github.com/maxb2/typer-config/blob/${src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}