scverse-doc 0.3.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.editorconfig +1 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/autofix.yaml +2 -2
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/build.yaml +1 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/pr.yaml +1 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/release.yaml +2 -2
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/sync.yaml +9 -3
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/workflows/test.yaml +7 -7
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.gitignore +2 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.pre-commit-config.yaml +7 -4
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/CHANGELOG.md +33 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/PKG-INFO +5 -2
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/biome.jsonc +2 -1
- scverse_doc-0.5.0/hatch_build.py +22 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/pyproject.toml +16 -8
- scverse_doc-0.3.0/scripts/sync_brand_tokens.py → scverse_doc-0.5.0/scripts/sync_upstream.py +14 -5
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/__init__.py +12 -9
- scverse_doc-0.5.0/src/scverse_doc/_accents.json +48 -0
- scverse_doc-0.5.0/src/scverse_doc/math_core.py +117 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/registry.py +8 -2
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/release_notes.py +39 -5
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/source.py +10 -3
- scverse_doc-0.5.0/src/scverse_doc/static/math_core.css +13 -0
- scverse_doc-0.5.0/src/scverse_doc/static/mathmlfixes.css +93 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/__init__.py +109 -1
- scverse_doc-0.5.0/src/scverse_doc/theme/_bundle.py +33 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/scverse-sidebar-nav.html +2 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/toggle-secondary-sidebar.html +1 -1
- scverse_doc-0.5.0/src/scverse_doc/theme/scverse/static/styles/_pydata.css +140 -0
- scverse_doc-0.5.0/src/scverse_doc/theme/scverse/static/styles/_readthedocs.css +63 -0
- {scverse_doc-0.3.0/src/scverse_doc/theme/scverse/static → scverse_doc-0.5.0/src/scverse_doc/theme/scverse/static/styles}/_tokens.css +1 -1
- scverse_doc-0.5.0/src/scverse_doc/theme/scverse/static/styles/scverse.css +178 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/theme.toml +3 -1
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/typed_fields.py +8 -6
- scverse_doc-0.3.0/src/scverse_doc/_accents.json +0 -25
- scverse_doc-0.3.0/src/scverse_doc/theme/scverse/static/styles/scverse.css +0 -366
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.codecov.yaml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.cruft.json +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.github/dependabot.yml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.readthedocs.yaml +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.vscode/extensions.json +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.vscode/launch.json +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/.vscode/settings.json +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/LICENSE +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/README.md +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/scripts/check_changelog.py +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/autodoc/__init__.py +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/autodoc/templates/autosummary/class.rst +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/autodoc/templates/autosummary/module.rst +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/config.py +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/napoleon.py +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/py.typed +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/scverse-ecosystem.html +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/scverse-footer.html +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/sidebar-versions.html +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/components/toggle-primary-sidebar.html +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/layout.html +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/static/scripts/readthedocs-integration.js +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/theme/scverse/static/scverse-fa.svg +0 -0
- {scverse_doc-0.3.0 → scverse_doc-0.5.0}/src/scverse_doc/xref_overrides.py +0 -0
|
@@ -19,11 +19,11 @@ jobs:
|
|
|
19
19
|
fetch-depth: 0
|
|
20
20
|
filter: blob:none
|
|
21
21
|
persist-credentials: false
|
|
22
|
-
- uses: astral-sh/setup-uv@
|
|
22
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
23
23
|
with:
|
|
24
24
|
enable-cache: true
|
|
25
25
|
- run: uv tool install hatch
|
|
26
26
|
- name: Run pre-commit hooks
|
|
27
27
|
run: uvx prek run --all-files --show-diff-on-failure --color=always
|
|
28
28
|
- uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4
|
|
29
|
-
if:
|
|
29
|
+
if: "!cancelled()"
|
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
fetch-depth: 0
|
|
24
24
|
persist-credentials: false
|
|
25
25
|
- name: Install uv
|
|
26
|
-
uses: astral-sh/setup-uv@
|
|
26
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
27
27
|
- name: Build package
|
|
28
28
|
run: uv build
|
|
29
29
|
- name: Check package
|
|
@@ -12,7 +12,7 @@ jobs:
|
|
|
12
12
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
13
13
|
with:
|
|
14
14
|
persist-credentials: false
|
|
15
|
-
- uses: astral-sh/setup-uv@
|
|
15
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
16
16
|
- run: uv run scripts/check_changelog.py --pr="$PR" --title="$TITLE"
|
|
17
17
|
env:
|
|
18
18
|
PR: ${{ github.event.pull_request.number }}
|
|
@@ -24,10 +24,10 @@ jobs:
|
|
|
24
24
|
fetch-depth: 0
|
|
25
25
|
persist-credentials: false
|
|
26
26
|
- name: Install uv
|
|
27
|
-
uses: astral-sh/setup-uv@
|
|
27
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
28
28
|
with:
|
|
29
29
|
enable-cache: false
|
|
30
30
|
- name: Build package
|
|
31
31
|
run: uv build
|
|
32
32
|
- name: Publish package distributions to PyPI
|
|
33
|
-
uses: pypa/gh-action-pypi-publish@
|
|
33
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
@@ -6,8 +6,9 @@ on:
|
|
|
6
6
|
workflow_dispatch:
|
|
7
7
|
pull_request:
|
|
8
8
|
paths:
|
|
9
|
-
- src/scverse_doc/theme/scverse/static/_tokens.css
|
|
9
|
+
- src/scverse_doc/theme/scverse/static/styles/_tokens.css
|
|
10
10
|
- src/scverse_doc/theme/scverse/static/scverse-fa.svg
|
|
11
|
+
- src/scverse_doc/static/mathmlfixes.css
|
|
11
12
|
- scripts/**
|
|
12
13
|
|
|
13
14
|
permissions:
|
|
@@ -26,5 +27,10 @@ jobs:
|
|
|
26
27
|
repository: scverse/scverse.github.io
|
|
27
28
|
path: .upstream/website
|
|
28
29
|
persist-credentials: false
|
|
29
|
-
- uses:
|
|
30
|
-
|
|
30
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
31
|
+
with:
|
|
32
|
+
repository: tmke8/math-core
|
|
33
|
+
path: .upstream/math-core
|
|
34
|
+
persist-credentials: false
|
|
35
|
+
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
36
|
+
- run: uv run scripts/sync_upstream.py --website .upstream/website --math-core .upstream/math-core --check
|
|
@@ -33,7 +33,7 @@ jobs:
|
|
|
33
33
|
fetch-depth: 0
|
|
34
34
|
persist-credentials: false
|
|
35
35
|
- &setup-uv
|
|
36
|
-
uses: astral-sh/setup-uv@
|
|
36
|
+
uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
|
|
37
37
|
- name: Get test environments
|
|
38
38
|
id: get-envs
|
|
39
39
|
run: |
|
|
@@ -52,8 +52,8 @@ jobs:
|
|
|
52
52
|
test:
|
|
53
53
|
needs: get-environments
|
|
54
54
|
permissions:
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
id-token: write # for codecov OIDC
|
|
56
|
+
contents: read
|
|
57
57
|
|
|
58
58
|
strategy:
|
|
59
59
|
fail-fast: false
|
|
@@ -63,7 +63,7 @@ jobs:
|
|
|
63
63
|
|
|
64
64
|
name: ${{ matrix.env.label }}
|
|
65
65
|
runs-on: ${{ matrix.os }}
|
|
66
|
-
continue-on-error: ${{ contains(matrix.env.name, 'pre') }}
|
|
66
|
+
continue-on-error: ${{ contains(matrix.env.name, 'pre') }} # make "all-green" pass even if pre-release job fails
|
|
67
67
|
env:
|
|
68
68
|
UV_PYTHON: ${{ matrix.env.python }}
|
|
69
69
|
|
|
@@ -102,6 +102,6 @@ jobs:
|
|
|
102
102
|
- test
|
|
103
103
|
runs-on: ubuntu-latest
|
|
104
104
|
steps:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
- uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
|
|
106
|
+
with:
|
|
107
|
+
jobs: ${{ toJSON(needs) }}
|
|
@@ -7,23 +7,26 @@ default_stages:
|
|
|
7
7
|
minimum_pre_commit_version: 2.16.0
|
|
8
8
|
repos:
|
|
9
9
|
- repo: https://github.com/biomejs/pre-commit
|
|
10
|
-
rev: v2.
|
|
10
|
+
rev: v2.6.3
|
|
11
11
|
hooks:
|
|
12
12
|
- id: biome-format
|
|
13
13
|
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
|
|
14
14
|
groups: [format]
|
|
15
|
+
- id: biome-lint
|
|
16
|
+
args: [--error-on-warnings]
|
|
15
17
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
16
18
|
rev: v2.30.3
|
|
17
19
|
hooks:
|
|
18
20
|
- id: pyproject-fmt
|
|
19
21
|
groups: [format]
|
|
20
22
|
- repo: https://github.com/djlint/djLint
|
|
21
|
-
rev: v1.
|
|
23
|
+
rev: v1.47.0
|
|
22
24
|
hooks:
|
|
23
25
|
- id: djlint-reformat
|
|
26
|
+
groups: [format]
|
|
24
27
|
- id: djlint
|
|
25
28
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
26
|
-
rev: v0.17.
|
|
29
|
+
rev: v0.17.2
|
|
27
30
|
hooks:
|
|
28
31
|
- id: ruff-check
|
|
29
32
|
args: [--fix, --exit-non-zero-on-fix]
|
|
@@ -57,7 +60,7 @@ repos:
|
|
|
57
60
|
- id: check-merge-conflict
|
|
58
61
|
args: [--assume-in-merge]
|
|
59
62
|
- repo: https://github.com/zizmorcore/zizmor-pre-commit
|
|
60
|
-
rev: v1.
|
|
63
|
+
rev: v1.31.1
|
|
61
64
|
hooks:
|
|
62
65
|
- id: zizmor
|
|
63
66
|
args: [--no-progress, --fix]
|
|
@@ -10,6 +10,36 @@ and this project adheres to [Semantic Versioning][].
|
|
|
10
10
|
|
|
11
11
|
## [Unreleased]
|
|
12
12
|
|
|
13
|
+
## [0.5.0]
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- the site navigation shows a page’s sections that contain a toctree as captions above their entries, toggled by the `sidebar_sections_with_toctrees` theme option (#85)
|
|
18
|
+
- `[source]` links work for modules in the docs directory (#86)
|
|
19
|
+
- `release-notes` parses each file by its suffix, so e.g. Markdown notes work on a reST page (#86)
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `release-notes` with a relative path works inside other directives, e.g. `rest-example` (#86)
|
|
24
|
+
|
|
25
|
+
## [0.4.0]
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Sphinx 9.1 or newer is required
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
- `scverse_doc.math_core` renders math to MathML at build time via [math-core](https://github.com/tmke8/math-core) instead of MathJax (#75)
|
|
34
|
+
- `math_core_options` configures the converter, e.g. with macros
|
|
35
|
+
- math-core’s `mathmlfixes.css` is included, fixing e.g. `\boxed` and `\cancel` in Chromium
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- rapids-singlecell’s accents are synced from the website (#78)
|
|
40
|
+
- mantispy’s accents are synced from the website (#81)
|
|
41
|
+
- liana’s, CellRank’s and PyDESeq2’s accents and squidpy’s second accent are synced from the website (#83)
|
|
42
|
+
|
|
13
43
|
## [0.3.0]
|
|
14
44
|
|
|
15
45
|
### Added
|
|
@@ -70,7 +100,9 @@ and this project adheres to [Semantic Versioning][].
|
|
|
70
100
|
- Read the Docs integration: version selector and search, both with dark mode
|
|
71
101
|
- Autodoc, prose, and confval rendering extensions (from scverse-misc)
|
|
72
102
|
|
|
73
|
-
[Unreleased]: https://github.com/scverse/scverse-doc/compare/v0.
|
|
103
|
+
[Unreleased]: https://github.com/scverse/scverse-doc/compare/v0.5.0...main
|
|
104
|
+
[0.5.0]: https://github.com/scverse/scverse-doc/releases/tag/v0.5.0
|
|
105
|
+
[0.4.0]: https://github.com/scverse/scverse-doc/releases/tag/v0.4.0
|
|
74
106
|
[0.3.0]: https://github.com/scverse/scverse-doc/releases/tag/v0.3.0
|
|
75
107
|
[0.2.3]: https://github.com/scverse/scverse-doc/releases/tag/v0.2.3
|
|
76
108
|
[0.2.2]: https://github.com/scverse/scverse-doc/releases/tag/v0.2.2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scverse-doc
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Scverse documentation theme and utilities.
|
|
5
5
|
Project-URL: Documentation, https://scverse-doc.readthedocs.io/
|
|
6
6
|
Project-URL: Homepage, https://github.com/scverse/scverse-doc
|
|
@@ -18,18 +18,21 @@ Classifier: Programming Language :: Python :: 3.15
|
|
|
18
18
|
Classifier: Typing :: Typed
|
|
19
19
|
Requires-Python: >=3.12
|
|
20
20
|
Requires-Dist: packaging
|
|
21
|
-
Requires-Dist: sphinx>=
|
|
21
|
+
Requires-Dist: sphinx>=9.1
|
|
22
22
|
Provides-Extra: config
|
|
23
23
|
Requires-Dist: myst-nb>=1.1; extra == 'config'
|
|
24
24
|
Requires-Dist: sphinx-copybutton; extra == 'config'
|
|
25
25
|
Requires-Dist: sphinx-design; extra == 'config'
|
|
26
26
|
Requires-Dist: sphinxext-opengraph; extra == 'config'
|
|
27
27
|
Provides-Extra: full
|
|
28
|
+
Requires-Dist: math-core; extra == 'full'
|
|
28
29
|
Requires-Dist: myst-nb>=1.1; extra == 'full'
|
|
29
30
|
Requires-Dist: pydata-sphinx-theme>=0.23; extra == 'full'
|
|
30
31
|
Requires-Dist: sphinx-copybutton; extra == 'full'
|
|
31
32
|
Requires-Dist: sphinx-design; extra == 'full'
|
|
32
33
|
Requires-Dist: sphinxext-opengraph; extra == 'full'
|
|
34
|
+
Provides-Extra: math-core
|
|
35
|
+
Requires-Dist: math-core; extra == 'math-core'
|
|
33
36
|
Provides-Extra: theme
|
|
34
37
|
Requires-Dist: pydata-sphinx-theme>=0.23; extra == 'theme'
|
|
35
38
|
Description-Content-Type: text/markdown
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
"**",
|
|
8
8
|
"!src/scverse_doc/registry.json",
|
|
9
9
|
"!src/scverse_doc/_accents.json",
|
|
10
|
-
"!src/scverse_doc/
|
|
10
|
+
"!src/scverse_doc/static/mathmlfixes.css",
|
|
11
|
+
"!src/scverse_doc/theme/scverse/static/styles/_tokens.css",
|
|
11
12
|
],
|
|
12
13
|
},
|
|
13
14
|
"formatter": { "useEditorconfig": true },
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
"""Build the theme’s ``styles/*.min.css``, see ``scverse_doc.theme._bundle``."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import runpy
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class CSSBundleHook(BuildHookInterface): # type: ignore[type-arg]
|
|
14
|
+
"""Bundle the theme stylesheets."""
|
|
15
|
+
|
|
16
|
+
def initialize(self, version: str, build_data: dict[str, Any]) -> None: # noqa: D102
|
|
17
|
+
# By path, as the package isn’t installed yet.
|
|
18
|
+
mod = runpy.run_path(str(Path(self.root) / "src/scverse_doc/theme/_bundle.py"))
|
|
19
|
+
if (exe := mod["find_lightningcss"]()) is None:
|
|
20
|
+
msg = "lightningcss binary not found"
|
|
21
|
+
raise RuntimeError(msg)
|
|
22
|
+
mod["bundle"](exe)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
build-backend = "hatchling.build"
|
|
3
|
-
requires = [ "hatch-fancy-pypi-readme", "hatch-vcs", "hatchling" ]
|
|
3
|
+
requires = [ "hatch-fancy-pypi-readme", "hatch-vcs", "hatchling", "lightningcss-cli" ]
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scverse-doc"
|
|
@@ -25,7 +25,7 @@ classifiers = [
|
|
|
25
25
|
"Typing :: Typed",
|
|
26
26
|
]
|
|
27
27
|
dynamic = [ "readme", "version" ]
|
|
28
|
-
dependencies = [ "packaging", "sphinx>=
|
|
28
|
+
dependencies = [ "packaging", "sphinx>=9.1" ]
|
|
29
29
|
# The extension stack of `scverse_doc.config`.
|
|
30
30
|
optional-dependencies.config = [
|
|
31
31
|
"myst-nb>=1.1",
|
|
@@ -34,7 +34,8 @@ optional-dependencies.config = [
|
|
|
34
34
|
"sphinxext-opengraph",
|
|
35
35
|
]
|
|
36
36
|
# Everything, as the `scverse_doc` extension needs.
|
|
37
|
-
optional-dependencies.full = [ "scverse-doc[config,theme]" ]
|
|
37
|
+
optional-dependencies.full = [ "scverse-doc[config,math-core,theme]" ]
|
|
38
|
+
optional-dependencies.math-core = [ "math-core" ]
|
|
38
39
|
# `html_theme = "scverse"`, i.e. `scverse_doc.theme`.
|
|
39
40
|
optional-dependencies.theme = [ "pydata-sphinx-theme>=0.23" ]
|
|
40
41
|
# https://docs.pypi.org/project_metadata/#project-urls
|
|
@@ -50,18 +51,21 @@ dev = [
|
|
|
50
51
|
"twine>=4.0.2",
|
|
51
52
|
]
|
|
52
53
|
test = [
|
|
53
|
-
"coloraide",
|
|
54
|
+
"coloraide", # to check the accent lightness bounds
|
|
54
55
|
"coverage>=7.10",
|
|
55
|
-
"defusedxml",
|
|
56
|
+
"defusedxml", # for sphinx.testing’s HTML assertions
|
|
57
|
+
"lightningcss-cli", # to rebuild the theme’s stylesheet bundles
|
|
56
58
|
"pytest",
|
|
57
|
-
"pytest-cov",
|
|
58
|
-
"wenmode",
|
|
59
|
+
"pytest-cov", # For VS Code’s coverage functionality
|
|
60
|
+
"wenmode", # for scripts/check_changelog.py
|
|
59
61
|
]
|
|
60
62
|
doc = [
|
|
61
63
|
"ipykernel",
|
|
62
64
|
"ipython",
|
|
65
|
+
"lightningcss-cli", # to rebuild the theme’s stylesheet bundles
|
|
63
66
|
"scverse-misc[sphinx]>=0.1.2",
|
|
64
67
|
"sphinx-autodoc-typehints",
|
|
68
|
+
"sphinx-toolbox>=4.3.1", # `rest-example` directive
|
|
65
69
|
"sphinxcontrib-bibtex>=1",
|
|
66
70
|
]
|
|
67
71
|
typecheck = [ "mypy", "types-docutils", "wenmode" ] # wenmode for scripts/check_changelog.py
|
|
@@ -72,6 +76,10 @@ metadata.hooks.fancy-pypi-readme.content-type = "text/markdown"
|
|
|
72
76
|
metadata.hooks.fancy-pypi-readme.fragments = [
|
|
73
77
|
{ path = "README.md", start-after = "<!-- badges-end -->\n" },
|
|
74
78
|
]
|
|
79
|
+
build.targets.wheel.exclude = [ "/src/scverse_doc/theme/scverse/static/styles/" ]
|
|
80
|
+
build.targets.wheel.artifacts = [ "/src/scverse_doc/theme/scverse/static/styles/*.min.css*" ]
|
|
81
|
+
# Builds `styles/*.min.css`, which replace the stylesheet sources in wheels, see `hatch_build.py`.
|
|
82
|
+
build.targets.wheel.hooks.custom = {}
|
|
75
83
|
build.targets.sdist.exclude = [ "/docs", "/tests" ]
|
|
76
84
|
envs.default.installer = "uv"
|
|
77
85
|
envs.default.dependency-groups = [ "dev" ]
|
|
@@ -85,7 +93,7 @@ envs.hatch-check-code.scripts.lint-check = "echo 'try `hatch check code --fix`';
|
|
|
85
93
|
envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck"
|
|
86
94
|
envs.hatch-check-fmt.dependencies = [ "prek" ]
|
|
87
95
|
envs.hatch-check-fmt.scripts.format-check = "echo 'try `hatch check fmt --fix`'; false"
|
|
88
|
-
envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format
|
|
96
|
+
envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format"
|
|
89
97
|
envs.hatch-check-types.features = [ "full" ]
|
|
90
98
|
envs.hatch-check-types.scripts.check = [ "mypy" ]
|
|
91
99
|
envs.hatch-check-types.dependency-groups = [ "typecheck", "doc", "test" ]
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# requires-python = ">=3.12"
|
|
5
5
|
# dependencies = []
|
|
6
6
|
# ///
|
|
7
|
-
"""Refresh the generated
|
|
7
|
+
"""Refresh the files generated or copied from upstream: the scverse website and math-core.
|
|
8
8
|
|
|
9
9
|
The website is the brand’s source of truth,
|
|
10
10
|
so transcribing its colours into this repository by hand
|
|
@@ -20,9 +20,11 @@ Only the region between the marker comments is touched; the rest of the file is
|
|
|
20
20
|
The scverse logo used for the navbar link back to the website is copied verbatim for the same reason,
|
|
21
21
|
as is ``accents.json``, which the registry reads the package accents from.
|
|
22
22
|
|
|
23
|
+
math-core’s stylesheet fixing browsers’ MathML rendering is copied verbatim from its repository.
|
|
24
|
+
|
|
23
25
|
Usage
|
|
24
26
|
-----
|
|
25
|
-
uv run scripts/
|
|
27
|
+
uv run scripts/sync_upstream.py --website ../scverse.github.io --math-core ../math-core
|
|
26
28
|
"""
|
|
27
29
|
|
|
28
30
|
from __future__ import annotations
|
|
@@ -35,7 +37,7 @@ from pathlib import Path
|
|
|
35
37
|
|
|
36
38
|
HERE = Path(__file__).parent
|
|
37
39
|
STATIC = HERE.parent / "src" / "scverse_doc" / "theme" / "scverse" / "static"
|
|
38
|
-
TARGET = STATIC / "_tokens.css"
|
|
40
|
+
TARGET = STATIC / "styles" / "_tokens.css"
|
|
39
41
|
|
|
40
42
|
#: Website file -> package file, copied verbatim.
|
|
41
43
|
ASSETS = {
|
|
@@ -43,6 +45,11 @@ ASSETS = {
|
|
|
43
45
|
Path("assets/accents.json"): HERE.parent / "src" / "scverse_doc" / "_accents.json",
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
#: math-core file -> package file, copied verbatim.
|
|
49
|
+
MATH_CORE_ASSETS = {
|
|
50
|
+
Path("css/mathmlfixes.css"): HERE.parent / "src" / "scverse_doc" / "static" / "mathmlfixes.css",
|
|
51
|
+
}
|
|
52
|
+
|
|
46
53
|
#: CSS custom property emitted here -> website custom property it is resolved from.
|
|
47
54
|
#: The pairing mirrors the one scverse/scverse.github.io#329 used when replacing its SCSS variables.
|
|
48
55
|
TOKEN_MAP = {
|
|
@@ -66,7 +73,7 @@ ACCENT_TOKEN_MAP = {
|
|
|
66
73
|
"--scverse-color-gradient-end": ("scverse", "sky-blue"),
|
|
67
74
|
}
|
|
68
75
|
|
|
69
|
-
BEGIN = "/* BEGIN GENERATED BRAND TOKENS – DO NOT EDIT; regenerate with scripts/
|
|
76
|
+
BEGIN = "/* BEGIN GENERATED BRAND TOKENS – DO NOT EDIT; regenerate with scripts/sync_upstream.py */"
|
|
70
77
|
END = "/* END GENERATED BRAND TOKENS */"
|
|
71
78
|
|
|
72
79
|
#: The fenced region, captured together with the indentation of its opening marker.
|
|
@@ -114,6 +121,7 @@ def main() -> int:
|
|
|
114
121
|
"""Write the refreshed token stylesheet to disk."""
|
|
115
122
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
116
123
|
parser.add_argument("--website", type=Path, required=True, help="checkout of scverse/scverse.github.io")
|
|
124
|
+
parser.add_argument("--math-core", type=Path, required=True, help="checkout of tmke8/math-core")
|
|
117
125
|
parser.add_argument("--check", action="store_true", help="fail instead of writing if the output would change")
|
|
118
126
|
args = parser.parse_args()
|
|
119
127
|
|
|
@@ -122,10 +130,11 @@ def main() -> int:
|
|
|
122
130
|
updates = {
|
|
123
131
|
TARGET: render(props, accents, TARGET.read_text()).encode(),
|
|
124
132
|
**{dst: (args.website / src).read_bytes() for src, dst in ASSETS.items()},
|
|
133
|
+
**{dst: (args.math_core / src).read_bytes() for src, dst in MATH_CORE_ASSETS.items()},
|
|
125
134
|
}
|
|
126
135
|
if args.check:
|
|
127
136
|
if outdated := [str(dst) for dst, new in updates.items() if not dst.is_file() or dst.read_bytes() != new]:
|
|
128
|
-
print(f"{', '.join(outdated)} out of date; rerun scripts/
|
|
137
|
+
print(f"{', '.join(outdated)} out of date; rerun scripts/sync_upstream.py", file=sys.stderr)
|
|
129
138
|
return 1
|
|
130
139
|
return 0
|
|
131
140
|
for dst, new in updates.items():
|
|
@@ -12,20 +12,22 @@ A package’s `conf.py` needs few lines:
|
|
|
12
12
|
This extension sets up the subextensions,
|
|
13
13
|
each of which also works on its own:
|
|
14
14
|
|
|
15
|
-
:mod:`scverse_doc.autodoc`
|
|
16
|
-
The layout of the API pages.
|
|
17
15
|
:mod:`scverse_doc.config`
|
|
18
16
|
The extension stack and the shared defaults.
|
|
19
|
-
:mod:`scverse_doc.
|
|
20
|
-
|
|
17
|
+
:mod:`scverse_doc.theme`
|
|
18
|
+
The theme, its chrome, and the per-package accent.
|
|
19
|
+
:mod:`scverse_doc.source`
|
|
20
|
+
The repository links: the header icon, “edit this page”, and ``[source]``.
|
|
21
21
|
:mod:`scverse_doc.registry`
|
|
22
22
|
The package registry, usable as an :func:`~scverse_doc.registry.intersphinx` mapping.
|
|
23
|
+
:mod:`scverse_doc.autodoc`
|
|
24
|
+
The layout of the API pages.
|
|
25
|
+
:mod:`scverse_doc.napoleon`
|
|
26
|
+
Prose return sections in NumPy-style docstrings.
|
|
27
|
+
:mod:`scverse_doc.math_core`
|
|
28
|
+
Math rendered to MathML at build time, via math-core.
|
|
23
29
|
:mod:`scverse_doc.release_notes`
|
|
24
30
|
A ``release-notes`` directive, rendering a directory of per-version files.
|
|
25
|
-
:mod:`scverse_doc.source`
|
|
26
|
-
The repository links: the header icon, “edit this page”, and ``[source]``.
|
|
27
|
-
:mod:`scverse_doc.theme`
|
|
28
|
-
The theme, its chrome, and the per-package accent.
|
|
29
31
|
:mod:`scverse_doc.typed_fields`
|
|
30
32
|
Parameters and attributes as definition lists.
|
|
31
33
|
:mod:`scverse_doc.xref_overrides`
|
|
@@ -40,7 +42,7 @@ from typing import TYPE_CHECKING
|
|
|
40
42
|
|
|
41
43
|
from sphinx.util.typing import ExtensionMetadata
|
|
42
44
|
|
|
43
|
-
from . import autodoc, config, napoleon, registry, release_notes, source, theme, typed_fields, xref_overrides
|
|
45
|
+
from . import autodoc, config, math_core, napoleon, registry, release_notes, source, theme, typed_fields, xref_overrides
|
|
44
46
|
from .config import _is_set_by_user
|
|
45
47
|
|
|
46
48
|
if TYPE_CHECKING:
|
|
@@ -50,6 +52,7 @@ if TYPE_CHECKING:
|
|
|
50
52
|
__all__ = [
|
|
51
53
|
"autodoc",
|
|
52
54
|
"config",
|
|
55
|
+
"math_core",
|
|
53
56
|
"napoleon",
|
|
54
57
|
"registry",
|
|
55
58
|
"release_notes",
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"anndata": [["orange", [0.711, 0.138, 51]]],
|
|
3
|
+
"scanpy": [
|
|
4
|
+
["cerise", [0.608, 0.209, 1]],
|
|
5
|
+
["mandy", [0.634, 0.1737, 22]]
|
|
6
|
+
],
|
|
7
|
+
"mudata": [["green", [0.686, 0.134, 154.4]]],
|
|
8
|
+
"muon": [["aquamarine", [0.863, 0.163, 154.5]]],
|
|
9
|
+
"spatialdata": [["blue", [0.714, 0.158, 247.3]]],
|
|
10
|
+
"squidpy": [
|
|
11
|
+
["violet", [0.72, 0.112, 279]],
|
|
12
|
+
["yellow", [0.876, 0.169, 91.5]]
|
|
13
|
+
],
|
|
14
|
+
"scirpy": [
|
|
15
|
+
["purple", [0.601, 0.209, 358.5]],
|
|
16
|
+
["orange", [0.7824, 0.156, 69]]
|
|
17
|
+
],
|
|
18
|
+
"pertpy": [
|
|
19
|
+
["blue", [0.5, 0.1, 249]],
|
|
20
|
+
["red", [0.595, 0.177, 14]]
|
|
21
|
+
],
|
|
22
|
+
"rapids-singlecell": [
|
|
23
|
+
["green", [0.713, 0.194, 130.8]],
|
|
24
|
+
["violet", [0.518, 0.293, 290.0]]
|
|
25
|
+
],
|
|
26
|
+
"mantispy": [
|
|
27
|
+
["teal", [0.568, 0.091, 197.8]],
|
|
28
|
+
["orange", [0.686, 0.188, 47.4]]
|
|
29
|
+
],
|
|
30
|
+
"liana": [
|
|
31
|
+
["crimson", [0.517, 0.193, 6.0]],
|
|
32
|
+
["turquoise", [0.899, 0.158, 184.3]]
|
|
33
|
+
],
|
|
34
|
+
"cellrank": [
|
|
35
|
+
["navy", [0.36, 0.14, 265.9]],
|
|
36
|
+
["blue", [0.63, 0.186, 260.2]]
|
|
37
|
+
],
|
|
38
|
+
"pydeseq2": [
|
|
39
|
+
["green", [0.676, 0.189, 145.9]],
|
|
40
|
+
["dark-green", [0.521, 0.17, 143.3]]
|
|
41
|
+
],
|
|
42
|
+
"scvi-tools": [["yellow", [0.824, 0.1634, 81]]],
|
|
43
|
+
"scverse": [
|
|
44
|
+
["deep-blue", [0.405, 0.205, 270]],
|
|
45
|
+
["sky-blue", [0.799, 0.108, 236]],
|
|
46
|
+
["gold", [0.758, 0.2, 92]]
|
|
47
|
+
]
|
|
48
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
2
|
+
r"""Math rendering via ``math-core``.
|
|
3
|
+
|
|
4
|
+
Browsers support MathML today,
|
|
5
|
+
so math-core_ is the most lightweight way to render math on the web.
|
|
6
|
+
|
|
7
|
+
Examples
|
|
8
|
+
--------
|
|
9
|
+
Inline math, and a block equation referenced via its ``:label:``:
|
|
10
|
+
|
|
11
|
+
.. rest-example::
|
|
12
|
+
|
|
13
|
+
:math:`e^{i\pi} = -1`, see :eq:`math-example`.
|
|
14
|
+
|
|
15
|
+
.. math::
|
|
16
|
+
:label: math-example
|
|
17
|
+
|
|
18
|
+
\operatorname{AA}(c_\text{fg}, c_\text{bg}) \geq 4.5
|
|
19
|
+
|
|
20
|
+
Equations separated by blank lines, or rows separated by ``\\``, are aligned at ``&``:
|
|
21
|
+
|
|
22
|
+
.. rest-example::
|
|
23
|
+
|
|
24
|
+
.. math::
|
|
25
|
+
|
|
26
|
+
a &= b + c
|
|
27
|
+
|
|
28
|
+
d &= e
|
|
29
|
+
|
|
30
|
+
``:no-wrap:`` passes the LaTeX as is, e.g. for your own environment:
|
|
31
|
+
|
|
32
|
+
.. rest-example::
|
|
33
|
+
|
|
34
|
+
.. math::
|
|
35
|
+
:no-wrap:
|
|
36
|
+
|
|
37
|
+
\begin{cases} 1 & x > 0 \\ 0 & \text{otherwise} \end{cases}
|
|
38
|
+
|
|
39
|
+
Configure the converter, e.g. with your own macros, via :confval:`math_core_options`.
|
|
40
|
+
math-core’s ``mathmlfixes.css`` is included, mainly to fix Chromium’s rendering.
|
|
41
|
+
|
|
42
|
+
.. _math-core: https://github.com/tmke8/math-core
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
from pathlib import Path
|
|
46
|
+
|
|
47
|
+
from docutils import nodes
|
|
48
|
+
from sphinx.application import Sphinx
|
|
49
|
+
from sphinx.config import Config
|
|
50
|
+
from sphinx.locale import _
|
|
51
|
+
from sphinx.util import logging
|
|
52
|
+
from sphinx.util.math import get_node_equation_number
|
|
53
|
+
from sphinx.util.typing import ExtensionMetadata
|
|
54
|
+
from sphinx.writers.html5 import HTML5Translator
|
|
55
|
+
|
|
56
|
+
logger = logging.getLogger(__name__)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class _MathVisitor:
|
|
60
|
+
def configure(self, app: Sphinx, config: Config) -> None:
|
|
61
|
+
"""Create the converters from :confval:`math_core_options`."""
|
|
62
|
+
from math_core import LatexToMathML
|
|
63
|
+
|
|
64
|
+
self.converter = LatexToMathML(**config.math_core_options)
|
|
65
|
+
self.fallback = LatexToMathML(**{**config.math_core_options, "continue_on_error": True})
|
|
66
|
+
|
|
67
|
+
def visit(self, renderer: HTML5Translator, node: nodes.math | nodes.math_block):
|
|
68
|
+
"""Handles inline math `` :math:`…` `` and block math ``.. math:: …``."""
|
|
69
|
+
from math_core import LatexError
|
|
70
|
+
|
|
71
|
+
tex = node.astext()
|
|
72
|
+
if display_style := isinstance(node, nodes.math_block):
|
|
73
|
+
# `starttag` sets expected `id` for `:eq:` references; markup mirrors `sphinx.ext.mathjax`
|
|
74
|
+
renderer.body.append(renderer.starttag(node, "div", CLASS="math"))
|
|
75
|
+
if node["number"]:
|
|
76
|
+
renderer.body.append(f'<span class="eqno">({get_node_equation_number(renderer, node)})')
|
|
77
|
+
renderer.add_permalink_ref(node, _("Link to this equation"))
|
|
78
|
+
renderer.body.append("</span>")
|
|
79
|
+
if not node.get("no-wrap", node.get("nowrap", False)):
|
|
80
|
+
tex = _wrap(tex)
|
|
81
|
+
try:
|
|
82
|
+
out = self.converter.convert_all([(tex, display_style)])
|
|
83
|
+
except LatexError as e:
|
|
84
|
+
logger.warning("LaTeX error:%s", e, location=node)
|
|
85
|
+
out = self.fallback.convert_all([(tex, display_style)])
|
|
86
|
+
renderer.body.extend(out)
|
|
87
|
+
if display_style:
|
|
88
|
+
renderer.body.append("</div>\n")
|
|
89
|
+
raise nodes.SkipNode
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def _wrap(tex: str) -> str:
|
|
93
|
+
"""Align multiple equations or rows, like `sphinx.ext.mathjax`."""
|
|
94
|
+
# uses ``aligned``, as math-core lacks ``split``:
|
|
95
|
+
# https://github.com/tmke8/math-core/issues/154
|
|
96
|
+
# TODO: once split exists, we should use Sphinx’ `wrap_displaymath` instead of this
|
|
97
|
+
parts = [part.strip() for part in tex.split("\n\n") if part.strip()]
|
|
98
|
+
if len(parts) == 1 and r"\\" not in parts[0]:
|
|
99
|
+
return parts[0]
|
|
100
|
+
return r"\begin{aligned}" + r"\\".join(parts) + r"\end{aligned}"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# `mathmlfixes.css` is synced from math-core by `scripts/sync_upstream.py`
|
|
104
|
+
_STATIC = Path(__file__).with_name("static")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def setup(app: Sphinx):
|
|
108
|
+
"""Register the custom math-core HTML renderer."""
|
|
109
|
+
visitor = _MathVisitor()
|
|
110
|
+
# we raise SkipNode, so no need for depart (the `None`s)
|
|
111
|
+
app.add_html_math_renderer("mathcore", (visitor.visit, None), (visitor.visit, None))
|
|
112
|
+
app.add_config_value("math_core_options", {}, "env", types=frozenset({dict}))
|
|
113
|
+
app.connect("config-inited", visitor.configure)
|
|
114
|
+
app.add_static_dir(_STATIC)
|
|
115
|
+
app.add_css_file("mathmlfixes.css")
|
|
116
|
+
app.add_css_file("math_core.css")
|
|
117
|
+
return ExtensionMetadata(parallel_read_safe=True)
|