1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6
7 flit-core,
8
9 astroid,
10 typing-extensions,
11 typer,
12
13 pytestCheckHook,
14 pytest-regressions,
15 sphinx,
16 defusedxml,
17}:
18
19buildPythonPackage rec {
20 pname = "sphinx-autodoc2";
21 version = "0.5.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchFromGitHub {
27 owner = "sphinx-extensions2";
28 repo = "sphinx-autodoc2";
29 tag = "v${version}";
30 hash = "sha256-Wu079THK1mHVilD2Fx9dIzuIOOYOXpo/EMxVczNutCI=";
31 };
32
33 build-system = [ flit-core ];
34
35 dependencies = [
36 astroid
37 typing-extensions
38
39 # cli deps
40 typer
41 ]
42 ++ typer.optional-dependencies.standard;
43
44 preCheck = ''
45 # make sphinx_path an alias of pathlib.Path, since sphinx_path was removed in Sphinx v7.2.0
46 substituteInPlace tests/test_render.py --replace-fail \
47 'from sphinx.testing.util import path as sphinx_path' \
48 'sphinx_path = Path'
49 '';
50
51 nativeCheckInputs = [
52 pytestCheckHook
53 pytest-regressions
54 sphinx
55 defusedxml
56 ];
57
58 disabledTests = [
59 # some generated files differ in newer versions of Sphinx
60 "test_sphinx_build_directives"
61 ];
62
63 pythonImportsCheck = [ "autodoc2" ];
64
65 meta = {
66 changelog = "https://github.com/sphinx-extensions2/sphinx-autodoc2/releases/tag/v${version}";
67 homepage = "https://github.com/sphinx-extensions2/sphinx-autodoc2";
68 description = "Sphinx extension that automatically generates API documentation for your Python packages";
69 license = lib.licenses.mit;
70 mainProgram = "autodoc2";
71 maintainers = with lib.maintainers; [ tomasajt ];
72 };
73}