1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pretend,
6 pytestCheckHook,
7 setuptools,
8}:
9
10let
11 self = buildPythonPackage rec {
12 pname = "calver";
13 version = "2025.04.17";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "di";
18 repo = "calver";
19 tag = version;
20 hash = "sha256-C0l/SThDhA1DnOeMJfuh3d8R606nzyQag+cg7QqvYWY=";
21 };
22
23 postPatch = ''
24 substituteInPlace setup.py \
25 --replace "version=calver_version(True)" 'version="${version}"'
26 '';
27
28 build-system = [ setuptools ];
29
30 doCheck = false; # avoid infinite recursion with hatchling
31
32 nativeCheckInputs = [
33 pretend
34 pytestCheckHook
35 ];
36
37 pythonImportsCheck = [ "calver" ];
38
39 passthru.tests.calver = self.overridePythonAttrs { doCheck = true; };
40
41 meta = {
42 changelog = "https://github.com/di/calver/releases/tag/${src.tag}";
43 description = "Setuptools extension for CalVer package versions";
44 homepage = "https://github.com/di/calver";
45 license = lib.licenses.asl20;
46 maintainers = with lib.maintainers; [ dotlambda ];
47 };
48 };
49in
50self