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 ]
37 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]
38 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
39
40 # AttributeError: type object 'CaseDetails' has no attribute 'model_validate_json'
41 doCheck = lib.versionAtLeast pydantic.version "2";
42
43 nativeCheckInputs = [
44 pytestCheckHook
45 build
46 hatchling
47 pydantic
48 pytest-cov-stub
49 pytest-mock
50 setuptools
51 git
52 mercurial
53 ];
54
55 disabledTests = [
56 # wants to write to the Nix store
57 "test_editable_mode"
58 ];
59
60 pythonImportsCheck = [ "versioningit" ];
61
62 meta = with lib; {
63 description = "Setuptools plugin for determining package version from VCS";
64 mainProgram = "versioningit";
65 homepage = "https://github.com/jwodder/versioningit";
66 changelog = "https://versioningit.readthedocs.io/en/latest/changelog.html";
67 license = licenses.mit;
68 maintainers = with maintainers; [ DeeUnderscore ];
69 };
70}