1{
2 lib,
3 buildPythonPackage,
4 docutils,
5 fetchFromGitHub,
6 packaging,
7 pdm-backend,
8 platformdirs,
9 pydantic,
10 pytestCheckHook,
11 pythonOlder,
12 sphinx,
13 sphinx-autodoc-typehints,
14 sphinx-rtd-theme,
15 sphinxHook,
16 tabulate,
17 tomli,
18}:
19
20buildPythonPackage rec {
21 pname = "pytoolconfig";
22 version = "1.3.1";
23 pyproject = true;
24
25 disabled = pythonOlder "3.8";
26
27 src = fetchFromGitHub {
28 owner = "bagel897";
29 repo = "pytoolconfig";
30 tag = "v${version}";
31 hash = "sha256-h21SDgVsnCDZQf5GS7sFE19L/p+OlAFZGEYKc0RHn30=";
32 };
33
34 outputs = [
35 "out"
36 "doc"
37 ];
38
39 PDM_PEP517_SCM_VERSION = version;
40
41 nativeBuildInputs = [
42 pdm-backend
43
44 # docs
45 docutils
46 sphinx-autodoc-typehints
47 sphinx-rtd-theme
48 sphinxHook
49 ]
50 ++ optional-dependencies.doc;
51
52 propagatedBuildInputs = [ packaging ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
53
54 optional-dependencies = {
55 validation = [ pydantic ];
56 global = [ platformdirs ];
57 doc = [
58 sphinx
59 tabulate
60 ];
61 };
62
63 pythonImportsCheck = [ "pytoolconfig" ];
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 ]
68 ++ lib.flatten (builtins.attrValues optional-dependencies);
69
70 meta = with lib; {
71 description = "Python tool configuration";
72 homepage = "https://github.com/bagel897/pytoolconfig";
73 changelog = "https://github.com/bagel897/pytoolconfig/releases/tag/v${version}";
74 license = licenses.lgpl3Plus;
75 maintainers = with maintainers; [
76 fab
77 hexa
78 ];
79 };
80}