-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Readthedocs POC #4579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Readthedocs POC #4579
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,3 +20,6 @@ ts/.svelte-kit | |
| .yarn | ||
| .claude/settings.local.json | ||
| .claude/user.md | ||
| docs/_build/ | ||
| docs/autoapi/ | ||
| /docs/_static/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| version: 2 | ||
|
|
||
| sphinx: | ||
| configuration: docs/conf.py | ||
|
|
||
| build: | ||
| os: ubuntu-24.04 | ||
| tools: | ||
| python: "3.13" | ||
| jobs: | ||
| pre_create_environment: | ||
| - asdf plugin add uv | ||
| - asdf install uv latest | ||
| - asdf global uv latest | ||
| create_environment: | ||
| - uv venv "$READTHEDOCS_VIRTUALENV_PATH" | ||
| install: | ||
| - UV_PROJECT_ENVIRONMENT="$READTHEDOCS_VIRTUALENV_PATH" uv sync --frozen --group docs |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # API Modules | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 2 | ||
| :glob: | ||
|
|
||
| autoapi/anki/*/index | ||
| autoapi/anki/*/*/index | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Python API | ||
|
|
||
| The pages below are generated from Python docstrings in `pylib/anki`. | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 2 | ||
|
|
||
| api-python-modules | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Rust API | ||
|
|
||
| Anki's Rust API documentation is generated from doc comments in the `rslib/` | ||
| crates using `cargo doc`. | ||
|
|
||
| To browse the docs locally: | ||
|
|
||
| ``` | ||
| cargo doc --open | ||
| ``` | ||
|
|
||
| The main crates are: | ||
|
|
||
| - **anki** (`rslib/`) - Core library | ||
| - **anki_io** (`rslib/io/`) - I/O utilities |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| from pathlib import Path | ||
|
|
||
| project = "Anki" | ||
| copyright = "Ankitects Pty Ltd and contributors" | ||
| author = "Ankitects Pty Ltd and contributors" | ||
|
|
||
| ROOT = Path(__file__).resolve().parents[1] | ||
|
|
||
| extensions = [ | ||
| "myst_parser", | ||
| "sphinx.ext.intersphinx", | ||
| "autoapi.extension", | ||
| ] | ||
|
|
||
| source_suffix = { | ||
| ".rst": "restructuredtext", | ||
| ".md": "markdown", | ||
| } | ||
|
|
||
| myst_enable_extensions = ["colon_fence", "deflist"] | ||
| html_theme = "sphinx_book_theme" | ||
| html_theme_options = { | ||
| "repository_url": "https://github.com/ankitects/anki", | ||
| "use_repository_button": True, | ||
| "use_issues_button": True, | ||
| "use_edit_page_button": True, | ||
| "path_to_docs": "docs", | ||
| "repository_branch": "main", | ||
| } | ||
|
|
||
| autoapi_type = "python" | ||
| autoapi_dirs = [str(ROOT / "pylib" / "anki")] | ||
| autoapi_root = "autoapi" | ||
| autoapi_keep_files = True | ||
| autoapi_add_toctree_entry = False | ||
| autoapi_python_use_implicit_namespaces = True | ||
| autoapi_options = [ | ||
| "members", | ||
| "undoc-members", | ||
| "show-inheritance", | ||
| "show-module-summary", | ||
| ] | ||
|
|
||
| exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,16 +165,24 @@ See [this page](./build.md) | |
|
|
||
| ## Generating documentation | ||
|
|
||
| For Rust: | ||
| To build the documentation site from `docs/`: | ||
|
|
||
| ``` | ||
| cargo doc --open | ||
| uv run --group docs sphinx-build -b html docs out/docs/html | ||
| open out/docs/html/index.html | ||
| ``` | ||
|
|
||
| To build the API docs used by Anki's existing Python Sphinx pipeline: | ||
|
|
||
| ``` | ||
| ./ninja python:sphinx | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hey @abdnh and @andrewsanchez In this line: https://github.com/ankitects/anki/blob/main/build/configure/src/python.rs#L233 I must change it to: Does it make sense?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It doesn't work, because the sphinx group was removed as you noted. |
||
| open out/python/sphinx/html/py-modindex.html | ||
| ``` | ||
|
|
||
| For Python: | ||
| For Rust API docs: | ||
|
|
||
| ``` | ||
| ./ninja python:sphinx && open out/python/sphinx/html/py-modindex.html | ||
| cargo doc --open | ||
| ``` | ||
|
|
||
| ## Environmental Variables | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Anki Documentation | ||
|
|
||
| ## Prose | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 2 | ||
|
|
||
| readme | ||
| development | ||
| build | ||
| contributing | ||
| architecture | ||
| protobuf | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
||
| ```{toctree} | ||
| :maxdepth: 2 | ||
|
|
||
| api-python | ||
| api-rust | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Project README | ||
|
|
||
| ```{include} ../README.md | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,11 +25,10 @@ dev = [ | |
| "types-waitress", | ||
| "types-pywin32", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| sphinx = [ | ||
| docs = [ | ||
| "sphinx", | ||
| "sphinx_rtd_theme", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @andrewsanchez is there a reason to remove it? I'm asking because when I try to run it, I get a build error, and I have to add it back to work welll
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I specified the html theme in conf.py so not sure why you're getting that error but I'll check!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, because I can't get it to run successfully locally. |
||
| "myst-parser", | ||
| "sphinx-book-theme", | ||
| "sphinx-autoapi", | ||
| ] | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.