1{
2 lib,
3 buildPythonPackage,
4 click,
5 fetchPypi,
6 git, # shells out to git
7 hatchling,
8 importlib-resources,
9 incremental,
10 jinja2,
11 mock,
12 pytestCheckHook,
13 pythonOlder,
14 tomli,
15 twisted,
16}:
17
18buildPythonPackage rec {
19 pname = "towncrier";
20 version = "23.11.0";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-E5N8JH4/iuIKxE2JXPX5amCtRs/cwWcXWVMNeDfZ7l0=";
28 };
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace "hatchling ~= 1.17.1" "hatchling"
33 '';
34
35 nativeBuildInputs = [ hatchling ];
36
37 propagatedBuildInputs =
38 [
39 click
40 incremental
41 jinja2
42 ]
43 ++ lib.optionals (pythonOlder "3.10") [ importlib-resources ]
44 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
45
46 preCheck = ''
47 export PATH=$out/bin:$PATH
48 '';
49
50 nativeCheckInputs = [
51 git
52 mock
53 twisted
54 pytestCheckHook
55 ];
56
57 pythonImportsCheck = [ "towncrier" ];
58
59 meta = with lib; {
60 description = "Utility to produce useful, summarised news files";
61 mainProgram = "towncrier";
62 homepage = "https://github.com/twisted/towncrier/";
63 changelog = "https://github.com/twisted/towncrier/blob/${version}/NEWS.rst";
64 license = licenses.mit;
65 maintainers = with maintainers; [ ];
66 };
67}