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

type(feat): Allow parsing of wheel file paths in requirements.in #2345

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

stridge-cruxml
Copy link

@stridge-cruxml stridge-cruxml commented Oct 25, 2024

I have a .whl file inside my bazel repo. I would like to add this to requirements.in like

path/to/my.whl

Adding extra_data to pip_compile and passing this through is sufficient.
eg

compile_pip_requirements(
  ...
  extra_data = ["//path/to:my.whl"],
)

An issue I came across is pip tools puts the absolute path to the wheel in requirements.txt which isn't great.
So I change the path back to a relative one in dependency_resolver.py

Currenty you need to add labels for install_deps.

install_deps(whl_files = {"pip_my" : Label("//path/to/my.whl")})

Is there a better way to do this?

Copy link

google-cla bot commented Oct 25, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

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

Yeah I think this is as good as we can get here.

If you would like to also add the wiring for bzlmod (e.g. wire pip.override to the whl_library whl_name attribute), then I'd be happy to merge this approach. After all we are planning to release 1.0 at some point soon and bzlmod is a first class citizen.

@stridge-cruxml
Copy link
Author

I fixed the indentation.

I am not going to dedicate more time to this for a while due to other priorities. Existing code I have all uses WORKSPACE still. If there is someone else who would be willing to implement the bzlmod side of things they are most welcome.

@aignas
Copy link
Collaborator

aignas commented Nov 14, 2024

#1689 is the ticket that this PR would fix.

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

Successfully merging this pull request may close these issues.

2 participants