Skip to content

Commit

Permalink
Add sample output for example configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hunyadi committed Dec 15, 2024
1 parent b31420e commit db84012
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dependencies
run: |
python -m pip install --upgrade pip
python -m pip --disable-pip-version-check install -r requirements.txt
- name: Run Sphinx with autodoc
working-directory: doc/
run: PYTHONPATH=${GITHUB_WORKSPACE} make html
- name: Setup GitHub Pages
uses: actions/configure-pages@v5
- name: Upload generated documentation as artifact
uses: actions/upload-pages-artifact@v3
with:
path: doc/_build/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This extension to Sphinx [autodoc](https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html) enriches class member variable and function parameter lists with type information extracted from Python type annotations.

Refer to the [Sphinx HTML output](https://hunyadi.github.io/sphinx_doc/) for a live demonstration.

## Usage

1. Ensure that you have type hints in all your classes, functions and methods.
Expand Down
8 changes: 7 additions & 1 deletion doc/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@

@enum.unique
class EnumType(enum.Enum):
active = "active"
enabled = "enabled"
"Documents the enumeration member `enabled`."

disabled = "disabled"
"Documents the enumeration member `disabled`."

active = "active"
inactive = "inactive"


class MyException(Exception):
Expand Down
14 changes: 12 additions & 2 deletions doc/objects.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
Types in the module
-------------------

This page showcases classes and functions extracted from the module
This section showcases classes and types extracted from the module
`example <https://github.com/hunyadi/sphinx_doc/blob/master/doc/example.py>`_.

.. automodule:: example
:members: EnumType, MyException, PlainClass, SampleClass, DerivedClass, FixedWidthIntegers, LookupTable, EntityTable, send_message
:members: EnumType, MyException, PlainClass, SampleClass, DerivedClass, FixedWidthIntegers, LookupTable, EntityTable


Functions in the module
-----------------------

This section showcases functions extracted from the module
`example <https://github.com/hunyadi/sphinx_doc/blob/master/doc/example.py>`_.

.. automodule:: example
:members: send_message

0 comments on commit db84012

Please sign in to comment.