1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchPypi,
6 importlib-metadata,
7 packaging,
8 tomli,
9 pytestCheckHook,
10 build,
11 hatchling,
12 pydantic,
13 pytest-cov-stub,
14 pytest-mock,
15 setuptools,
16 git,
17 mercurial,
18}:
19
20buildPythonPackage rec {
21 pname = "versioningit";
22 version = "3.1.2";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchPypi {
28 inherit pname version;
29 hash = "sha256-Tbg+2Z9WsH2DlAvuNEXKRsoSDRO2swTNtftE5apO3sA=";
30 };
31
32 build-system = [ hatchling ];
33
34 dependencies =
35 [ packaging ]
36 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]
37 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
38
39 # AttributeError: type object 'CaseDetails' has no attribute 'model_validate_json'
40 doCheck = lib.versionAtLeast pydantic.version "2";
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 build
45 hatchling
46 pydantic
47 pytest-cov-stub
48 pytest-mock
49 setuptools
50 git
51 mercurial
52 ];
53
54 disabledTests = [
55 # wants to write to the Nix store
56 "test_editable_mode"
57 ];
58
59 pythonImportsCheck = [ "versioningit" ];
60
61 meta = with lib; {
62 description = "setuptools plugin for determining package version from VCS";
63 mainProgram = "versioningit";
64 homepage = "https://github.com/jwodder/versioningit";
65 changelog = "https://versioningit.readthedocs.io/en/latest/changelog.html";
66 license = licenses.mit;
67 maintainers = with maintainers; [ DeeUnderscore ];
68 };
69}