Skip to content

Commit

Permalink
pdoc3 for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Nov 8, 2023
1 parent 66d5d8f commit 3c6fcb1
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 55 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Documentation

on:
push:
branches: [main]

workflow_dispatch:

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}

jobs:
build:
name: pdoc3
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install -U pip setuptools
pip install .[docs]
- name: Build docs
run: |
pdoc3 --html -o html aethersprite
mv ./html ./tmp
mv ./tmp/aethersprite ./html
rm -rf ./tmp
- uses: actions/upload-pages-artifact@v2
with:
path: html/

deploy:
runs-on: ubuntu-latest
needs: build

permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
/.vscode/
/config.toml
/data/
/docs/
/html/
7 changes: 5 additions & 2 deletions aethersprite/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from importlib import import_module
import logging
from os import environ
from os.path import sep
from os.path import isfile, sep
from typing import Optional
from random import seed

Expand Down Expand Up @@ -42,7 +42,10 @@

# Load config from file and merge with defaults
config_file = environ.get("AETHERSPRITE_CONFIG", "config.toml")
config = {**config, **toml.load(config_file)}

if isfile(config_file):
config = {**config, **toml.load(config_file)}

data_folder = f"{config['bot']['data_folder']}{sep}"

log = logging.getLogger(__name__)
Expand Down
8 changes: 4 additions & 4 deletions aethersprite/authz.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,19 @@ async def require_roles_from_setting(
from my_super_secret_special_code import get_roles
authz = partial(require_roles, get_roles())
authz_setting = partial(require_roles_from_setting, setting='setting.name')
authz_setting = partial(require_roles_from_setting, setting="setting.name")
@command()
@check(authz)
async def my_command(ctx):
await ctx.send('You are authorized. Congratulations!')
await ctx.send("You are authorized. Congratulations!")
@command()
@check(authz_setting)
async def my_other_command(ctx):
# to set via bot command: !set setting.name SomeRoleName, SomeOtherRole
await ctx.send('You are a member of one of the authorized roles. '
'Congratulations!')
await ctx.send("You are a member of one of the authorized roles. "
"Congratulations!")
```
Args:
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sphinx
pdoc3
54 changes: 7 additions & 47 deletions requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,11 @@
#
# pip-compile docs.in
#
alabaster==0.7.13
# via sphinx
babel==2.13.1
# via sphinx
certifi==2023.7.22
# via requests
charset-normalizer==3.3.2
# via requests
docutils==0.20.1
# via sphinx
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
# via sphinx
mako==1.2.4
# via pdoc3
markdown==3.5.1
# via pdoc3
markupsafe==2.1.3
# via jinja2
packaging==23.2
# via sphinx
pygments==2.16.1
# via sphinx
requests==2.31.0
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sphinx==7.2.6
# via
# -r docs.in
# sphinxcontrib-applehelp
# sphinxcontrib-devhelp
# sphinxcontrib-htmlhelp
# sphinxcontrib-qthelp
# sphinxcontrib-serializinghtml
sphinxcontrib-applehelp==1.0.7
# via sphinx
sphinxcontrib-devhelp==1.0.5
# via sphinx
sphinxcontrib-htmlhelp==2.0.4
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.6
# via sphinx
sphinxcontrib-serializinghtml==1.1.9
# via sphinx
urllib3==2.0.7
# via requests
# via mako
pdoc3==0.10.0
# via -r docs.in

0 comments on commit 3c6fcb1

Please sign in to comment.