-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add _supported_features() #133
Conversation
1b90a82
to
450a377
Compare
Not sure why this is red. Did I manage to unearth a flake8 bug ? |
It looks like a flake8 update may have broken things: |
pep517/in_process/_in_process.py
Outdated
for hook_name in sorted(HOOK_NAMES) | ||
if hook_name != "_supported_hooks" and hasattr(backend, hook_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because HOOK_NAMES
is a set, we could use set arithmetic HOOK_NAMES - {"_supported_hooks"}
to exclude this name. Up to you - I find code using sets pretty clear, but I know it's not to everyone's taste.
I'm happy enough with this as a private fix for pip. One minor concern if we're one day going to make it a public API: most of the optional hooks have a specified fallback behaviour, which this library provides, so a frontend can call them without needing to know whether they're implemented or not. I don't know whether leaving them off a list of 'supported' hooks is good communication. I might be inclined to do something specific for build_editable, unless someone has a use case where checking the other hooks this way is useful. |
How about _supported_features() that returns a list of strings. The only possible one for now being "build_editable" ? |
450a377
to
b1a25de
Compare
b1a25de
to
95de24d
Compare
I did that and constrained the flake8 version to workaround the issue. |
@takluyver let me know if this is now good for you. Also as the next pip bugfix release will depend on a pep517 release, are there any pending blocker to such a release ? |
@takluyver nudge. |
That looks fine, thanks. |
Released as 0.12. Sorry for the delay. |
Pip needs a mechanism to detect if build_editable is supported, in order to properly support legacy editable installs for projects that also have a pyproject.toml.
We provide the information with a
_supported_hooks
hook.Other frontends should normally not need this. Should it be the case, a proper mechanism to expose backend capabilities should standardized.
See pypa/pip#10577 (comment) for more information.