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

Autogenerated command string in requirements.txt missing --upgrade flag #1461

Closed
tomjhunt13 opened this issue Aug 2, 2021 · 7 comments
Closed
Labels
writer Related to results output writer component

Comments

@tomjhunt13
Copy link

Running the command pip-compile --no-emit-index-url --no-emit-trusted-host --upgrade --output-file=requirements.txt requirements.in creates the requirements.txt file, but the command that is printed at the top is missing the --upgrade flag. Ideally it would copy all the input parameters so that the whole string can be copied and pasted at a later date without needing to recall each parameter.

Environment Versions

  1. OS Type: Windows
  2. Python version: $ python -V: 3.7
  3. pip version: $ pip --version: 21.1.3
  4. pip-tools version: $ pip-compile --version: 6.2.0

Steps to replicate

  1. Create a requirements.in file with some arbitrary requirements.
  2. Run pip-compile --no-emit-index-url --no-emit-trusted-host --upgrade --output-file=requirements.txt requirements.in

Expected result

  1. A requirements.txt file is generated with the command that was run printed in full at the top

Actual result

  1. A requirements.txt file with pip-compile --no-emit-index-url --no-emit-trusted-host --output-file=requirements.txt requirements.in (missing --upgrade) printed at the top
@atugushev
Copy link
Member

atugushev commented Aug 2, 2021

It's a deliberate decision to skip --upgrade option in the pip-compile header. Pip-tools considers it as a one-off option. See details in the description of #800.

@tomjhunt13
Copy link
Author

I see, thanks for the fast reply. Can I ask why it's considered one-off? Maybe I have an unusual use case, but I only run pip-compile with the --upgrade option. The reason I use pip-compile is to either to add additional dependencies from an updated requirements.in file or (more commonly) to upgrade direct and indirect dependencies in response to a vulnerability indicated by tools such as Snyk.

@atugushev
Copy link
Member

I guess it's to make requirement.txt less noisy in VCS when you upgrade dependencies occasionally. For example, --upgrade-pakage="django==3.2.3" option is not expected in the header after pip-compile run, since it's a one-off operation. The same principle applied to --upgrade option for most cases.

@atugushev
Copy link
Member

I'll close this based on the above, but please let us know if it doesn't resolve your issue. Thanks!

@atugushev atugushev added the writer Related to results output writer component label Sep 18, 2021
@Nao83
Copy link

Nao83 commented Dec 8, 2021

I have the same issue. My company requires to keep our dependencies to the latest possible version, so we always run pip-compile with --upgrade

Developers normally copy the command from the requirements.txt to guarantee consistency, but this doesn't lead to the expected behaviour.

@atugushev
Copy link
Member

Developers normally copy the command from the requirements.txt to guarantee consistency, but this doesn't lead to the expected behaviour.

@Nao83 you might find useful env COMPILE_COMMAND to control this.

@Nao83
Copy link

Nao83 commented Oct 1, 2022

Thanks, that's nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
writer Related to results output writer component
Projects
None yet
Development

No branches or pull requests

3 participants