nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchDebianPatch,
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 (finalAttrs: {
20 pname = "sphinx-autodoc2";
21 version = "0.5.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "sphinx-extensions2";
26 repo = "sphinx-autodoc2";
27 tag = "v${finalAttrs.version}";
28 hash = "sha256-Wu079THK1mHVilD2Fx9dIzuIOOYOXpo/EMxVczNutCI=";
29 };
30
31 patches = [
32 # compatibility with astroid 4, see: https://github.com/sphinx-extensions2/sphinx-autodoc2/pull/93
33 (fetchDebianPatch {
34 pname = "python-sphinx-autodoc2";
35 inherit (finalAttrs) version;
36 debianRevision = "9";
37 patch = "astroid-4.patch";
38 hash = "sha256-tRWDee30GSQ+AobCAHdtw65B6YyRpzn7kW5rzK7/QOk=";
39 })
40 ];
41
42 build-system = [ flit-core ];
43
44 dependencies = [
45 astroid
46 typing-extensions
47
48 # cli deps
49 typer
50 ];
51
52 preCheck = ''
53 # make sphinx_path an alias of pathlib.Path, since sphinx_path was removed in Sphinx v7.2.0
54 substituteInPlace tests/test_render.py --replace-fail \
55 'from sphinx.testing.util import path as sphinx_path' \
56 'sphinx_path = Path'
57 '';
58
59 nativeCheckInputs = [
60 pytestCheckHook
61 pytest-regressions
62 sphinx
63 defusedxml
64 ];
65
66 disabledTests = [
67 # some generated files differ in newer versions of Sphinx
68 "test_sphinx_build_directives"
69 ];
70
71 pythonImportsCheck = [ "autodoc2" ];
72
73 meta = {
74 changelog = "https://github.com/sphinx-extensions2/sphinx-autodoc2/releases/tag/${finalAttrs.src.tag}";
75 homepage = "https://github.com/sphinx-extensions2/sphinx-autodoc2";
76 description = "Sphinx extension that automatically generates API documentation for your Python packages";
77 license = lib.licenses.mit;
78 mainProgram = "autodoc2";
79 maintainers = with lib.maintainers; [ tomasajt ];
80 };
81})