scverse-doc 0.2.4__tar.gz → 0.4.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.
Files changed (63) hide show
  1. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.editorconfig +1 -1
  2. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/autofix.yaml +2 -2
  3. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/build.yaml +1 -1
  4. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/pr.yaml +1 -1
  5. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/release.yaml +2 -2
  6. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/sync.yaml +9 -3
  7. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/workflows/test.yaml +7 -7
  8. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.gitignore +2 -0
  9. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.pre-commit-config.yaml +7 -4
  10. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/CHANGELOG.md +32 -1
  11. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/PKG-INFO +5 -2
  12. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/biome.jsonc +3 -1
  13. scverse_doc-0.4.0/hatch_build.py +22 -0
  14. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/pyproject.toml +16 -7
  15. scverse_doc-0.2.4/scripts/sync_brand_tokens.py → scverse_doc-0.4.0/scripts/sync_upstream.py +44 -48
  16. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/__init__.py +4 -1
  17. scverse_doc-0.4.0/src/scverse_doc/_accents.json +48 -0
  18. scverse_doc-0.4.0/src/scverse_doc/math_core.py +117 -0
  19. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/registry.py +12 -4
  20. scverse_doc-0.4.0/src/scverse_doc/static/math_core.css +13 -0
  21. scverse_doc-0.4.0/src/scverse_doc/static/mathmlfixes.css +93 -0
  22. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/__init__.py +39 -14
  23. scverse_doc-0.4.0/src/scverse_doc/theme/_bundle.py +33 -0
  24. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/toggle-secondary-sidebar.html +1 -1
  25. scverse_doc-0.4.0/src/scverse_doc/theme/scverse/static/styles/_pydata.css +140 -0
  26. scverse_doc-0.4.0/src/scverse_doc/theme/scverse/static/styles/_readthedocs.css +63 -0
  27. {scverse_doc-0.2.4/src/scverse_doc/theme/scverse/static → scverse_doc-0.4.0/src/scverse_doc/theme/scverse/static/styles}/_tokens.css +3 -3
  28. scverse_doc-0.4.0/src/scverse_doc/theme/scverse/static/styles/scverse.css +178 -0
  29. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/theme.toml +14 -12
  30. scverse_doc-0.2.4/src/scverse_doc/_accents.json +0 -12
  31. scverse_doc-0.2.4/src/scverse_doc/_color.py +0 -146
  32. scverse_doc-0.2.4/src/scverse_doc/theme/scverse/static/styles/scverse.css +0 -359
  33. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.codecov.yaml +0 -0
  34. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.cruft.json +0 -0
  35. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  36. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  37. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  38. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.github/dependabot.yml +0 -0
  39. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.readthedocs.yaml +0 -0
  40. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.vscode/extensions.json +0 -0
  41. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.vscode/launch.json +0 -0
  42. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/.vscode/settings.json +0 -0
  43. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/LICENSE +0 -0
  44. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/README.md +0 -0
  45. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/scripts/check_changelog.py +0 -0
  46. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/autodoc/__init__.py +0 -0
  47. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/autodoc/templates/autosummary/class.rst +0 -0
  48. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/autodoc/templates/autosummary/module.rst +0 -0
  49. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/config.py +0 -0
  50. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/napoleon.py +0 -0
  51. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/py.typed +0 -0
  52. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/release_notes.py +0 -0
  53. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/source.py +0 -0
  54. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/scverse-ecosystem.html +0 -0
  55. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/scverse-footer.html +0 -0
  56. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/scverse-sidebar-nav.html +0 -0
  57. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/sidebar-versions.html +0 -0
  58. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/components/toggle-primary-sidebar.html +0 -0
  59. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/layout.html +0 -0
  60. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/static/scripts/readthedocs-integration.js +0 -0
  61. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/theme/scverse/static/scverse-fa.svg +0 -0
  62. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/typed_fields.py +0 -0
  63. {scverse_doc-0.2.4 → scverse_doc-0.4.0}/src/scverse_doc/xref_overrides.py +0 -0
@@ -8,7 +8,7 @@ charset = utf-8
8
8
  trim_trailing_whitespace = true
9
9
  insert_final_newline = true
10
10
 
11
- [{*.{yml,yaml,toml},.cruft.json}]
11
+ [{*.yml,*.yaml,*.toml,.cruft.json}]
12
12
  indent_size = 2
13
13
 
14
14
  [Makefile]
@@ -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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
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: '!cancelled()'
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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
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@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
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: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
30
- - run: uv run scripts/sync_brand_tokens.py --website .upstream/website --check
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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
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
- id-token: write # for codecov OIDC
56
- contents: read
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') }} # make "all-green" pass even if pre-release job fails
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
- - uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
106
- with:
107
- jobs: ${{ toJSON(needs) }}
105
+ - uses: re-actors/alls-green@b5b5b37504aa4183270bd3d855c52a67f212be35 # v1.3.0
106
+ with:
107
+ jobs: ${{ toJSON(needs) }}
@@ -11,6 +11,8 @@ __pycache__/
11
11
 
12
12
  # Distribution / packaging
13
13
  /dist/
14
+ # Built by hatch_build.py
15
+ *.min.css*
14
16
 
15
17
  # Tests and coverage
16
18
  /data/
@@ -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.5.15
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.46.4
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.0
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.30.1
63
+ rev: v1.31.1
61
64
  hooks:
62
65
  - id: zizmor
63
66
  args: [--no-progress, --fix]
@@ -10,10 +10,39 @@ and this project adheres to [Semantic Versioning][].
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.4.0]
14
+
15
+ ### Changed
16
+
17
+ - Sphinx 9.1 or newer is required
18
+
19
+ ### Added
20
+
21
+ - `scverse_doc.math_core` renders math to MathML at build time via [math-core](https://github.com/tmke8/math-core) instead of MathJax (#75)
22
+ - `math_core_options` configures the converter, e.g. with macros
23
+ - math-core’s `mathmlfixes.css` is included, fixing e.g. `\boxed` and `\cancel` in Chromium
24
+
25
+ ### Fixed
26
+
27
+ - rapids-singlecell’s accents are synced from the website (#78)
28
+ - mantispy’s accents are synced from the website (#81)
29
+ - liana’s, CellRank’s and PyDESeq2’s accents and squidpy’s second accent are synced from the website (#83)
30
+
31
+ ## [0.3.0]
32
+
33
+ ### Added
34
+
35
+ - `secondary_accent` theme option for the sidebar captions, which `True` sets to the package’s second brand colour from the website (#73)
36
+
37
+ ### Changed
38
+
39
+ - package accent colors are synced from the scverse website’s `accents.json` (#74)
40
+
13
41
  ### Fixed
14
42
 
15
43
  - header shadow now only extends downward (#70)
16
44
  - the autosummary class template now correctly handles classes referenced through aliased modules (#71)
45
+ - pertpy’s accent is its logo blue instead of scirpy’s pink (#72)
17
46
 
18
47
  ## [0.2.3]
19
48
 
@@ -59,7 +88,9 @@ and this project adheres to [Semantic Versioning][].
59
88
  - Read the Docs integration: version selector and search, both with dark mode
60
89
  - Autodoc, prose, and confval rendering extensions (from scverse-misc)
61
90
 
62
- [Unreleased]: https://github.com/scverse/scverse-doc/compare/v0.2.3...main
91
+ [Unreleased]: https://github.com/scverse/scverse-doc/compare/v0.4.0...main
92
+ [0.4.0]: https://github.com/scverse/scverse-doc/releases/tag/v0.4.0
93
+ [0.3.0]: https://github.com/scverse/scverse-doc/releases/tag/v0.3.0
63
94
  [0.2.3]: https://github.com/scverse/scverse-doc/releases/tag/v0.2.3
64
95
  [0.2.2]: https://github.com/scverse/scverse-doc/releases/tag/v0.2.2
65
96
  [0.2.1]: https://github.com/scverse/scverse-doc/releases/tag/v0.2.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: scverse-doc
3
- Version: 0.2.4
3
+ Version: 0.4.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>=8.1
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
@@ -6,7 +6,9 @@
6
6
  "includes": [
7
7
  "**",
8
8
  "!src/scverse_doc/registry.json",
9
- "!src/scverse_doc/theme/scverse/static/_tokens.css",
9
+ "!src/scverse_doc/_accents.json",
10
+ "!src/scverse_doc/static/mathmlfixes.css",
11
+ "!src/scverse_doc/theme/scverse/static/styles/_tokens.css",
10
12
  ],
11
13
  },
12
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>=8.1" ]
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,17 +51,21 @@ dev = [
50
51
  "twine>=4.0.2",
51
52
  ]
52
53
  test = [
54
+ "coloraide", # to check the accent lightness bounds
53
55
  "coverage>=7.10",
54
- "defusedxml", # for sphinx.testing’s HTML assertions
56
+ "defusedxml", # for sphinx.testing’s HTML assertions
57
+ "lightningcss-cli", # to rebuild the theme’s stylesheet bundles
55
58
  "pytest",
56
- "pytest-cov", # For VS Code’s coverage functionality
57
- "wenmode", # for scripts/check_changelog.py
59
+ "pytest-cov", # For VS Code’s coverage functionality
60
+ "wenmode", # for scripts/check_changelog.py
58
61
  ]
59
62
  doc = [
60
63
  "ipykernel",
61
64
  "ipython",
65
+ "lightningcss-cli", # to rebuild the theme’s stylesheet bundles
62
66
  "scverse-misc[sphinx]>=0.1.2",
63
67
  "sphinx-autodoc-typehints",
68
+ "sphinx-toolbox>=4.3.1", # `rest-example` directive
64
69
  "sphinxcontrib-bibtex>=1",
65
70
  ]
66
71
  typecheck = [ "mypy", "types-docutils", "wenmode" ] # wenmode for scripts/check_changelog.py
@@ -71,6 +76,10 @@ metadata.hooks.fancy-pypi-readme.content-type = "text/markdown"
71
76
  metadata.hooks.fancy-pypi-readme.fragments = [
72
77
  { path = "README.md", start-after = "<!-- badges-end -->\n" },
73
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 = {}
74
83
  build.targets.sdist.exclude = [ "/docs", "/tests" ]
75
84
  envs.default.installer = "uv"
76
85
  envs.default.dependency-groups = [ "dev" ]
@@ -84,7 +93,7 @@ envs.hatch-check-code.scripts.lint-check = "echo 'try `hatch check code --fix`';
84
93
  envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck"
85
94
  envs.hatch-check-fmt.dependencies = [ "prek" ]
86
95
  envs.hatch-check-fmt.scripts.format-check = "echo 'try `hatch check fmt --fix`'; false"
87
- envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format --no-group=typecheck"
96
+ envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format"
88
97
  envs.hatch-check-types.features = [ "full" ]
89
98
  envs.hatch-check-types.scripts.check = [ "mypy" ]
90
99
  envs.hatch-check-types.dependency-groups = [ "typecheck", "doc", "test" ]
@@ -4,26 +4,27 @@
4
4
  # requires-python = ">=3.12"
5
5
  # dependencies = []
6
6
  # ///
7
- """Refresh the generated brand assets from the scverse website.
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
11
11
  would create exactly the kind of drift this package exists to remove.
12
12
 
13
13
  The website takes its neutral colours from Bootstrap’s tokens (``--bs-fg-*``, ``--bs-bg-*``, …),
14
- which already carry dark values via ``light-dark()``, and defines only the brand hues itself.
15
- This script looks up the tokens the theme needs in the website’s vendored Bootstrap and ``assets/main.scss``,
14
+ which already carry dark values via ``light-dark()``, and defines only the brand hues itself,
15
+ as OKLCH triples in ``assets/accents.json``.
16
+ This script looks up the tokens the theme needs in the website’s vendored Bootstrap and ``accents.json``,
16
17
  resolves every ``var()`` down to literals, and writes them into ``_tokens.css`` as ``--scverse-color-x``.
17
- The per-package accents go to ``_accents.json``, because the registry needs their values in Python
18
- to derive readable shades from them.
19
-
20
18
  Only the region between the marker comments is touched; the rest of the file is hand-authored.
21
19
 
22
- The scverse logo used for the navbar link back to the website is copied verbatim for the same reason.
20
+ The scverse logo used for the navbar link back to the website is copied verbatim for the same reason,
21
+ as is ``accents.json``, which the registry reads the package accents from.
22
+
23
+ math-core’s stylesheet fixing browsers’ MathML rendering is copied verbatim from its repository.
23
24
 
24
25
  Usage
25
26
  -----
26
- uv run scripts/sync_brand_tokens.py --website ../scverse.github.io
27
+ uv run scripts/sync_upstream.py --website ../scverse.github.io --math-core ../math-core
27
28
  """
28
29
 
29
30
  from __future__ import annotations
@@ -36,17 +37,22 @@ from pathlib import Path
36
37
 
37
38
  HERE = Path(__file__).parent
38
39
  STATIC = HERE.parent / "src" / "scverse_doc" / "theme" / "scverse" / "static"
39
- TARGET = STATIC / "_tokens.css"
40
- ACCENTS_TARGET = HERE.parent / "src" / "scverse_doc" / "_accents.json"
40
+ TARGET = STATIC / "styles" / "_tokens.css"
41
41
 
42
- #: Website file -> theme static file, copied verbatim.
43
- ASSETS = {Path("static/img/logo/scverse-fa.svg"): STATIC / "scverse-fa.svg"}
42
+ #: Website file -> package file, copied verbatim.
43
+ ASSETS = {
44
+ Path("static/img/logo/scverse-fa.svg"): STATIC / "scverse-fa.svg",
45
+ Path("assets/accents.json"): HERE.parent / "src" / "scverse_doc" / "_accents.json",
46
+ }
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
+ }
44
52
 
45
53
  #: CSS custom property emitted here -> website custom property it is resolved from.
46
54
  #: The pairing mirrors the one scverse/scverse.github.io#329 used when replacing its SCSS variables.
47
55
  TOKEN_MAP = {
48
- "--scverse-color-gradient-start": "--scverse-deep-blue",
49
- "--scverse-color-gradient-end": "--scverse-sky-blue",
50
56
  "--scverse-color-background": "--bs-bg-body",
51
57
  "--scverse-color-text": "--bs-fg-body",
52
58
  "--scverse-color-heading": "--bs-fg-1",
@@ -61,21 +67,13 @@ TOKEN_MAP = {
61
67
  "--scverse-color-footer-bg": "--bs-bg-2",
62
68
  }
63
69
 
64
- #: Package -> website custom property holding its accent; ``default`` is for packages without one.
65
- ACCENT_MAP = {
66
- "default": "--scverse-deep-blue",
67
- "anndata": "--anndata-orange",
68
- "mudata": "--mudata-green",
69
- "muon": "--muon-aquamarine",
70
- "pertpy": "--scirpy-purple", # the website has no pertpy colour; it has always shared scirpy’s
71
- "scanpy": "--scanpy-cerise",
72
- "scirpy": "--scirpy-purple",
73
- "scvi-tools": "--scvi-yellow",
74
- "spatialdata": "--spatialdata-blue",
75
- "squidpy": "--squidpy-violet",
70
+ #: CSS custom property emitted here -> (package, colour name) in the website’s ``accents.json``.
71
+ ACCENT_TOKEN_MAP = {
72
+ "--scverse-color-gradient-start": ("scverse", "deep-blue"),
73
+ "--scverse-color-gradient-end": ("scverse", "sky-blue"),
76
74
  }
77
75
 
78
- BEGIN = "/* BEGIN GENERATED BRAND TOKENS – DO NOT EDIT; regenerate with scripts/sync_brand_tokens.py */"
76
+ BEGIN = "/* BEGIN GENERATED BRAND TOKENS – DO NOT EDIT; regenerate with scripts/sync_upstream.py */"
79
77
  END = "/* END GENERATED BRAND TOKENS */"
80
78
 
81
79
  #: The fenced region, captured together with the indentation of its opening marker.
@@ -89,56 +87,54 @@ def parse_bootstrap(css: str) -> dict[str, str]:
89
87
  return dict(DECL_RE.findall(";".join(blocks) + ";"))
90
88
 
91
89
 
92
- def parse_scss(scss: str) -> dict[str, str]:
93
- """Extract custom property declarations from the website’s SCSS."""
94
- return dict(DECL_RE.findall(scss))
95
-
96
-
97
90
  def resolve(name: str, props: dict[str, str]) -> str:
98
91
  """Return the value of `name` with every ``var()`` in it recursively substituted."""
99
92
  return re.sub(r"var\((--[\w-]+)\)", lambda m: resolve(m[1], props), props[name])
100
93
 
101
94
 
102
- def render_region(props: dict[str, str], indent: str) -> str:
95
+ def render_region(props: dict[str, str], accents: dict[str, list[tuple[str, list[float]]]], indent: str) -> str:
103
96
  """Render the generated region – marker comments included – indented by `indent`."""
104
97
  if missing := sorted(set(TOKEN_MAP.values()) - set(props)):
105
98
  msg = f"custom properties vanished from the website: {', '.join(missing)}"
106
99
  raise KeyError(msg)
107
- lines = [BEGIN, *(f"{prop}: {resolve(src, props)};" for prop, src in TOKEN_MAP.items()), END]
100
+ lines = [
101
+ BEGIN,
102
+ *(
103
+ f"{prop}: oklch({' '.join(map(str, dict(accents[pkg])[name]))});"
104
+ for prop, (pkg, name) in ACCENT_TOKEN_MAP.items()
105
+ ),
106
+ *(f"{prop}: {resolve(src, props)};" for prop, src in TOKEN_MAP.items()),
107
+ END,
108
+ ]
108
109
  return "\n".join(indent + line for line in lines)
109
110
 
110
111
 
111
- def render_accents(props: dict[str, str]) -> str:
112
- """Render the accent JSON read by ``scverse_doc.registry``."""
113
- return json.dumps({pkg: resolve(src, props) for pkg, src in ACCENT_MAP.items()}, indent=4) + "\n"
114
-
115
-
116
- def render(props: dict[str, str], current: str) -> str:
117
- """Return `current` with its generated region replaced by one rendered from `props`."""
112
+ def render(props: dict[str, str], accents: dict[str, list[tuple[str, list[float]]]], current: str) -> str:
113
+ """Return `current` with its generated region replaced by one rendered from `props` and `accents`."""
118
114
  if (region := REGION_RE.search(current)) is None:
119
115
  msg = f"{TARGET} has no “{BEGIN}” … “{END}” region"
120
116
  raise LookupError(msg)
121
- return current[: region.start()] + render_region(props, region[1]) + current[region.end() :]
117
+ return current[: region.start()] + render_region(props, accents, region[1]) + current[region.end() :]
122
118
 
123
119
 
124
120
  def main() -> int:
125
121
  """Write the refreshed token stylesheet to disk."""
126
122
  parser = argparse.ArgumentParser(description=__doc__)
127
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")
128
125
  parser.add_argument("--check", action="store_true", help="fail instead of writing if the output would change")
129
126
  args = parser.parse_args()
130
127
 
131
- props = parse_bootstrap(
132
- (args.website / "static" / "bootstrap" / "css" / "bootstrap.min.css").read_text()
133
- ) | parse_scss((args.website / "assets" / "main.scss").read_text())
128
+ props = parse_bootstrap((args.website / "static" / "bootstrap" / "css" / "bootstrap.min.css").read_text())
129
+ accents = json.loads((args.website / "assets" / "accents.json").read_text())
134
130
  updates = {
135
- TARGET: render(props, TARGET.read_text()).encode(),
136
- ACCENTS_TARGET: render_accents(props).encode(),
131
+ TARGET: render(props, accents, TARGET.read_text()).encode(),
137
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()},
138
134
  }
139
135
  if args.check:
140
136
  if outdated := [str(dst) for dst, new in updates.items() if not dst.is_file() or dst.read_bytes() != new]:
141
- print(f"{', '.join(outdated)} out of date; rerun scripts/sync_brand_tokens.py", file=sys.stderr)
137
+ print(f"{', '.join(outdated)} out of date; rerun scripts/sync_upstream.py", file=sys.stderr)
142
138
  return 1
143
139
  return 0
144
140
  for dst, new in updates.items():
@@ -16,6 +16,8 @@ each of which also works on its own:
16
16
  The layout of the API pages.
17
17
  :mod:`scverse_doc.config`
18
18
  The extension stack and the shared defaults.
19
+ :mod:`scverse_doc.math_core`
20
+ Math rendered to MathML at build time, via math-core.
19
21
  :mod:`scverse_doc.napoleon`
20
22
  Prose return sections in NumPy-style docstrings.
21
23
  :mod:`scverse_doc.registry`
@@ -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
+ }