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 rev = "refs/tags/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 ] ++ passthru.optional-dependencies.doc;
50
51 propagatedBuildInputs = [ packaging ] ++ lib.optionals (pythonOlder "3.11") [ tomli ];
52
53 passthru.optional-dependencies = {
54 validation = [ pydantic ];
55 global = [ platformdirs ];
56 doc = [
57 sphinx
58 tabulate
59 ];
60 };
61
62 pythonImportsCheck = [ "pytoolconfig" ];
63
64 nativeCheckInputs = [
65 pytestCheckHook
66 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
67
68 meta = with lib; {
69 description = "Python tool configuration";
70 homepage = "https://github.com/bagel897/pytoolconfig";
71 changelog = "https://github.com/bagel897/pytoolconfig/releases/tag/v${version}";
72 license = licenses.lgpl3Plus;
73 maintainers = with maintainers; [
74 fab
75 hexa
76 ];
77 };
78}