Repository navigation
Allow building docs with a local sphinx_airflow_theme checkout - #75001
Conversation
potiuk
left a comment
There was a problem hiding this comment.
Thanks — being able to test unreleased theme changes against the real docs build is useful. A few things before this can go in:
Likely blocker
scripts/ci/docker-compose/mount-sphinx-airflow-theme.ymlmounts the theme withread_only: true, butrun_docs_build.shthen runsuv pip install --reinstall /opt/sphinx_airflow_theme. The theme is a setuptools project, and building it from a source directory writes*.egg-info/build/into that directory, so the install should fail with "Read-only file system" and abort the docs build (set -euo pipefail). Has this been run end-to-end with a real airflow-site checkout? Copying the tree to a temp dir inside the container and installing from the copy keeps the checkout clean and avoids the problem.
Behaviour
--no-depsmeans a theme change that adds or bumps a dependency is silently installed without it, so the local build can diverge from what the released theme would produce.- With
--sdk-docs-only,--sphinx-airflow-theme-pathis validated and then ignored without any message. Either pass it through or reject the combination. - The
sphinx_airflow_theme/static/_gencheck lives in the command body and ends insys.exit(1). A clickcallback=on the option raisingclick.BadParameterwould give a standard usage error and keep the validation next to the option. It would also help to say explicitly in the help text that the path is thesphinx_airflow_themesub-folder, not the airflow-site repo root, which is what most people will pass first. run_docs_build.shdecides whether to install by checking that/opt/sphinx_airflow_themeexists, and that path is also hard-coded in the compose file. Gating onSPHINX_AIRFLOW_THEME_PATH(already exported by Breeze) would keep a single source of truth.
Tests
- The
docker_mocksfixture useswith patch.multiple(...); the repo convention prefers@mock.patchdecorators. TestBuildDocsSphinxAirflowThemeduplicates the Docker stubbing already inTestBuildDocsPythonVersion. A shared fixture would remove the duplication, and redirectingAIRFLOW_ROOT_PATHtotmp_paththere would stop the older class touching the realgenerated/tree.test_theme_path_is_passed_to_shell_paramsshould assertresult.exit_code == 0before readingcall_args, otherwise an unrelated failure either passes silently or surfaces as anAttributeError.
Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting
Andrushika
left a comment
There was a problem hiding this comment.
Thanks! Left some comments.
We might need a follow-up issue for autobuild before merge, since closes: #45576 closes the issue and autobuild was asked for on #70139.
279d4a6 to
8cec2d9
Compare
|
Thanks for the reviews. The branch is rebased onto main, and the changes are in e721ac9..8cec2d9. Review summary points, in order:
Follow-up issue for the auto-rebuild mode asked for on #70139: #75374. Drafted-by: Claude Code (Opus 5.5); reviewed by @shahar1 before posting |
8cec2d9 to
61758b6
Compare
Changes to the docs theme live in airflow-site, and the only way to see them on real Airflow documentation was to build a wheel by hand, copy it into the Airflow checkout and install it inside Breeze before building. Add a --sphinx-airflow-theme-path option to breeze build-docs. Breeze mounts the given theme folder read-only into the container and installs it there before the build, so an unreleased theme can be checked on the real docs, locally or from airflow-site's own scripts and CI. The folder must contain the generated theme assets, otherwise the build would be silently unstyled. closes: apache#45576
- Reinstall only the theme with --reinstall-package (keeps new theme dependencies) and gate the install on SPHINX_AIRFLOW_THEME_PATH. - Validate the theme path in a click callback raising BadParameter and clarify in the help that it is the sphinx_airflow_theme sub-folder. - Reject --sphinx-airflow-theme-path together with --sdk-docs-only. - Share one autospecced Docker-stubbing fixture between the build-docs tests, redirect AIRFLOW_ROOT_PATH to tmp_path, and tighten the theme tests.
The two rejection tests now check the error text, so they fail without the new option.
prepare-theme copies the existing dist bundle, so edited SCSS/JS only reach _gen after build-landing-pages.
apache/airflow-site#1691 makes prepare-theme rebuild the landing pages when their SCSS/JS sources changed, so the note would be wrong once it lands. The recommended command works with old and new site.sh.
61758b6 to
0b4ad71
Compare
Backport successfully created: v3-4-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
…ckout (apache#75001) (cherry picked from commit 602e150) Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
…ckout (apache#75001) (cherry picked from commit 602e150) Co-authored-by: Shahar Epstein <60007259+shahar1@users.noreply.github.com>
closes: #45576
As titled, this PR adds an option to mount
airflow-site/sphinx_airflow_themewhen running CI locally.AI Summary
Changes to the docs theme live in `airflow-site`, so checking them on real Airflow documentation meant building a wheel by hand and force-installing it inside a Breeze shell. This adds `--sphinx-airflow-theme-path` to `breeze build-docs`: the given `sphinx_airflow_theme` sub-folder of an `airflow-site` checkout is mounted read-only into the docs container and installed there before the build, so neither checkout nor `uv.lock` changes. The theme builds with `flit_core`, which does not write into the source folder, so the read-only mount is enough. Only the theme is reinstalled; a dependency the theme adds is installed with it.The option fails with a usage error before any Docker work when the folder has no generated CSS/JS (
./site.sh prepare-themenot run, or theairflow-siteroot passed instead of the sub-folder), since the docs would otherwise build without styles. It also fails when combined with--sdk-docs-only, because the SDK docs do not use the Sphinx theme.Verified locally with Docker: a marker added to the local theme's
layout.htmlappears in the built HTML and is absent without the option. The install command was also checked against a read-only copy of the theme in the CI image. The Breeze tests forbuild-docsnow share one Docker-free fixture that pointsAIRFLOW_ROOT_PATHto a temporary folder; before, the existing Python-version test deleted the realgenerated/**/apisfolders. The companionairflow-sitechange adds./site.sh build-airflow-docsand an informational CI preview on top of this option.Not included:
--autobuildwith automatic rebuild when the mounted theme files change (raised on #70139); tracked in #75374.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 5.5) following the guidelines
🤖 Generated with Claude Code