-
-
Notifications
You must be signed in to change notification settings - Fork 629
Update doc builds to pin the 'pip' version and use tox in readthedocs #2218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Doc building currently fails on the latest pip version (25.2). Declare `pip` as a doc dependency and pin it to 25.1.
- Update to `uv` + `tox` + `tox-uv` as the toolchain installed on the RTD worker. This treats `uv` as a way to improve the speed of the CI process without relying on any tool-specific features. - Update tox config slightly to suit RTD usage - Drop the 'pdf' and 'htmlzip' outputs - Update RTD builds to use Python 3.13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changelog needed. This is a set of minor infrastructure tweaks.
@sirosen I would argue that this is exactly what the contrib
change note type is intended for. These are changes that may challenge the contributors' understanding of how RTD is set up, the role of uv
in there et al. But if you feel differently, we can keep it out.
- I used
uv
for the installation on the RTD worker to see how much faster it might be. The reported runtime on this PR was 22s, vs 44s on the last success onmain
. I'm generally happy usingtox
+tox-uv
because it's faster and easy to removeuv
if it ever causes a problem.
Ack, although, there's some tweaks needed to make it integrated better.
- This failed the chronographer check, so I marked it with the default
bot:chronographer:skip
label (newly defined). I think we can simply update our docs to list this and we'll be good. Or we can create a chronographer config -- but I'd rather stick with the defaults unless we have a strong need.
Due to historical reasons, I've kept this default in the bot (it's also more generic). However, a lot of projects have it as skip changelog
or skip news
. And it's best to integrate it with the existing label. Otherwise, we'll end up having to apply a tightly coupled pair of labels. This is going to be inconsistent whenever somebody else applies a label. Alternatively, we could migrate to the bot's label, getting rid of skip-changelog
. Though, I know some people weren't happy with the naming in various projects.
Additionally, we still need the config to point to instructions on RTD from the checks page (https://github.com/jazzband/pip-tools/pull/2218/checks?check_run_id=47304029072).
# pip itself is a requirement, so that we keep the version of it pinned | ||
# for build consistency | ||
pip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that pip
is a direct dependency of the docs infra, though. pip-tools
is. I'd expect this to be something like
# pip itself is a requirement, so that we keep the version of it pinned | |
# for build consistency | |
pip | |
. |
This is because
skip_install = false
intox.ini
—piptools
is being installed, along with all of its dependency tree, not justpip
.sphinxcontrib.apidoc
is integrated inconf.py
(it callssphinx.ext.autodoc
under the hood). This extension effectively imports everything underpiptools
and such imports will fail if the docs venv doesn't have every transitive dep of pip-tools.- The previous RTD config was set up to do
pip install .
directly. - With the above in mind, we should be producing a complete "lock file" as pip constraints in
docs/requirements.txt
, not just includepip
in there, but also all the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, pip
isn't a direct dependency.
I think the breakage is caused by sphinx autodoc picking up some changed data from this class, which inherits from a pip
-provided class. So we need the version of pip
controlled in docs because it's a dependency of pip-tools
.
I'd like to set skip_install = true
and rely on the requirements data all being in docs/requirements.txt
. I'll put this up in my separate PR for the requirements data only and we can discuss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's my understanding of the root cause as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't normally do a skip_install
and try to go for -c
instead..
python: >- | ||
3.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be kept for reproducibility. Eventually, it should become the source of truth for all the docs building envs. Similar to what Hynek has here: https://github.com/hynek/stamina/blob/4832a081aacce48879fd770f9ace02efdf3aa10c/noxfile.py#L43-L47.
@@ -1,5 +1,5 @@ | |||
# | |||
# This file is autogenerated by pip-compile with Python 3.11 | |||
# This file is autogenerated by pip-compile with Python 3.12 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep using the same runtime for now and then perform a bump separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is just an artifact of my default runtime being 3.12 right now, and we're not setting base_python
in the tox environment for pip-compile-docs
. So if I forget to set it explicitly to 3.11, this happens. Should we set base_python = python3.11
in tox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I feel like that's going stale over time. I don't like having many hardcoded places for the same data. Let's not change it for now.
# - Python 3.13 | ||
# - tox (with tox-uv) | ||
- curl -LsSf https://astral.sh/uv/install.sh | sh | ||
- ~/.local/bin/uv tool install tox --with tox-uv -p "3.13" --managed-python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only noticed now that this attempts using Python 3.13 while the deptree is pinned with Python 3.12, while it used to be Python 3.11.
We should settle on having a single machine-readable runtime config to use in all places.
Additionally, could you use a long version of -p
here?
# install uv and use it to get | ||
# - Python 3.13 | ||
# - tox (with tox-uv) | ||
- curl -LsSf https://astral.sh/uv/install.sh | sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not happy about the curl | sh
pattern in here. Can't we just use asdf
or whatever other dep management tooling is pre-installed in the VMs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can do it pretty easily with asdf
. We can also use the provided virtualenv and pip install uv
as a way of getting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever's fastest I guess..
# a complete clone is needed for setuptools-scm, and this is the method recommended by RTD | ||
# ( https://rtd-with-docsearch.readthedocs.io/en/latest/build-customization.html#unshallow-git-clone ) | ||
- git fetch --unshallow || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already included in the tox env. No need to duplicate the effort.
# a complete clone is needed for setuptools-scm, and this is the method recommended by RTD | |
# ( https://rtd-with-docsearch.readthedocs.io/en/latest/build-customization.html#unshallow-git-clone ) | |
- git fetch --unshallow || true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also move git fetch
commands around line 76 into commands_pre
? I've been doing this everywhere but haven't synced this project, it seems. Although, we could do this separately as it'd affect other docs envs as well...
formats: | ||
- htmlzip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're loosing these with the update. That's another thing we could mention in the change note.
Alternatively, we could try reproducing the same commands that RTD injects to get these outputs.
\t$ python3 -m http.server --directory \ | ||
\N\{QUOTATION MARK\}\{docs_dir\}\N\{QUOTATION MARK\} 0\n\n" +\ | ||
"=" * 120)' | ||
{posargs:{envdir}/docs_out} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you didn't migrate the -t is_unversioned
bit. This is fine for now as it's out of the scope, but would be good to do in a follow-up. It's particularly useful when setuptools-scm
is used as the version string being dynamic prevents Sphinx from reusing cache and we can optimize it by setting it to something static in local dev envs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we could decouple reconfiguring docs/requirements.*
from changing the RTD integration? docs/requirements.txt
is already integrated into both places so fixing it being incomplete would be an atomic change by itself. And it'd unblock any other PRs that may be happening in parallel, while we polish the integration bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let me split it off. That's the part that I felt didn't need a changelog entry.
But I agree that some of the other bits may warrant a contrib note.
@sirosen does this need a rebase? |
I've been meaning to get back to some of the other work in pip-tools, but I forgot entirely about this particular PR. I think a rebase and some basic cleanup is something I can do here after my workday. I should re-title the PR as well, seeing as I split #2219 from this. |
No changelog needed. This is a set of minor infrastructure tweaks.
Notes
uv
for the installation on the RTD worker to see how much faster it might be. The reported runtime on this PR was 22s, vs 44s on the last success onmain
. I'm generally happy usingtox
+tox-uv
because it's faster and easy to removeuv
if it ever causes a problem.bot:chronographer:skip
label (newly defined). I think we can simply update our docs to list this and we'll be good. Or we can create a chronographer config -- but I'd rather stick with the defaults unless we have a strong need.Contributor checklist
changelog.d/
(seechangelog.d/README.md
for instructions) or the PR text says "no changelog needed".Maintainer checklist
skip-changelog
label.