Change docs path and update publishing method

This commit is contained in:
Nicolas 2025-08-01 11:04:36 +02:00
parent eef02d7439
commit d5d1a839e4
7 changed files with 38 additions and 13 deletions

View File

@ -12,9 +12,10 @@ exclude =
__pycache__, __pycache__,
build, build,
dist, dist,
.conda .conda,
.venv .venv,
venv venv,
docs/source/api
# Enable specific plugins or options # Enable specific plugins or options
# Example: Enabling flake8-docstrings # Example: Enabling flake8-docstrings

View File

@ -9,7 +9,7 @@ permissions:
contents: write contents: write
jobs: jobs:
build-and-deploy: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -29,8 +29,24 @@ jobs:
rm ./source/*.rst rm ./source/*.rst
make html make html
touch ./build/html/.nojekyll touch ./build/html/.nojekyll
- name: Deploy to GitHub Pages mkdir -p ./build/html/_autogenerated
uses: JamesIves/github-pages-deploy-action@v4 cp ./build/html/api/* ./build/html/_autogenerated/
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with: with:
branch: gh-pages path: docs/build/html
folder: docs/build/html
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@ -10,6 +10,10 @@ jobs:
name: Build and publish name: Build and publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/${{ github.event.repository.name }}/
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3

2
.gitignore vendored
View File

@ -70,7 +70,7 @@ instance/
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
docs/source/_autogenerated/ docs/source/api/
# Autogenerated documentation # Autogenerated documentation
docs/source/modules.md docs/source/modules.md

View File

@ -24,7 +24,7 @@ def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title
write_dochtree(f, title, classes) write_dochtree(f, title, classes)
for cls in classes: for cls in classes:
with open(f'docs/source/_autogenerated/{cls}.md', 'w') as f2: with open(f'docs/source/api/{cls}.md', 'w') as f2:
f2.write(f'# {module_name}.{cls}\n') f2.write(f'# {module_name}.{cls}\n')
f2.write('```{eval-rst}\n') f2.write('```{eval-rst}\n')
f2.write(f'.. autoclass:: {module_name}.{cls}\n') f2.write(f'.. autoclass:: {module_name}.{cls}\n')
@ -52,9 +52,9 @@ def write_dochtree(f: TextIOWrapper, title: str, items: list[str]):
if __name__ == "__main__": if __name__ == "__main__":
# Ensure the output directory exists # Ensure the output directory exists
os.makedirs('docs/source/_autogenerated', exist_ok=True) os.makedirs('docs/source/api', exist_ok=True)
with open('docs/source/_autogenerated/index.md', 'w') as f: with open('docs/source/api/index.md', 'w') as f:
f.write('# Classes and Modules\n\n') f.write('# Classes and Modules\n\n')
write_classes(f, ['BK*', 'WAGO_750_352'], 'pyhoff.devices', title='Bus coupler', write_classes(f, ['BK*', 'WAGO_750_352'], 'pyhoff.devices', title='Bus coupler',

View File

@ -1,7 +1,8 @@
```{toctree} ```{toctree}
:maxdepth: 1 :maxdepth: 1
:hidden: :hidden:
_autogenerated/index api/index
repo
``` ```
```{include} ../../README.md ```{include} ../../README.md

3
docs/source/repo.md Normal file
View File

@ -0,0 +1,3 @@
# Code repository
Code repository is on GitHub: [github.com/Nonannet/pyhoff](https://github.com/Nonannet/pyhoff).