You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-36Lines changed: 13 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,24 +1,25 @@
1
-
# sphinx-autodoc2-fern
1
+
# py2fern
2
2
3
-
Generate Fern-compatible API documentation from Python packages using static analysis.
3
+
Generate [Fern](https://buildwithfern.com) API documentation from Python packages using static analysis.
4
4
5
-
Fork of [`sphinx-autodoc2`](https://github.com/sphinx-extensions2/sphinx-autodoc2)with [Fern](https://buildwithfern.com) output support.
5
+
Simplified fork of [`sphinx-autodoc2`](https://github.com/sphinx-extensions2/sphinx-autodoc2)focused purely on **Python → Fern markdown** output.
6
6
7
7
## Installation
8
8
9
9
```bash
10
-
pip install sphinx-autodoc2-fern
10
+
pipx install py2fern
11
11
```
12
12
13
13
## Usage
14
14
15
-
Generate Fern-compatible markdown documentation:
15
+
Generate Fern markdown documentation:
16
16
17
17
```bash
18
-
autodoc2 --renderer fern /path/to/your/package
18
+
py2fern /path/to/your/package
19
19
```
20
20
21
21
This creates:
22
+
22
23
- Markdown files with Fern-compatible frontmatter and slugs
23
24
-`navigation.yml` for Fern docs structure
24
25
- Tables with proper linking and descriptions
@@ -27,37 +28,13 @@ This creates:
27
28
28
29
This project is a fork of the excellent [`sphinx-autodoc2`](https://github.com/sphinx-extensions2/sphinx-autodoc2) by Chris Sewell. All credit for the core functionality goes to the original project.
29
30
30
-
## Design and comparison to sphinx-autoapi
31
-
32
-
The original sphinx-autodoc2 was created with the following goals:
33
-
34
-
- Static analysis of Python code, so things like `if TYPE_CHECKING` were handled correctly
35
-
- Support for MyST docstrings (see <https://github.com/executablebooks/MyST-Parser/issues/228>)
36
-
- Also support for transitioning from `rst` to `md`, i.e. mixing docstrings
37
-
- Make it simple and minimise the amount of configuration and rebuilds necessary
38
-
- Support for building public API via `__all__` variable
39
-
40
-
I am not looking to support other languages tha Python (at least for now).
41
-
42
-
[sphinx-autoapi](https://github.com/readthedocs/sphinx-autoapi) was a good candidate, but it had a few issues:
43
-
44
-
- It does not support MyST docstrings: <https://github.com/readthedocs/sphinx-autoapi/issues/287>
45
-
- It does not support the `__all__` very well: <https://github.com/readthedocs/sphinx-autoapi/issues/358>
46
-
- The analysis and rendering are coupled, making it difficult to test, modify and use outside of Sphinx
47
-
48
-
I've use a lot of their code, for the `astroid` static analysis, but I've made a number of "improvements":
31
+
## Features
49
32
50
-
- separating concerns: analysis and template writing
51
-
- type annotations for code base
52
-
- fixed `a | b` annotations inference
53
-
- added analysis of `functools.singledispatch` and their registers
54
-
- handling of `__all__`
55
-
- docstrings (and summaries) are now parsed with the correct source/line, i.e. warnings point to the correct location in the source file
56
-
- added `:canonical:` to `py` directives
57
-
- Moved away from using jinja templates, to using python functions
58
-
- IMO the templates were too complex and hard to read,
59
-
plus they do not benefit from any form of type checking, linting, etc.
60
-
- uses `list-table`, instead of `auto-summary` directive
33
+
-**Static analysis** - No need to install your package
0 commit comments