about summary refs log tree commit diff
path: root/pkgs/development/python-modules/gto/default.nix
blob: a41a7262dcdd4755f519a685a03be754b0d35fb2 (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  entrypoints,
  fastentrypoints,
  fetchFromGitHub,
  freezegun,
  funcy,
  git,
  pydantic,
  pytest-mock,
  pytest-test-utils,
  pytestCheckHook,
  pythonOlder,
  rich,
  ruamel-yaml,
  scmrepo,
  semver,
  setuptools,
  setuptools-scm,
  tabulate,
  typer,
}:

buildPythonPackage rec {
  pname = "gto";
  version = "1.7.1";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "iterative";
    repo = "gto";
    rev = "refs/tags/${version}";
    hash = "sha256-fUi+/PW05EvgTnoEv1Im1BjZ07VzpZhyW0EjhLUqJGI=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail ', "setuptools_scm_git_archive==1.4.1"' ""
    substituteInPlace setup.cfg \
      --replace-fail " --cov=gto --cov-report=term-missing --cov-report=xml" ""
  '';

  nativeBuildInputs = [
    fastentrypoints
    setuptools
    setuptools-scm
  ];

  propagatedBuildInputs = [
    entrypoints
    funcy
    pydantic
    rich
    ruamel-yaml
    scmrepo
    semver
    tabulate
    typer
  ];

  nativeCheckInputs = [
    freezegun
    git
    pytest-mock
    pytest-test-utils
    pytestCheckHook
  ];

  preCheck = ''
    export HOME=$(mktemp -d)

    git config --global user.email "nobody@example.com"
    git config --global user.name "Nobody"
  '';

  disabledTests = [
    # Tests want to with a remote repo
    "remote_repo"
    "remote_git_repo"
    "test_action_doesnt_push_even_if_repo_has_remotes_set"
  ];

  pythonImportsCheck = [ "gto" ];

  meta = with lib; {
    description = "Module for Git Tag Operations";
    homepage = "https://github.com/iterative/gto";
    changelog = "https://github.com/iterative/gto/releases/tag/${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ fab ];
    mainProgram = "gto";
  };
}