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

Add UV_CUSTOM_COMPILE_COMMAND support to uv pip compile #2554

Merged
merged 5 commits into from
Mar 20, 2024

Conversation

BakerNet
Copy link
Contributor

@BakerNet BakerNet commented Mar 19, 2024

Summary

This adds support for CUSTOM_COMPILE_COMMAND support to change the header comment in generated requirements files.

See Issue:

From pip-tools docs:

You might be wrapping the pip-compile command in another script. To avoid confusing consumers of your custom script you can override the update command generated at the top of requirements files by setting the CUSTOM_COMPILE_COMMAND environment variable.

Test Plan

See unit test included

Comment on lines +375 to +379
cmd(
include_index_url,
include_find_links,
custom_compile_command
)
Copy link
Contributor Author

@BakerNet BakerNet Mar 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, if you prefer to have it inline:

Suggested change
cmd(
include_index_url,
include_find_links,
custom_compile_command
)
custom_compile_command.unwrap_or(cmd(include_index_url, include_find_links))

and revert the changes in cmd function

Comment on lines +447 to +454
fn cmd(
include_index_url: bool,
include_find_links: bool,
custom_compile_command: Option<String>,
) -> String {
if let Some(cmd_str) = custom_compile_command {
return cmd_str;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If above suggestion, revert

Suggested change
fn cmd(
include_index_url: bool,
include_find_links: bool,
custom_compile_command: Option<String>,
) -> String {
if let Some(cmd_str) = custom_compile_command {
return cmd_str;
}
fn cmd(include_index_url: bool, include_find_links: bool) -> String {

crates/uv/src/main.rs Outdated Show resolved Hide resolved
@zanieb zanieb added the configuration Settings and such label Mar 20, 2024
konstin and others added 2 commits March 20, 2024 12:13
Co-authored-by: Hans Baker <hansbaker90@gmail.com>
Co-authored-by: Hans Baker <hansbaker90@gmail.com>
Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@konstin konstin enabled auto-merge (squash) March 20, 2024 11:13
@konstin konstin merged commit 204b159 into astral-sh:main Mar 20, 2024
31 checks passed
@henryiii
Copy link
Contributor

This adds UV_CUSTOM_COMPILE_COMMAND, not CUSTOM_COMPILE_COMMAND. Both the PR and the release notes state the CUSTOM_COMPILE_COMMAND one, which is the same as pip compile, but this was added with a UV_ prefix.

@henryiii
Copy link
Contributor

(I read the release notes, then couldn't figure out why CUSTOM_COMPILE_COMMAND that was previously set for pip-compile wasn't now working for uv until I read the diff)

@konstin konstin changed the title Add CUSTOM_COMPILE_COMMAND support to uv pip compile Add UV_CUSTOM_COMPILE_COMMAND support to uv pip compile Mar 21, 2024
@konstin
Copy link
Member

konstin commented Mar 21, 2024

Thanks, i updated the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants