Skip to content

Revamp docs and add interactive python examples with sphinx-pyodide#171

Open
rlskoeser wants to merge 18 commits into
developfrom
feature/sphinx-pyodide
Open

Revamp docs and add interactive python examples with sphinx-pyodide#171
rlskoeser wants to merge 18 commits into
developfrom
feature/sphinx-pyodide

Conversation

@rlskoeser

@rlskoeser rlskoeser commented Jul 3, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Documentation
    • Added an “Example Usage” page with detailed samples for uncertain/partial dates, intervals, converters, and calendar-aware parsing (including a Pyodide snippet).
    • Reworked the documentation homepage and added “Quick Start” and installation guidance; removed the embedded README include.
    • Refreshed the README introduction to streamline “Currently supports” and replace the long example section with a shorter quick start.
  • Style
    • Updated the docs theme and added custom styling for the sidebar logo (fixed width; light/dark presentation).
  • Chores
    • Improved Sphinx configuration for Pyodide builds and updated packaging/docs tooling; migrated publishing to uv and refreshed workflow caching.

Assisted-by: OpenCode:BigPickle (glm-5.1)
Assisted-by: ClaudeCode:claude-sonnet-4-6
- Fixed output consistency — all calls use repr(), with the format conversion separated into a clear comment
- Added "Parsing and Formatting" section heading (same ~~~~~ level as "Calendars")
- Added Gregorian examples — French and Kinyarwanda to illustrate the multilingual support
- Added holidays examples — Epiphany (fixed), Easter and Ash Wednesday (movable feasts)

Assisted-by: ClaudeCode:claude-sonnet-4-6
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e0803c91-c74e-4c01-9aa9-c04b74ec4a8c

📥 Commits

Reviewing files that changed from the base of the PR and between d2d942e and 4cb5a65.

📒 Files selected for processing (1)
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

Walkthrough

The docs build now uses furo with Pyodide support, the homepage and navigation are rewritten, a new usage guide is added, and CI/publish workflows switch cache and build steps to uv-based settings.

Changes

Documentation build and content overhaul

Layer / File(s) Summary
Sphinx config and tooling
docs/conf.py, docs/_static/custom.css, pyproject.toml
Adds sphinx_pyodide, enables Pyodide build output, switches the docs theme to furo with new logos and CSS variables, registers custom.css, adds a sidebar logo rule, updates docs/dev dependency groups, and adds a local sphinx-pyodide source override.
CI and publish workflows
.github/workflows/check.yml, .github/workflows/unit_tests.yml, .github/workflows/python-publish.yml
Changes uv cache invalidation to use uv.lock, enables uv caching in unit tests, and replaces the package build step with uv build.
Landing page and navigation
docs/index.rst, docs/readme.md
Rewrites the landing page with badges, project overview, Quick Start, Installation, and a new toctree target, and removes the README include from docs/readme.md.
Example usage page
docs/example_usage.rst
Adds a new guide covering Undate, UndateInterval, parsing/formatting, comparisons, calendars, and a try-it-yourself example.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: ColeDCrawford, jdamerow

Poem

A rabbit hops through docs so bright,
With Furo theme and Pyodide light.
The homepage blooms, the examples sing,
And uv gives workflows a tidy spring.
I twitch my nose, then bound along—
New burrows built, all neat and strong. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: a documentation revamp with interactive Python examples via sphinx-pyodide.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sphinx-pyodide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/_static/custom.css (1)

2-6: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant with sidebar-logo-width CSS variable.

docs/conf.py already sets "sidebar-logo-width": "200px" in both light_css_variables and dark_css_variables, which furo uses to size .sidebar-logo. This custom rule duplicates that value; if one is changed without the other, they'll silently drift out of sync.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/_static/custom.css` around lines 2 - 6, The .sidebar-logo rule in the
custom stylesheet duplicates the sizing already controlled by the
sidebar-logo-width theme variable in docs/conf.py. Remove the redundant custom
CSS from custom.css and rely on the existing Furo CSS variable settings so the
sidebar logo size stays defined in one place.
docs/example_usage.rst (1)

8-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded version string in wheel filename will drift from the package version.

./wheels/undate-0.8.0.dev0-py3-none-any.whl hardcodes the current dev version. Every time undate.__version__ bumps (already read dynamically in docs/conf.py for the release setting), this path must be manually kept in sync or the pyodide packages install will fail to find the wheel silently breaking every downstream interactive example on this page.

Consider generating this wheel filename dynamically (e.g., via a Jinja/|release| substitution if sphinx_pyodide supports it, or a small conf.py-level string replacement) rather than hardcoding it in the .rst source.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/example_usage.rst` around lines 8 - 14, The pyodide example hardcodes
the undate wheel filename, so it will drift whenever the package version
changes. Update the example in example_usage.rst to derive the wheel name from
the same dynamic version source used in docs/conf.py (for example via a
release-based substitution or conf.py-driven text replacement) instead of
embedding the version directly. Make the change around the pyodide directive and
its :packages: entry so the package path stays in sync with undate.__version__.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pyproject.toml`:
- Around line 133-135: The [tool.uv.sources] entry for sphinx-pyodide is
hard-pinned to a sibling local path, which breaks clean-clone docs/dev installs;
update the sphinx-pyodide source definition to use a published or git-based
source instead of ../sphinx-pyodide, or adjust the docs/dev setup so the
dependency is available without requiring a neighboring checkout. Make the
change in pyproject.toml near the sphinx-pyodide source override so uv sync and
docs builds work from a fresh clone.

---

Nitpick comments:
In `@docs/_static/custom.css`:
- Around line 2-6: The .sidebar-logo rule in the custom stylesheet duplicates
the sizing already controlled by the sidebar-logo-width theme variable in
docs/conf.py. Remove the redundant custom CSS from custom.css and rely on the
existing Furo CSS variable settings so the sidebar logo size stays defined in
one place.

In `@docs/example_usage.rst`:
- Around line 8-14: The pyodide example hardcodes the undate wheel filename, so
it will drift whenever the package version changes. Update the example in
example_usage.rst to derive the wheel name from the same dynamic version source
used in docs/conf.py (for example via a release-based substitution or
conf.py-driven text replacement) instead of embedding the version directly. Make
the change around the pyodide directive and its :packages: entry so the package
path stays in sync with undate.__version__.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 403ff8ff-51b9-4bdb-bcde-350cc9e3bd5e

📥 Commits

Reviewing files that changed from the base of the PR and between 320a13a and 1849db5.

⛔ Files ignored due to path filters (2)
  • docs/_static/undate_logo.svg is excluded by !**/*.svg
  • docs/_static/undate_logo_dark.svg is excluded by !**/*.svg
📒 Files selected for processing (6)
  • docs/_static/custom.css
  • docs/conf.py
  • docs/example_usage.rst
  • docs/index.rst
  • docs/readme.md
  • pyproject.toml
💤 Files with no reviewable changes (1)
  • docs/readme.md

Comment thread pyproject.toml Outdated
rlskoeser added 2 commits July 4, 2026 10:43
Assisted-by: ClaudeCode:claude-sonnet-4-6
Assisted-by: ClaudeCode:claude-sonnet-4-6

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/unit_tests.yml (1)

40-46: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Stale comment above cache config.

Line 40's comment says "use github python action instead of uv to take advantage of caching," but the step below uses astral-sh/setup-uv with its own cache (enable-cache/cache-dependency-glob), not the GitHub-provided actions/setup-python. Worth updating/removing this comment to avoid confusion now that uv caching is explicit.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/unit_tests.yml around lines 40 - 46, The comment above the
Python setup step is stale and no longer matches the actual implementation in
the unit_tests workflow. Update or remove the note near the setup-uv step so it
accurately reflects that the workflow uses astral-sh/setup-uv with explicit
cache settings (enable-cache and cache-dependency-glob), not
actions/setup-python. Refer to the “Set up Python” step in the workflow and keep
the comment aligned with the current caching approach.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/python-publish.yml:
- Around line 28-33: The release workflow currently uses astral-sh/setup-uv with
its default caching behavior, which should be disabled for the PyPI publish job.
Update the Set up uv step to explicitly set enable-cache to false in the
setup-uv configuration so the Build package/publish flow does not use cache in
this workflow.

---

Nitpick comments:
In @.github/workflows/unit_tests.yml:
- Around line 40-46: The comment above the Python setup step is stale and no
longer matches the actual implementation in the unit_tests workflow. Update or
remove the note near the setup-uv step so it accurately reflects that the
workflow uses astral-sh/setup-uv with explicit cache settings (enable-cache and
cache-dependency-glob), not actions/setup-python. Refer to the “Set up Python”
step in the workflow and keep the comment aligned with the current caching
approach.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8dc3b2f8-88e9-4a6c-a013-04f4391b733d

📥 Commits

Reviewing files that changed from the base of the PR and between 1849db5 and 92450b0.

📒 Files selected for processing (4)
  • .github/workflows/check.yml
  • .github/workflows/python-publish.yml
  • .github/workflows/unit_tests.yml
  • pyproject.toml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/check.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml

Comment on lines +28 to +33
- name: Set up uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
python-version: "3.12"
- name: Build package
run: python -m build
run: uv build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

astral-sh/setup-uv action enable-cache default value GitHub Actions

💡 Result:

The default value for the enable-cache input in the astral-sh/setup-uv GitHub Action is "auto" [1][2][3]. When set to "auto," the action automatically enables caching on GitHub-hosted runners and disables it on self-hosted runners [1][2][3]. Other valid values for this input are "true" (to force enable) and "false" (to force disable) [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the workflow file with line numbers around the referenced section.
sed -n '1,120p' .github/workflows/python-publish.yml | cat -n

Repository: dh-tech/undate-python

Length of output: 1605


Disable setup-uv caching in this release workflow. astral-sh/setup-uv defaults to enable-cache: auto, which turns caching on for ubuntu-latest; this job publishes artifacts to PyPI, so set enable-cache: false here.

🧰 Tools
🪛 zizmor (1.26.1)

[error] 29-29: runtime artifacts potentially vulnerable to a cache poisoning attack (cache-poisoning): enables caching by default

(cache-poisoning)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/python-publish.yml around lines 28 - 33, The release
workflow currently uses astral-sh/setup-uv with its default caching behavior,
which should be disabled for the PyPI publish job. Update the Set up uv step to
explicitly set enable-cache to false in the setup-uv configuration so the Build
package/publish flow does not use cache in this workflow.

Source: Linters/SAST tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant