diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..1ea1591 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,53 @@ +name: Build documentation + +on: + push: + branches: + - main + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +# Default to bash +defaults: + run: + shell: bash + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + - name: Install dependencies + run: | + pipx install hatch + hatch env create + - name: Build + run: hatch run docs-build + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./site + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..612c7a5 --- /dev/null +++ b/docs/index.md @@ -0,0 +1 @@ +--8<-- "README.md" diff --git a/docs/reference.md b/docs/reference.md new file mode 100644 index 0000000..4bdeccc --- /dev/null +++ b/docs/reference.md @@ -0,0 +1,6 @@ +# Reference + +::: pythonkuma + options: + show_root_heading: false + show_source: false diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..a1509e0 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,69 @@ +site_name: pythonkuma +site_description: Simple Python wrapper for Uptime Kuma + +repo_url: https://github.com/tr4nt0r/pythonkuma +repo_name: tr4nt0r/pythonkuma + +theme: + name: material + icon: + logo: material/library + palette: + # Palette toggle for automatic mode + - media: "(prefers-color-scheme)" + toggle: + icon: material/brightness-auto + name: Switch to light mode + + # Palette toggle for light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: pink + accent: purple + toggle: + icon: material/brightness-7 + name: Switch to dark mode + + # Palette toggle for dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: pink + accent: purple + toggle: + icon: material/brightness-4 + name: Switch to light mode + +markdown_extensions: + - toc: + permalink: true + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.tasklist: + custom_checkbox: true + - pymdownx.inlinehilite + - pymdownx.snippets + - pymdownx.superfences + +plugins: + - search + - mkdocstrings: + handlers: + python: + paths: [src] + import: + - https://docs.python.org/3.12/objects.inv + options: + docstring_style: numpy + merge_init_into_class: false + show_signature: false + members_order: source + + +watch: + - docs + - pythonkuma + +nav: + - About: index.md + - Reference: + - pythonkuma: reference.md diff --git a/pyproject.toml b/pyproject.toml index e970698..1ebc8f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,10 +29,13 @@ dev = [ "aiohttp==3.12.12", "prometheus-client==0.22.1", "mashumaro==3.16", + "mkdocs-material==9.6.9", + "mkdocstrings[python]==0.29.0", ] [project.urls] Source = "https://github.com/tr4nt0r/pythonkuma" +Documentation = "https://tr4nt0r.github.io/pythonkuma" [tool.hatch.version] source = "regex_commit" @@ -66,4 +69,8 @@ pythonpath = ["pythonkuma"] extra-dependencies = [ "pythonkuma[dev]", "pytest-cov==6.1.1", -] \ No newline at end of file +] + +[tool.hatch.envs.default.scripts] +docs-serve = "mkdocs serve" +docs-build = "mkdocs build"