Skip to content

Commit 854314c

Browse files
committed
removed all sphinx and kept it more related to Fern
1 parent 0846f33 commit 854314c

File tree

308 files changed

+25635
-21686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

308 files changed

+25635
-21686
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33

4-
exclude: ^tests/.*\.md|tests/.*\.rst|tests/.*\.xml|docs/apidocs/.*
4+
exclude: ^tests/.*\.md
55

66
repos:
77
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -23,5 +23,5 @@ repos:
2323
hooks:
2424
- id: mypy
2525
args: [--config-file=pyproject.toml]
26-
additional_dependencies: ["sphinx~=7.3", "typer[all]"]
26+
additional_dependencies: ["typer[all]"]
2727
exclude: ^tests/.*\.py$

.readthedocs.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
1-
# sphinx-autodoc2-fern
1+
# py2fern
22

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.
44

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.
66

77
## Installation
88

99
```bash
10-
pip install sphinx-autodoc2-fern
10+
pipx install py2fern
1111
```
1212

1313
## Usage
1414

15-
Generate Fern-compatible markdown documentation:
15+
Generate Fern markdown documentation:
1616

1717
```bash
18-
autodoc2 --renderer fern /path/to/your/package
18+
py2fern /path/to/your/package
1919
```
2020

2121
This creates:
22+
2223
- Markdown files with Fern-compatible frontmatter and slugs
2324
- `navigation.yml` for Fern docs structure
2425
- Tables with proper linking and descriptions
@@ -27,37 +28,13 @@ This creates:
2728

2829
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.
2930

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
4932

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
34+
- **Handles `TYPE_CHECKING` blocks** - Documents typing-only imports
35+
- **Follows `__all__`** - Only documents public API
36+
- **Fern-ready output** - Frontmatter, slugs, ParamField components
37+
- **Navigation generation** - Automatic `navigation.yml` for Fern docs
6138

6239
## Development
6340

0 commit comments

Comments
 (0)