-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate API documentation from docstrings (#343)
Generate API documentation from docstrings Reviewed-by: Maja Massarini Reviewed-by: Laura Barcziová
- Loading branch information
Showing
21 changed files
with
326 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Rebuild docs on merge | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
trigger: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger packit.dev | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.PACKIT_DEV_TOKEN }} | ||
repository: packit/packit.dev | ||
event-type: specfile-docs-updated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import dataclasses | ||
import re | ||
from typing import List, Optional | ||
|
||
import docspec | ||
from pydoc_markdown.interfaces import Processor, Resolver | ||
|
||
|
||
@dataclasses.dataclass | ||
class EscapeBracketsProcessor(Processor): | ||
""" | ||
Processor that escapes curly brackets in Python template placeholders | ||
and RPM macros as they have special meaning in MDX files. | ||
""" | ||
|
||
def process( | ||
self, modules: List[docspec.Module], resolver: Optional[Resolver] | ||
) -> None: | ||
docspec.visit(modules, self._process) | ||
|
||
def _process(self, obj: docspec.ApiObject) -> None: | ||
if not obj.docstring: | ||
return | ||
obj.docstring.content = re.sub( | ||
r"(%|\$)\{(.+?)\}", | ||
r"\g<1>\{\g<2>\}", | ||
obj.docstring.content, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
loaders: | ||
- type: python | ||
modules: | ||
- specfile.specfile | ||
- specfile.changelog | ||
- specfile.conditions | ||
- specfile.context_management | ||
- specfile.exceptions | ||
- specfile.formatter | ||
- specfile.macro_definitions | ||
- specfile.macros | ||
- specfile.options | ||
- specfile.prep | ||
- specfile.sections | ||
- specfile.sourcelist | ||
- specfile.sources | ||
- specfile.spec_parser | ||
- specfile.tags | ||
- specfile.utils | ||
- specfile.value_parser | ||
processors: | ||
- type: filter | ||
- type: google | ||
- type: crossref | ||
- type: processors.EscapeBracketsProcessor | ||
renderer: | ||
type: docusaurus | ||
docs_base_path: docs | ||
relative_output_path: api | ||
markdown: | ||
descriptive_class_title: false | ||
render_typehint_in_data_header: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# specfile | ||
|
||
specfile is a pure-Python library for parsing and manipulating RPM spec files. | ||
Main focus is on modifying existing spec files, any change should result in a minimal diff. | ||
|
||
## Installation | ||
|
||
The library is packaged for Fedora, EPEL 9 and EPEL 8 and you can simply instal it with dnf: | ||
|
||
```bash | ||
dnf install python3-specfile | ||
``` | ||
|
||
On other systems, you can use pip (just note that it requires RPM Python bindings to be installed): | ||
|
||
```bash | ||
pip install specfile | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.