1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 importlib-metadata,
6 jinja2,
7 markdown,
8 markupsafe,
9 mkdocs,
10 mkdocs-autorefs,
11 pdm-backend,
12 pymdown-extensions,
13 pytestCheckHook,
14 pythonOlder,
15 dirty-equals,
16}:
17
18buildPythonPackage rec {
19 pname = "mkdocstrings";
20 version = "0.30.1";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "mkdocstrings";
25 repo = "mkdocstrings";
26 tag = version;
27 hash = "sha256-BfqxL35prq+pvD21w0BOJx/ls8og+LjtGdOAZlHYGVE=";
28 };
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace-fail 'dynamic = ["version"]' 'version = "${version}"'
33 '';
34
35 build-system = [ pdm-backend ];
36
37 dependencies = [
38 jinja2
39 markdown
40 markupsafe
41 mkdocs
42 mkdocs-autorefs
43 pymdown-extensions
44 ]
45 ++ lib.optionals (pythonOlder "3.10") [
46 importlib-metadata
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 dirty-equals
52 ];
53
54 pythonImportsCheck = [ "mkdocstrings" ];
55
56 disabledTestPaths = [
57 # Circular dependencies
58 "tests/test_api.py"
59 "tests/test_extension.py"
60 ];
61
62 disabledTests = [
63 # Not all requirements are available
64 "test_disabling_plugin"
65 # Circular dependency on mkdocstrings-python
66 "test_extended_templates"
67 "test_nested_autodoc[ext_markdown0]"
68 ];
69
70 meta = {
71 description = "Automatic documentation from sources for MkDocs";
72 homepage = "https://github.com/mkdocstrings/mkdocstrings";
73 changelog = "https://github.com/mkdocstrings/mkdocstrings/blob/${src.tag}/CHANGELOG.md";
74 license = lib.licenses.isc;
75 maintainers = with lib.maintainers; [ fab ];
76 };
77}