docs: migrate documentation from Sphinx/Read the Docs to VitePress with GitHub Pages deployment#146
Conversation
…th GitHub Pages deployment - Replace Sphinx/Read the Docs with VitePress for documentation - Add GitHub Pages deployment workflow (triggered on main branch) - Auto-generate API docs from Python source code using pydoc-markdown - Add documentation deployment badge to README.md - Configure VitePress with search, base path, and proper styling Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Migrates the project documentation from Sphinx/Read the Docs to a VitePress-based site published via GitHub Pages, with API reference pages generated from the Python source using pydoc-markdown.
Changes:
- Add a docs generation script (
pydoc-markdown→ Markdown) and wire it into VitePress build/dev commands. - Introduce a GitHub Pages deployment workflow for the VitePress site and update README badge/links.
- Remove the previous Sphinx/Read the Docs configuration and source files.
Reviewed changes
Copilot reviewed 20 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/generate_docs.py |
New script to generate docs/api.md, docs/models.md, docs/exceptions.md via pydoc-markdown. |
pyproject.toml |
Ruff per-file ignore tweak for scripts/*. |
package.json |
Add docs scripts (generate/dev/build/preview) and VitePress dependency. |
package-lock.json |
Lockfile updates for VitePress and its transitive dependencies. |
docs/usage.md |
New Markdown usage page for VitePress docs. |
docs/index.md |
New VitePress home page frontmatter/content. |
docs/.vitepress/config.mts |
VitePress site configuration (nav/sidebar/search/base). |
README.md |
Switch documentation badge/link from Read the Docs to GitHub Pages. |
.github/workflows/deploy-docs.yaml |
New workflow to build and deploy docs to GitHub Pages. |
.prettierignore |
Ignore VitePress build artifacts and generated API docs. |
.gitignore |
Ignore VitePress build artifacts and generated API docs. |
.readthedocs.yaml |
Remove Read the Docs build configuration. |
docs/requirements.txt |
Remove Sphinx requirements. |
docs/Makefile |
Remove Sphinx Makefile. |
docs/make.bat |
Remove Sphinx Windows build script. |
docs/__init__.py |
Remove docs package marker (Sphinx-era). |
docs/source/conf.py |
Remove Sphinx configuration. |
docs/source/index.rst |
Remove Sphinx index page. |
docs/source/usage.rst |
Remove Sphinx usage page. |
docs/source/api.rst |
Remove Sphinx API module page. |
docs/source/models.rst |
Remove Sphinx models reference page. |
docs/source/__init__.py |
Remove docs source package marker (Sphinx-era). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| async def main() -> None: | ||
| """Example usage of Tado Async to retrieve all devices.""" | ||
| async with Tado("username", "password") as tado: |
There was a problem hiding this comment.
The usage example calls Tado("username", "password"), but Tado.__init__ does not accept username/password (it takes an optional refresh_token, etc.). This example won’t run and will mislead users; update it to match the actual public API (e.g., device-flow usage with await tado.async_init() / async with Tado() and/or passing refresh_token=...).
| async with Tado("username", "password") as tado: | |
| async with Tado(refresh_token="your_refresh_token") as tado: | |
| await tado.async_init() |
| asyncio.run(main()) | ||
| ``` | ||
|
|
||
| Keep in mind that if you use `async with`, the `__aenter__` and `__aexit__` methods are called automatically. It's recommended you use session control; if you don't use `async with`, you need to call `tado.close()` to close the session. |
There was a problem hiding this comment.
This paragraph mentions calling tado.close() when not using async with, but it doesn’t mention that callers also need to run the async initialization (await tado.async_init()) before making API calls. Add that guidance so the non-context-manager usage path is complete.
| Keep in mind that if you use `async with`, the `__aenter__` and `__aexit__` methods are called automatically. It's recommended you use session control; if you don't use `async with`, you need to call `tado.close()` to close the session. | |
| Keep in mind that if you use `async with`, the `__aenter__` and `__aexit__` methods are called automatically. It's recommended you use session control; if you don't use `async with`, you need to run `await tado.async_init()` before making any API calls and call `tado.close()` to close the session when you're done. |
| result = subprocess.run( | ||
| [ # noqa: S603 | ||
| pydoc_md, | ||
| "-I", | ||
| "src", | ||
| "-m", | ||
| config["module"], | ||
| ], |
There was a problem hiding this comment.
subprocess.run passes -I src as a relative path, so the script will fail if invoked from a working directory other than the repo root. Consider deriving an absolute src path from __file__ (or setting cwd to the repo root) so doc generation works regardless of where it’s executed from.
| output.write_text(content) | ||
| print(f"Generated {output}") # noqa: T201 | ||
|
|
||
|
|
||
| def main() -> None: | ||
| """Generate all documentation pages.""" | ||
| pydoc_md = _find_pydoc_markdown() |
There was a problem hiding this comment.
Path.write_text() is called without an explicit encoding. For consistent output across environments/CI, specify encoding="utf-8" (and optionally ensure the docs output directory exists before writing).
| output.write_text(content) | |
| print(f"Generated {output}") # noqa: T201 | |
| def main() -> None: | |
| """Generate all documentation pages.""" | |
| pydoc_md = _find_pydoc_markdown() | |
| output.write_text(content, encoding="utf-8") | |
| print(f"Generated {output}") # noqa: T201 | |
| def main() -> None: | |
| """Generate all documentation pages.""" | |
| pydoc_md = _find_pydoc_markdown() | |
| DOCS_DIR.mkdir(parents=True, exist_ok=True) |
| "docs:generate": "python3 scripts/generate_docs.py", | ||
| "docs:dev": "npm run docs:generate && vitepress dev docs", | ||
| "docs:build": "npm run docs:generate && vitepress build docs", | ||
| "docs:preview": "vitepress preview docs" |
There was a problem hiding this comment.
The docs:preview script runs vitepress preview docs without ensuring the site has been built first. Since vitepress preview serves the build output, this should typically depend on docs:build (and/or docs:generate) to avoid preview failing on a clean checkout.
| "docs:preview": "vitepress preview docs" | |
| "docs:preview": "npm run docs:build && vitepress preview docs" |
| with: | ||
| python-version: "3.12" | ||
| - name: 🏗 Install pydoc-markdown | ||
| run: pip install pydoc-markdown |
There was a problem hiding this comment.
This workflow installs pydoc-markdown via pip install directly, which bypasses the repo’s existing uv-based, locked dependency approach used in other workflows. To make docs builds reproducible, consider adding pydoc-markdown to the project’s dev dependencies and using uv sync/uv run here as well (or at least pin the installed version).
| run: pip install pydoc-markdown | |
| run: pip install pydoc-markdown==4.8.2 |
There was a problem hiding this comment.
We don't use PIP, bu UV instead. :)
|
There are some merge conflicts now, can you please have a look? :) |
Summary
Migrate the documentation system from Sphinx/Read the Docs to VitePress with GitHub Pages deployment.
Changes