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

Validate build dependencies when using --no-build-isolation #9794

Closed
mariocj89 opened this issue Apr 8, 2021 · 5 comments · Fixed by #10886
Closed

Validate build dependencies when using --no-build-isolation #9794

mariocj89 opened this issue Apr 8, 2021 · 5 comments · Fixed by #10886
Assignees
Labels
state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature

Comments

@mariocj89
Copy link

mariocj89 commented Apr 8, 2021

What's the problem this feature will solve?

Prevent builds from running when all required build dependencies are not present.

Describe the solution you'd like

pip fails to build with a descriptive message when a build dependency is missing, providing a nicer user experience (IMHO).

Alternative Solutions

  1. Use python-build which does exactly that.
  2. Manually parse pyproject.toml + generate egg info, get additional build requires and validate those are in the environment.

Additional context
I see the pip docs on --no-build-isolation state "Build dependencies specified by PEP 518 must be already installed if this option is used.". I was wondering whether pip would like to mimic the behaviour that python-build has on --no-isolation(Fail nicely if build dependencies are not present) and if so I'm happy to try and push a patch.

Related: #6718

@uranusjr
Copy link
Member

uranusjr commented Apr 9, 2021

A sanity check to make sure the user actually sets up the environment correctly makes sense to me.

@nchepanov
Copy link
Contributor

@mariocj89 and I are interested in helping out with this,
@uranusjr @pradyunsg please make sure to tag the issue appropriately?

@uranusjr uranusjr added state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature labels Apr 27, 2021
@nchepanov
Copy link
Contributor

@uranusjr @pradyunsg would you be able to please give a few pointers on where I should start looking in the code and what this change is going to look like?

@pradyunsg
Copy link
Member

https://github.com/pypa/pip/blob/main/src/pip/_internal/operations/build/wheel.py and https://github.com/pypa/pip/blob/main/src/pip/_internal/operations/build/metadata.py -- that's where you wanna look for PEP 517 build logic.

If you wanna have a longer chat/discussion about this code, ping me sometime during a work day. :)

@pradyunsg
Copy link
Member

pradyunsg commented Apr 30, 2021

The change needed here is calling build_env.check_requirements(build_deps) at some point in the codebase, since https://github.com/pypa/pip/blob/main/src/pip/_internal/build_env.py#L158 has the relevant logic already IIUC.

I'm pretty sure the things to figure out here are:

  1. Where to make that call.
  2. How to get build_deps to make that call.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
state: awaiting PR Feature discussed, PR is needed type: feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants