Skip to content

Manage docs build with a dep group - #27843

Merged
woodruffw merged 15 commits into
mainfrom
ww/docs
Aug 18, 2026
Merged

woodruffw merged 15 commits into
mainfrom
ww/docs

Conversation

@woodruffw

Copy link
Copy Markdown
Member

Summary

Like astral-sh/ty#4315

Test Plan

NFC, tested locally.

@woodruffw woodruffw self-assigned this Aug 18, 2026
@woodruffw woodruffw added the internal An internal refactor or improvement (not for changelogs) label Aug 18, 2026
Comment thread pyproject.toml Resolved
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@woodruffw
woodruffw marked this pull request as ready for review August 18, 2026 18:14
@woodruffw
woodruffw requested a review from AlexWaygood August 18, 2026 18:14
Comment thread docs/requirements.txt Resolved

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not totally sure about tool.uv.sources.ruff = {workspace = true}. LGTM otherwise.

Comment thread pyproject.toml Resolved
Comment thread .github/workflows/ci.yaml Outdated
run: uv pip install -r docs/requirements.txt
- name: "Update README File"
run: python scripts/transform_readme.py --target mkdocs
run: uv run --only-group=docs python scripts/transform_readme.py --target mkdocs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does this also work?

Suggested change
run: uv run --only-group=docs python scripts/transform_readme.py --target mkdocs
run: uv run --only-group=docs scripts/transform_readme.py --target mkdocs

(and etc. for the other script invocations)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That actually produces a surprising error:

uv run --only-group=docs scripts/transform_readme.py --target mkdocs                                                                                                                     
error: Group `docs` is not defined in the project's `dependency-groups` table

I would have expected that to work though, maybe @zanieb understands why not?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

scripts/pyproject.toml exists

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, doing uv run python <script> absolutely indicates a problem lol we should not do that

@AlexWaygood AlexWaygood Aug 18, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think basically every single-file script in scripts should be modernised as a PEP-723 script and we should delete scripts/pyproject.toml, the whole structure predates uv support for PEP-723

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also, doing uv run python <script> absolutely indicates a problem lol we should not do that

It might make sense to have a warning for that? I wasn't aware we had an idiom around it.

Comment thread pyproject.toml Resolved
Signed-off-by: William Woodruff <[email protected]>
@astral-sh-bot

astral-sh-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@astral-sh-bot

astral-sh-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 97.68%. The percentage of expected errors that received a diagnostic held steady at 93.44%. The number of fully passing files held steady at 109/136.

Comment thread .github/workflows/ci.yaml Resolved
@astral-sh-bot

astral-sh-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

Comment thread scripts/check_ecosystem.py Resolved
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@woodruffw
woodruffw requested a review from MichaReiser as a code owner August 18, 2026 18:50
Comment thread scripts/_utils.py Resolved
@woodruffw

Copy link
Copy Markdown
Member Author

I think ./scripts/benchmarks/pyproject.toml is also stale, but I'm not going to touch it in this PR since it's only used for manual comparative benchmarks.

Signed-off-by: William Woodruff <[email protected]>
@zaniebot

Copy link
Copy Markdown
Contributor

check_docs_formatted.py --generate-docs now fails because its isolated environment contains Ruff, but it imports generate_mkdocs, which needs mdformat. Could we invoke the generator through its own locked PEP 723 environment?

@woodruffw

Copy link
Copy Markdown
Member Author

check_docs_formatted.py --generate-docs now fails because its isolated environment contains Ruff, but it imports generate_mkdocs, which needs mdformat. Could we invoke the generator through its own locked PEP 723 environment?

We might also just want to delete the --generate-docs option entirely, since our CI flows don't seem to use it. Opinions @AlexWaygood?

@woodruffw

Copy link
Copy Markdown
Member Author

(I'll preserve it for now but can remove.)

Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@AlexWaygood

Copy link
Copy Markdown
Member

We might also just want to delete the --generate-docs option entirely, since our CI flows don't seem to use it. Opinions @AlexWaygood?

I think it has been literally years since I tried to build Ruff's docs since I work almost exclusively on ty now, but I can see this potentially being useful if you're running the script locally? I'd defer to @ntBre and/or @dhruvmanila, but would lean towards keeping it for now

@AlexWaygood AlexWaygood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks so much for doing this!

Comment thread .github/workflows/ci.yaml Resolved
Comment thread .github/workflows/ci.yaml Resolved
Comment thread .github/workflows/publish-docs.yml Resolved
Comment thread .github/workflows/ci.yaml Outdated
Comment on lines +980 to +984
run: uv run --script scripts/transform_readme.py --target mkdocs
- name: "Generate docs"
run: python scripts/generate_mkdocs.py
run: uv run --script scripts/generate_mkdocs.py
- name: "Check docs formatting"
run: python scripts/check_docs_formatted.py
run: uv run --script scripts/check_docs_formatted.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think --script is unnecessary if the file you're passing as a positional argument has PEP-723 metadata in it (but it doesn't really matter much)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep, please don't include it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This would be another good one for us to maybe warn on, if there's an idiom we have (I wasn't aware)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Our repo AGENTS.md also has this in it:

  • Avoid running uv run for any scripts from the repository root unless you use --no-project, --script or similar. Using uv run from the Ruff repo root without these flags will build Ruff from source, which is very slow and usually unnecessary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah that's just wrong, we should use PEP 723 scripts throughout instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that was added to AGENTS.md by an earlier, confused version of me

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

kk, I'll do a follow on PR for that.

@ntBre

ntBre commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

I have apparently used this --generate-docs option in the past based on one of my justfiles, so I guess I would lean toward keeping it too, but I build the docs infrequently enough that I usually just have Codex figure it out. If it's a pain to keep, it seems okay to delete. I know I was confused by that flag's extra dependencies on a recent contributor PR.

@woodruffw

Copy link
Copy Markdown
Member Author

I have apparently used this --generate-docs option in the past based on one of my justfiles, so I guess I would lean toward keeping it too, but I build the docs infrequently enough that I usually just have Codex figure it out. If it's a pain to keep, it seems okay to delete. I know I was confused by that flag's extra dependencies on a recent contributor PR.

Thx, removing!

woodruffw and others added 3 commits August 18, 2026 16:44
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
Comment thread .github/workflows/ci.yaml Resolved
Signed-off-by: William Woodruff <[email protected]>
@woodruffw
woodruffw enabled auto-merge (squash) August 18, 2026 20:52
@woodruffw
woodruffw merged commit 7ed8d1f into main Aug 18, 2026
75 of 76 checks passed
@woodruffw
woodruffw deleted the ww/docs branch August 18, 2026 20:56
zanieb added a commit that referenced this pull request Aug 18, 2026
Release workflows can restore shared GitHub caches through the docs Rust
cache, automatic tool caching, and Docker builds. Remove the docs Rust
cache and Docker GitHub cache configuration, and explicitly disable the
known cache clients in binary builds and publishing jobs. Unrelated test
and benchmark caches are unchanged.

Port of astral-sh/uv#21168. This preserves the docs dependency-group
migration from #27843 and disables caching on its replacement `setup-uv`
step.

Co-authored-by: Zanie Blue <[email protected]>
zanieb pushed a commit that referenced this pull request Aug 19, 2026
Python tooling can currently build third-party source distributions. Set
`no-build` in the maintained Python projects and PEP 723 scripts,
retaining named exceptions for Git-pinned tooling and the local
ecosystem runner. Pin the isolated build dependencies for those
exceptions, including their transitive requirements.

Follows merged #27856, which gives the legacy `ruff-lsp`
suite a dedicated, locked Python 3.12 test environment.

Follow-up to #27843. Replaces #27840, which
closed when the merged docs branch was deleted.

Co-authored-by: zaniebot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement (not for changelogs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants