-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Detect pybind11 header path without depending on pip internals (fixes #1174) #1190
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
Conversation
you could also use pkg_resources (setuptools), but I'd guess that distutils is even more portable in terms of availability. |
As get_include is being rewritten, perhaps this is also an opportunity to get rid of the Instead, I would suggest making |
I'm against changing the |
Any other objections to getting this merged soon? |
I'm not a huge fan of implementing this logic inside of pybind; it's a maintenance burden that has very little to do with pybind's purposes. One possible alternative is that we simply change |
That said, don't take that as opposition to the PR: I'm not opposed to merging it if you firmly believe this is the better approach. (On the other hand, if @SylvainCorlay manages to convince pip to change their mind about hiding this—a long shot, I think—then I'd definitely prefer to stick with the non-internal, officially sanctioned approach). |
The upstream vibe definitely seems to be "go away, this is our private implementation that we don't want to share because we only want pip to be used as a command line tool." So I suppose I'm reluctantly moved towards saying go ahead with this PR. (On the plus side, it gets rid of the |
Note that |
I think that it makes sense to merge this. The upstream breakage remains very annoying as a lot of client code to pybind11 uses the In any case, the upstream team appears to be quite bitter and it seems unlikely that they will go with a deprecation approach. |
@wjakob I have tested your PR with a regular python install and the exotic homebrew distutils scheme and it works well. |
I'll go ahead and merge this now to fix breakage with PIP 10.x. Sanitizing the behavior of the |
Actually even simpler is to make both user=True and =False return the same correct path... Suggested "correct" implementation:
If you don't like running pip in a subprocess we can also just copy-paste the relevant parts of the implementation of pip show, I don't particularly care either way. |
The upcoming version of pip will disable all access to internals including the
pip.locations.distutils_scheme('pybind11')['headers']
function that we currently rely on. This commit reimplements a basic subset of this function within pybind11. I'm also open to other approaches if anybody has a better idea :)We should probably backport a similar patch to previous releases.