diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml new file mode 100644 index 0000000..a1d9068 --- /dev/null +++ b/.github/workflows/static.yml @@ -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 diff --git a/README.md b/README.md index f4344e9..4f3777d 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/doc/example.py b/doc/example.py index a764459..1b1ad92 100644 --- a/doc/example.py +++ b/doc/example.py @@ -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): diff --git a/doc/objects.rst b/doc/objects.rst index d690ca6..ed2fe2b 100644 --- a/doc/objects.rst +++ b/doc/objects.rst @@ -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 `_. .. 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 `_. + +.. automodule:: example + :members: send_message