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