Skip to content

Conversation

@mhucka
Copy link
Member

@mhucka mhucka commented Dec 15, 2025

This PR adds a few more constraints in requirements.in on development dependencies that have come to light from further testing on different environments, and removes some entries that were for requirements that are not essential and whose handling needs further thought.

In addition, this updates scripts/generate_requirements.sh to deal with a shortcoming of generating requirements.txt using pip-compile. The versions of some transitive dependencies may need to be updated to address security releases, but simply re-running pip-compile to produce a new requirements.txt may not update the versions because the dependencies that bring in the transitive dependencies have not themselves changed. The recommended practice for this situation is to put such version constraints into a separate constraint file and pass it as an argument to pip-compile. (pip-compile has explicit support for this.) Some additions to the script scripts/generate_requirements.sh encapsulate and document this process.

In addition, I removed some no-longer-needed post-processing of the requirements.txt file from scripts/generate_requirements.sh. It was a hack in the first place, and with the latest requirements.in, it turns out to be unnecessary. While at it, I simplified the script some more and made it follow more style guidelines for Bash scripts.

The python_version actually means the constraint only applies to that
Python version. We need the packages installed no matter the Python
version; we just need the constraint on Python < 3.11. It's simpler and
still works to not add the python_version, so let's just remove them.

In addition, this removes constraints that should belong elsewhere, to
keep the requirements.txt file leaner.
A shortcoming of generating requirements.txt with version pins is that
the versions of some transitive dependencies may need to be updated to
address security releases. Simply re-running pip-compile to produce a
new requirements.txt may not update the versions because the
dependencies that bring in the transitive dependencies have not
themselves changed. The recommended practice for this situation is to
put the version constraints into a separate constraint file and pass it
as an argument to pip-compile. (pip-compile has explicit support for
this.) Some additions to the script scripts/generate_requirements.sh
encapsulate and document this process.

In addition, I removed some no-longer-needed post-processing of the
requirements.txt file. It was a hack in the first place, and with the
latest requirements.in, it turns out to be unnecessary.

Finally, I simplified this some more and made it follow more style
guidelines for Bash scripts.
This is the output of running pip-compile on requirements.in.
This file is used to constrain the versions of transitive dependencies
during the `pip-compile` process. This is the recommended way to apply
security patches without polluting `requirements.in`.
@mhucka mhucka marked this pull request as ready for review December 15, 2025 06:14
@mhucka mhucka changed the title Further constrain dependency versions in setup.py and requirements.txt Further constrain dependency versions in requirements.txt Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant