I agree that plugins would be a valuable addition. It looks like your
proposal is more about auto-discovery than plugins themselves; the thing
you’re asking for (extended format for requires-dist) can already be
done by a hook.
As you said on IRC, for an example like requires-dist, there are many
ways to deal with the bootstrapping issue (a hook is required to parse
requires-dist, but the hook is part of a dist that must be in
requires-dist too).
- Sum up the discussion we’ve had months ago about setup dependencies
and come up with at patch to add setup-requires-dist to PEP 345.
- Parse as many lines as possible so that dists providing hooks are
found, then parse the failing lines again; example setup.cfg:
[metadata]
requires-dist = distutils2-git
git+http://blah
[global]
setup-hooks = distutils2_git.parse_requires_dist
The bad thing is that setup hooks should run first, before any dep is
installed; not sure running them twice would be good. Looks like we
need to provide automatic extension via something similar to entry
points, so that d2 automatically gets extended parsing rules for
requires-dist *without* having to specify something as setup hook. I’m
not sure how I like changing behavior without explicit configuration.
- Add a custom field processed by your hook:
[metadata]
requires-dist = distutils2-git
x-requires-dist-vcs = git+http://blah
# need to define a hook to clone the repo
# need something else to create the dist-info dir in the clone
I think I’ll look deeper into entry points and the extensions project.
Cheers
-Toshio
+1 I think. The majority of use cases I think are handled fine by
setup-hooks, and perhaps the addition of support for
setup-requires-dist. Other than that I don't see a reason for
packaging to grow a complicated entry-points-like infrastructure. I
thought that was something we were trying to get away from.
Wouldn't it make sense that setup-hooks are run *after* any
setup-requires-dist packages have been imported? That would solve
most of the issues here.
I also like the idea of using a custom field for requirements from a
VCS. That would prevent confusion by other setup-hooks that might
parse requires-dist expecting its contents to be formatted according
to to PEP385.
Erik