[DO NOT MERGE] Test submodule bump docs refresh - #4444
Conversation
There was a problem hiding this comment.
Code Review
This pull request vendors OpenROAD documentation files into the repository to enable offline, reproducible Sphinx builds instead of fetching them dynamically from GitHub. It introduces scripts to refresh and verify these vendored files, updates Python and Sphinx dependencies using uv, and adjusts build configurations. The review feedback suggests moving a local shutil import to the top of docs/conf.py to comply with PEP 8 and refactoring %-formatting to f-strings in the Python scripts for better readability.
| # Create a copy of the index.md file | ||
| import shutil | ||
|
|
||
| shutil.copy("index.md", "index2.md") |
There was a problem hiding this comment.
The shutil module is used here, but it's imported locally within the setup function. According to the PEP 8 style guide, imports should be at the top of the file. Please move import shutil to the top of docs/conf.py with the other imports to improve code organization and maintainability.
References
- PEP 8: Imports should usually be on separate lines and at the top of the file, just after any module comments and docstrings, and before module globals and constants. (link)
| problems.append( | ||
| "the vendored OpenROAD docs are stale:\n" | ||
| " %s says sha = %s\n" | ||
| " git rev-parse HEAD:%s = %s\n" | ||
| " The tools/OpenROAD submodule was bumped without re-vendoring " | ||
| "the documentation it ships. Fix with: %s" | ||
| % ( | ||
| SOURCE_JSON.relative_to(REPO_ROOT), | ||
| vendored, | ||
| SUBMODULE_PATH, | ||
| pinned, | ||
| REFRESH_CMD, | ||
| ) | ||
| ) |
There was a problem hiding this comment.
Throughout this script and refresh_openroad_docs.py, you're using %-formatting for strings. While this works, f-strings are generally preferred in modern Python (3.6+) for their improved readability and performance.
Consider refactoring these string formatting calls to use f-strings.
For example, this block could be rewritten as:
problems.append(
f"the vendored OpenROAD docs are stale:\n"
f" {SOURCE_JSON.relative_to(REPO_ROOT)} says sha = {vendored}\n"
f" git rev-parse HEAD:{SUBMODULE_PATH} = {pinned}\n"
f" The tools/OpenROAD submodule was bumped without re-vendoring "
f"the documentation it ships. Fix with: {REFRESH_CMD}"
) problems.append(
f"the vendored OpenROAD docs are stale:\n"
f" {SOURCE_JSON.relative_to(REPO_ROOT)} says sha = {vendored}\n"
f" git rev-parse HEAD:{SUBMODULE_PATH} = {pinned}\n"
f" The tools/OpenROAD submodule was bumped without re-vendoring "
f"the documentation it ships. Fix with: {REFRESH_CMD}"
)References
- PEP 498 introduced f-strings, which are a more readable, concise, and less error-prone way of formatting strings in Python compared to older methods like %-formatting. (link)
cf25d15 to
ae9f039
Compare
conf.py fetched three files from OpenROAD master at build time and spliced them with regex guarded by bare assert. A heading rename upstream broke the build with a message naming neither file nor fix, python -O stripped the guard entirely, and the docs tracked master rather than the pinned tools/OpenROAD submodule. Sources are vendored at the submodule SHA under docs/_vendor and refreshed by the existing update-OR cron job, so the build makes no network calls and check_vendored_docs.py fails the submodule bump instead of the docs build. Only the Supported Operating Systems section of index.md is vendored, not the whole landing page: conf.py consumes nothing else, and the surrounding prose trips this repo's blocked-content check. Vendored copies keep upstream trailing whitespace so the refresh stays idempotent, so .gitattributes exempts them from whitespace checking. Drops docs/SupportedOS, which Sphinx published as an orphan copy of OpenROAD's landing page. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Read the Docs default runtime moved past 3.10; pydata-sphinx-theme's pinned Sphinx no longer builds under 3.13+, so pin RTD to 3.12 explicitly instead of trusting the default. pip-compile has a compatibility bug with recent pip, so lock regeneration now uses `uv pip compile`. Unpin sphinx-external-toc in requirements.in so uv can resolve a compatible version, and regenerate requirements_lock.txt accordingly. Add `make venv` (docs/Makefile) to encapsulate venv creation + locked-deps install, since the interpreter and lock tool are no longer implied by a bare `pip install`. Exclude `build`, `.venv*`, and `venv` in conf.py so a local virtualenv or prior build output isn't picked up as source on a second run. Add `.venv/` to .gitignore. Update docs/README.md to match the new venv/lock workflow. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Two-workflow split so it works for external fork PRs too, not just same-repo branches: an untrusted pull_request job (no secrets) refreshes docs/_vendor/openroad/ against any PR that bumps tools/OpenROAD and uploads a patch if one is needed; a trusted workflow_run job pushes that patch onto the PR branch using the openroad-ci bot's PAT (works on forks via "Allow edits by maintainers"), falling back to a PR comment (via the default token, no PAT needed for that half) with the patch attached if that's disabled. workflow_dispatch is a manual escape hatch, since workflow_run only activates once this file is on the default branch. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Disposable branch to verify the docs-refresh GHA workflows. Not meant to merge; dropping Jenkinsfile so it doesn't trigger an unrelated Jenkins CI build. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
Manual submodule bump to a real upstream SHA with a genuine docs/_vendor content diff (src/utl/README.md), to exercise the docs-refresh GHA workflows end to end. Signed-off-by: Vitor Bandeira <vvbandeira@precisioninno.com>
ae9f039 to
4d42914
Compare
No description provided.