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 ] ++ typer.optional-dependencies.standard;
42
43 preCheck = ''
44 # make sphinx_path an alias of pathlib.Path, since sphinx_path was removed in Sphinx v7.2.0
45 substituteInPlace tests/test_render.py --replace-fail \
46 'from sphinx.testing.util import path as sphinx_path' \
47 'sphinx_path = Path'
48 '';
49
50 nativeCheckInputs = [
51 pytestCheckHook
52 pytest-regressions
53 sphinx
54 defusedxml
55 ];
56
57 disabledTests = [
58 # some generated files differ in newer versions of Sphinx
59 "test_sphinx_build_directives"
60 ];
61
62 pythonImportsCheck = [ "autodoc2" ];
63
64 meta = {
65 changelog = "https://github.com/sphinx-extensions2/sphinx-autodoc2/releases/tag/v${version}";
66 homepage = "https://github.com/sphinx-extensions2/sphinx-autodoc2";
67 description = "Sphinx extension that automatically generates API documentation for your Python packages";
68 license = lib.licenses.mit;
69 mainProgram = "autodoc2";
70 maintainers = with lib.maintainers; [ tomasajt ];
71 };
72}