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

Support uv compiled requirements files #10040

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove legacy pip stuff I don't mean to mess with
  • Loading branch information
avilaton committed Sep 23, 2024
commit ef182273c39b352c43eb9f744452bc005c54c762
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ def pip_compile_options(filename)
options += uv_pip_compile_options_from_compiled_file(requirements_file)
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @avilaton , looks like you added 2 new functions uv_pip_compile_options_from_compiled_file , pip_compile_options_from_compiled_file in pip_compile_version_resolver.rb, i think they are being referenced from pip_compile_file_updater.rb can you please fix this (IDE is showing it as no function exists in Dependabot::Python::UpdateChecker::PipCompileVersionResolver)

Copy link
Author

Choose a reason for hiding this comment

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

Would be neat to have a way not to repeat this code, it seems to me as if it would be more resilient to have them centralized. What do you suggest we should do?

Copy link
Contributor

Choose a reason for hiding this comment

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

@avilaton , if you think we might benefit from moving them to new location/class and see a additional functionality that could be used across. please do so.

command = "pyenv exec uv pip compile"
else
options += pip_compile_options_from_compiled_file(requirements_file)
command = "pyenv exec pip-compile"
end
end
Expand Down Expand Up @@ -287,30 +286,6 @@ def run_pip_compile_command(command, fingerprint:)
run_command(command, fingerprint: fingerprint)
end

def pip_compile_options_from_compiled_file(requirements_file)
options = ["--output-file=#{requirements_file.name}"]

options << "--no-emit-index-url" unless requirements_file.content.include?("index-url http")

options << "--generate-hashes" if requirements_file.content.include?("--hash=sha")

options << "--allow-unsafe" if includes_unsafe_packages?(requirements_file.content)

options << "--no-annotate" unless requirements_file.content.include?("# via ")

options << "--no-header" unless requirements_file.content.include?("autogenerated by pip-c")

options << "--pre" if requirements_file.content.include?("--pre")

options << "--strip-extras" if requirements_file.content.include?("--strip-extras")

if (resolver = RESOLVER_REGEX.match(requirements_file.content))
options << "--resolver=#{resolver}"
end

options
end

def uv_pip_compile_options_from_compiled_file(requirements_file)
options = ["--output-file=#{requirements_file.name}"]

Expand Down
Loading