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 wheel should provide the name of the resulting file #6340

Open
encukou opened this issue Mar 15, 2019 · 6 comments
Open

pip wheel should provide the name of the resulting file #6340

encukou opened this issue Mar 15, 2019 · 6 comments
Labels
C: wheel The wheel format and 'pip wheel' command type: feature request Request for a new feature

Comments

@encukou
Copy link
Contributor

encukou commented Mar 15, 2019

What's the problem this feature will solve?
We want to adopt PEP 517 & 518 for Fedora, which uses separate build and install phases. We want to run these commands (separately, and as automatically as possible):

  • pip wheel
  • pip install <resulting wheel>

The problem is that while the PEP 517 build_wheel hook returns the basename of the built wheel, pip AFAIK doesn’t share this information any further. We simply don’t know where the built wheel is located.

(Miro asked in packaging Discourse to see if this should go in the non-normative section of PEP 517. The response was that this would be a good feature request for pip, but that's it.)

Describe the solution you'd like
Either:

  • Print the wheel name in some parseable format, like: Resulting wheel: foo-1.2.3-py2.py3-none-any.whl, call this an API, and include tests to ensure it doesn't change.
  • Add a option to name of a file to which the wheel name would be written.

Alternative Solutions
Any other way to get the wheel name from pip would work.
We don't want to guess/construct it ourselves – we feel that should be pip's job to provide the complete name.

Additional

We're happy to provide the PR if y'all agree it would be an improvement.

@pradyunsg pradyunsg added C: wheel The wheel format and 'pip wheel' command type: feature request Request for a new feature labels Mar 15, 2019
@pradyunsg
Copy link
Member

I'm on board for this. Will be happy to see a PR.

@encukou
Copy link
Contributor Author

encukou commented Mar 15, 2019

Do you have a preference on how Pip should provide the info? Parseable line on stdout, option to record it in a file, or something else?

@pradyunsg
Copy link
Member

(Sorry for the terseness)

one-per-line, in a file specified via an optional flag.

PatrikKopkan pushed a commit to PatrikKopkan/pip that referenced this issue May 12, 2019
PatrikKopkan pushed a commit to PatrikKopkan/pip that referenced this issue Jul 14, 2019
PatrikKopkan pushed a commit to PatrikKopkan/pip that referenced this issue Aug 26, 2019
@chrahunt
Copy link
Member

chrahunt commented Nov 2, 2019

I see that this was done in #6377, but I'm kind of curious why we couldn't do something like this instead:

output_dir="$(mktemp -d)"
pip wheel --wheel-dir "$output_dir" ...
find "$output_dir" -type f -print0 | xargs -0 pip install

IMO this ends up being more robust compared to writing the filenames to a file, and avoids issues like:

  • figuring out what encoding pip used to write the file
  • newlines in file paths
  • proliferation of options in pip

@sbidoul
Copy link
Member

sbidoul commented Nov 7, 2019

I had previously resolved a similar use case with a similar approach as @chrahunt example in #6340 (comment).

Recently I was looking at how poetry was handling VCS requirements. I wondered if it poetry could benefit from pip wheel outputting additional information on how it resolved such requirements.

So maybe --save-wheel-names should be generalized to output some sort of JSON data structure that summarize what pip wheel did (in addition to wheel names that were built, one can imagine in the future to report build failures, which commit was resolved for VCS requirements, etc).

@sbidoul
Copy link
Member

sbidoul commented Dec 12, 2019

Following #7420, would you consider an alternative approach that lets pip wheel output a JSON file summarizing what it did?

It could start small (with the list of wheel names it produced), and would be extensible. It could include, for instance, information about direct URL references (e.g. how VCS references were resolved), and possibly in the future it could contain information about the result of the dependency resolution algorithm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: wheel The wheel format and 'pip wheel' command type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

4 participants