Skip to content
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

Do not add --upgrade flag to generated output file #1814

Closed
hofrob opened this issue Feb 21, 2024 · 2 comments · Fixed by #1873
Closed

Do not add --upgrade flag to generated output file #1814

hofrob opened this issue Feb 21, 2024 · 2 comments · Fixed by #1873
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool good first issue Good for newcomers

Comments

@hofrob
Copy link

hofrob commented Feb 21, 2024

uv and pip-tools both add the full command to the generated output file. When running an upgrade command, uv will add --upgrade too while pip-tools will not.

This flag in particular should be ignored when generating the output file I think. My reasoning is, I'm running pre-commit checks that will only check if the generated file from pyproject.toml is consistent with the requirements.txt in the repo. Since the command does not use --upgrade it will detect a change in the generated output after an upgrade.

Or if I do not execute my hooks, the CI will complain because the files were changed by doing uv pip compile.

pip-tools

pip-compile --upgrade
pip-compile

Both commands will generate the same output file.

uv

uv pip compile pyproject.toml --upgrade --output-file requirements.txt
uv pip compile pyproject.toml --output-file requirements.txt

The generated outputs will be different: the first one will contain the --upgrade flag, the second one won't.

@zanieb zanieb added bug Something isn't working compatibility Compatibility with a specification or another tool good first issue Good for newcomers labels Feb 21, 2024
@hofrob
Copy link
Author

hofrob commented Feb 22, 2024

Another one that's ignored by pip-tools: --quiet

Additionally, this is nothing too serious, but I thought I'd mention it: From what I've seen pip-tools also re-orders the CLI args before creating the output file. So when changing order of the CLI params in our scripts, the generated file is still the same.

I tested this by running pip-compile --strip-extras --quiet --extra-index-url=https://pypi.example.net/.... The command in the requirements.txt will look like this: pip-compile --extra-index-url=https://pypi.example.net/... --strip-extras

@charliermarsh
Copy link
Member

Agreed.

charliermarsh pushed a commit that referenced this issue Feb 23, 2024
…1873)

## Summary

Resolve #1814

I changed the behavior of `pip compile` to not display `--upgrade`
(`-U`) and `--quiet` (`-q`) for compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility Compatibility with a specification or another tool good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants