Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ $ uv add gp-sphinx --prerelease allow
badges, classified dependency lists, reverse-dep tracking, and auto-generated
usage snippets. Frozen dataclasses for pickle-safe incremental builds, parallel-safe,
WCAG AA badge contrast, and pytest 9+ compatible.
New: `doc-pytest-plugin` directive generates a standard pytest plugin page
(install block, `pytest11` autodiscovery note, fixture summary and reference)
from a single directive call. Optional `:project:`, `:summary:`, `:tests-url:`,
and `:install-command:` options; body is free-form. Use `autofixture-index` +
`autofixtures` directly when custom layout is needed.
- `sphinx-fonts` — Self-hosted web fonts via Fontsource CDN. Downloads at build time,
caches locally, and injects `@font-face` CSS with preload hints and fallback
font-metric overrides for zero-CLS loading.
Expand Down
38 changes: 37 additions & 1 deletion docs/packages/sphinx-autodoc-pytest-fixtures.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

Sphinx extension for documenting pytest fixtures as first-class objects. It
registers a Python-domain fixture directive and role, autodoc helpers for bulk
fixture discovery, and the badge/index UI used throughout the page below.
fixture discovery, a higher-level pytest plugin page helper, and the
badge/index UI used throughout the page below.

```console
$ pip install sphinx-autodoc-pytest-fixtures
Expand Down Expand Up @@ -49,14 +50,49 @@ pytest_external_fixture_links = {

```{eval-rst}
.. autofixtures:: spf_demo_fixtures
:no-index:
```

### Plugin page helper

:::{doc-pytest-plugin} spf_demo_fixtures
:package: sphinx-autodoc-pytest-fixtures

Add project-specific usage notes here. The helper renders the install
section, autodiscovery note, and full fixture summary/reference.
:::

#### When to use `doc-pytest-plugin`

Use this directive for a standard pytest plugin page where you want consistent
house-style: an install section, the `pytest11` autodiscovery note, and a
generated fixture summary and reference.

#### Manual recipe (power path)

When you need custom layout — a different section order, content between the
summary and reference, or no install block — use the low-level directives
directly:

````markdown
## Fixture Summary

```{autofixture-index} libvcs.pytest_plugin
```

## Fixture Reference

```{autofixtures} libvcs.pytest_plugin
```
````

#### autofixtures options

| Option | Default | Description |
|--------|---------|-------------|
| `:order:` | `"source"` | `"source"` preserves module order; `"alpha"` sorts alphabetically |
| `:exclude:` | (empty) | Comma-separated fixture names to skip |
| `:no-index:` | (off) | Emit descriptions without registering fixtures in the domain index; use when the same module is documented twice on one page |

#### autofixture-index options

Expand Down
6 changes: 6 additions & 0 deletions packages/sphinx-autodoc-pytest-fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Then document fixtures with:
.. autofixtures:: myproject.conftest

.. autofixture-index:: myproject.conftest

.. doc-pytest-plugin:: myproject.pytest_plugin
:project: myproject
:package: myproject
:summary: Document your pytest plugin with generated install and fixture
reference sections.
```

## Documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
from sphinx_autodoc_pytest_fixtures._directives import (
AutofixtureIndexDirective,
AutofixturesDirective,
DocPytestPluginDirective,
PyFixtureDirective,
)
from sphinx_autodoc_pytest_fixtures._documenter import FixtureDocumenter
Expand Down Expand Up @@ -174,6 +175,7 @@ def _add_static_path(app: Sphinx) -> None:
app.add_directive("autofixtures", AutofixturesDirective)
app.add_node(autofixture_index_node)
app.add_directive("autofixture-index", AutofixtureIndexDirective)
app.add_directive("doc-pytest-plugin", DocPytestPluginDirective)

app.connect("missing-reference", _on_missing_reference)
app.connect("doctree-resolved", _on_doctree_resolved)
Expand Down
Loading