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

pip compile: exclude --upgrade-package when option and value are passed as a single argument #5033

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

skshetry
Copy link
Contributor

@skshetry skshetry commented Jul 13, 2024

This excludes --upgrade-package from compile_command when value and option are passed as a single argument. Eg:

--upgrade-package=package
-P=package
-Ppackage

I missed this on #5032.
Fixes #5031.

Test Plan

Tested locally

@skshetry skshetry changed the title pip compile: exclude --upgrade-package when options and values are pa… pip compile: exclude --upgrade-package when option and value are passed as a single argument Jul 13, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) July 13, 2024 16:47
@charliermarsh charliermarsh merged commit e8c1688 into astral-sh:main Jul 13, 2024
49 checks passed
@skshetry skshetry deleted the exclude-upgrade-package-header branch July 13, 2024 16:53
@charliermarsh
Copy link
Member

Thank you!

@charliermarsh charliermarsh added the compatibility Compatibility with a specification or another tool label Jul 13, 2024
charliermarsh pushed a commit that referenced this pull request Jul 16, 2024
)

I messed up the order of checks in #5033, due to which it failed to
exclude the case of `-P package`, as `arg.startswith("-P")` check came
first and skipped only the first argument.

That means that, in the following command:
```console
uv pip compile --output-file pip_compile_uv_header.txt unpinned_uv.in -P attrs==18.1.0
```

The generated header would exclude `-P`, but keep `attrs==18.1.0`.

```plaintext
# This file was autogenerated by uv via the following command:
#    uv pip compile --output-file pip_compile_uv_header.txt unpinned_uv.in attrs==18.1.0
```

But we want to check for an exact match first and then only check for
the case when option and value are together.

This also affected `--find-links` short option of style `-f <uri>`.


Hopefully, third times going to be a charm. 😳 


<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan

<!-- How was it tested? -->

I tested locally, and also changed one snapshot test to use `-P` for
variation. I don't think it's worth an extra test, but can do that for
sure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv pip compile should exclude --upgrade-package in the header
2 participants