Skip to content

Conversation

@p2edwards
Copy link
Contributor

@p2edwards p2edwards commented Dec 17, 2025

💭 Notes

Fix uv modifications to pip-compile.sh, updating requirements.txt correctly.

Previously, pip-compile.sh would only print to stdout, and it would not take the existing package versions in requirements.txt into consideration. (#6467)

The --output-file fix

Pass --output-file (or -o) to uv pip compile.

Crucially, --output-file also acts as an input. Without it, the original requirements.txt is ignored, so a lot of packages would get updated instead of staying the same.

# ❌ effectively a no-op ⚠️ ignores requirements.txt, prints to STDOUT
uv pip compile requirements.in

# ❌ regenerates the resolutions from scratch  # ⚠️ upgrades everything
uv pip compile requirements.in > requirements.txt

# ✅ reads both files, updates requirements.txt
uv pip compile requirements.in --output-file requirements.txt

By naming the output file explicitly, we match pip-tools behavior, which retains existing package versions.

# ✅ both act as expected, update corresponding requirements.txt
pip-compile requirements.in
uv pip compile requirements.in -o requirements.txt

Cosmetic output differences from uv

Slight change to how this looks:

- git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on
+ django-dont-vary-on @ git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on

Some stuff gets moved around (sorted differently):

  # This file was autogenerated by uv via the following command:
  #    uv pip compile dependencies/pip/dev_requirements.in --output-file dependencies/pip/dev_requirements.txt --no-strip-extras --no-emit-package setuptools
- git+https://github.com/kobotoolbox/django-digest@3995226ed8e5bd1cb32c640aae970f8c104f6156#egg=django_digest
-     # via -r dependencies/pip/requirements.in
- git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on
-     # via -r dependencies/pip/requirements.in
-

  …
  django-debug-toolbar==4.3.0
      # via -r dependencies/pip/requirements.in
+ django-digest @ git+https://github.com/kobotoolbox/django-digest@3995226ed8e5bd1cb32c640aae970f8c104f6156#egg=django_digest
+     # via -r dependencies/pip/requirements.in
+ django-dont-vary-on @ git+https://github.com/trevoriancox/django-dont-vary-on.git@01a804122b7ddcdc22f50b40993f91c27b03bef6#egg=django-dont-vary-on
+     # via -r dependencies/pip/requirements.in
  django-environ==0.11.2
      # via -r dependencies/pip/requirements.in
  django-extensions==3.2.3

uv adds this whitespace in the extras list:

- django-storages[azure,boto3]==1.14.2
+ django-storages[azure, boto3]==1.14.2

More arguments: --no-strip-extras and --no-emit-package setuptools

To better match pip compile output with what we had already, I added 2 more arguments, --no-strip-extras and --no-emit-package setuptools.

Without these, requirements.txt would differ (aligning with pip-tools >=8).

  • "extras" would be stripped, e.g.
    - django-storages[azure,boto3]==1.14.2
    + django-storages==1.14.2
  • setuptools would be installed (where before it was excluded as "unsafe").

Mystery addition: funcsigs==1.0.2 via begins

I'm not sure why uv resolved this and pip-tools didn't:

+ funcsigs==1.0.2
+     # via begins

Perhaps it's not needed…

funcsigs is a backport of the PEP 362_ function signature features from Python 3.3's inspect_ module. …
https://pypi.org/project/funcsigs/

It appears even if you add --python-version 3.10.

👀 Preview steps

  1. 🔴 [on main] Run ./pip-compile.sh.
    • 🔴 Notice that ./pip-compile.sh writes to STDOUT only
  2. 🟢 [on PR] Run ./pip-compile.sh. Notice that ./pip-compile.sh:
    • 🟢 writes to dependencies/pip/requirements.txt and dependencies/pip/dev_requirements.txt
    • has some formatting differences
    • does not upgrade packages unless you tell it to (with the --upgrade or --upgrade-package <PACKAGE>, or by modifying a pinned version in *.in)
  3. 🟢 [on PR] Verify that kobo runs as expected with the new requirements.txt and dev_requirements.txt.

- Add arg to write output file (instead of stdout)
- Add args to match pip-tools<=7 defaults
I had isolated the sorting changes from the parent commit
(721cf48) to produce a nicer diff
for code review.

But here is the actual output from uv.

It sorts the git+https dependencies to be among the rest of the
dependencies (instead of a separate block at the top).

Future runs of pip-compile.sh would match this.
@p2edwards p2edwards changed the title Fix uv invocation in pip-compile.sh; output *.txt Fix uv in pip-compile.sh Dec 18, 2025
@p2edwards p2edwards self-assigned this Dec 18, 2025
@p2edwards p2edwards requested a review from rgraber December 18, 2025 20:53
@p2edwards p2edwards marked this pull request as ready for review December 18, 2025 20:54
@p2edwards p2edwards added workflow Related to development process Back end labels Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Back end workflow Related to development process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants