-
Notifications
You must be signed in to change notification settings - Fork 11
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
provide a Distribution class that provides up2date entrypoints and files metadata #23
Comments
I'm not quite sure what you mean here. Entry points aren't anything to do with what this project supports, they should be readable via any standard wheel parser, or once installed by |
This is about providing data to importlib_metadata/importlib_resources Aka instead of entrypoints from dist-info, take them out of the source tree Same goes for the list of source files when only a path in the pth is provided |
Sorry, I'm still confused. Isn't this the responsibility of the build backend? All this library does is create a Could you maybe describe the API you're looking for, and an example of what you'd expect the library to do, specifically? Sorry, I feel like either I'm being very dense, or we're misunderstanding each other very badly here. |
Also, what's the use case here? How would a backend benefit from having this? |
Currently editable wheels supported by editables go stale and provide incorrect files Metadata As the pep now has standardised Metadata, a editable wheel can act non-stale and provide correct listing of distribution metadata This would mean that there would be a distribution object avaliable, which fills in the details for importlib.metadata |
Can you provide an example? How does a wheel that is only intended to be built, immediately installed, and then discarded, "go stale"? And what "files Metadata" are you talking about? If you mean the
As I say, I don't know what PEP and what standardised metadata value(s) you are referring to. |
The pyproject.toml in the source tree, if that changes, the Metadata of the installed editable wheel goes stale |
Yes. That would need a reinstall. From PEP 660:
I don't know how it would be possible to reflect dynamic changes in the |
All it needs is a extension of the meta path finder with a distribution finder that returns a distribution which looks at pyproject.toml As pyproject.toml is standardised its even backed in depend. |
Ah, I see (finally!) I find the docs for Presumably this would not work with the |
A starting point would be to allow generating basis files lists as well as returning entrypoints from pyproject.toml I would recommend against supporting full backed data off the bat, but rather allowing backends to register utilities to the meta path finder to provide it instead Those helpers Could be partly independent of the backend as well (for example a setuptools_scm based provider for version which could be added by any backend that integrates it) |
I would still like to know what use case(s) you have in mind here. The examples you give feel rather theoretical, without context. For example, given that the most common backends don’t actually use this project, how could people rely on having dynamically changing metadata anyway? Assuming this gets added, I would probably make this an opt-in feature, so backends would need to say that they wanted it. That’s because this library is intended as a toolkit for backends, not a reference implementation of how editable installs should work. I don’t know how that would impact the use cases you have in mind. |
I'd add support to hatchling myself Also I have a bootstrapping usecase where I'd just use editables, register the git checkouts of hatchling, hatch-vcs and all of the dependencies in order to In addition to that, the self bootstrapping of setuptools_scm would be far easier if it had access to its own entrypoints when self-using it to make its own wheels |
OK. Let me look into it.
Incomplete sentence here? I'm not sure what you mean by "register the git checkouts of (stuff)". Are you using this library to generate the support files and then installing them manually, not by building a wheel using a normal backend? That isn't intended use here. Of course, writing your own custom backend that uses this library is a supported use case, so the line is a little blurred - but it's why I'm comfortable saying that certain things are the responsibility of the backend (because there needs to be a backend involved).
But this isn't about access to entrypoints, it's about having entrypoints change when the code changes without a reinstall. Do you change your entry points often enough that running |
One other consideration is around dependencies. This library currently has no dependencies outside of the stdlib, but adding this without using external libraries would be pointlessly difficult. Yes, the dependencies would probably "only" be the usual suspects like |
I've just taken a look at the documentation for There's also a problem with the API definition in general. I don't know if I'm allowed to return a I'm not rejecting the idea, but I do want to set expectations here - without a more compelling benefit, this isn't going to be something I'll be able to do quickly, and it still might not even be possible at all. I'm still happy to discuss this, and if you think I'm missing an obvious solution, I'd be happy to look at a PR for it, but otherwise it could be a while before I even have a prototype. Footnotes
|
I do understand the limitations, which is why I recommend supporting only obtainable meta (like entrypoints, and leaving files up to either simple heusterics or the backend Just being able to support entrypoints and standard Metadata from pyproject.toml would already enable to use editables as a bootstrapping helper for libraries like setuptools_scm, hatch /hatchling & co |
It's not obvious to me from the docs that it's allowed to implement a "partial" But you've still not explained why this is so much more convenient than simply reinstalling when you (occasionally) change the entrypoints. That's what's frustrating me - it seems like a lot of work to save you having to run a very simple command rather infrequently, and I know you're not asking lightly, so I feel like I'm missing something important here. If you could give me a pointer to the existing code/process docs that you'd change if this was implemented, that would be a huge help to me. Not the build backend code that would need to be modified to use this feature, but the Also, I'm not clear what you mean by a "bootstrapping helper". It appears that Is this related to pypa/setuptools-scm#642? In that PR, there's a discussion where you say
The PR author seems unhappy with this, and I can understand that, but it's unfortunately a limitation of PEP 660 - probably because no-one explained during the PEP discussions that the "traditional" approach had this property of dynamically updating the metadata. I can certainly see that this is a regression in functionality with PEP 660, but while I really don't want to open old wounds here, I think we spent too much time debating "better than the existing method" solutions, and not enough time making sure the proposals offered at least feature parity with what But that's water under the bridge, for better or worse, and while I'd be fine with a proposal to modify PEP 660 to require editable implementations to provide this (by some agreed, and standardised, means), that would be a standards change. What I would be willing to do here is to implement a new function in the library, similar to I don't know how much of this is relevant to what you're asking. Hopefully it gives you some insight into why I don't think this issue is as straightforward as you'd hoped. Any clarifications you can still offer would be much appreciated. |
Both bootstrapping and protection against user errors |
Also the key reason why I rejected the updating in Setuptools_scm is precisely that a library like editables, which provides the downstream was completely unavailable Completely creating everything is not a viable solution Slowly expanding a base level with dynamic Details is much more sustainable |
A further thought, which I note here so that I don't forget it later: The So it looks like we'd have to ask the backend to pass the path of the local OK, I've raised python/importlib_metadata#427 to ask for an example in the |
I did some more research I was wrong about needing to have files I may be able to provide an opt in for this feature within the next month, but I cannot commit to such an timeframe yet |
I did some more research, It's feasible based on the apis provided by the importlib_metadata or the stdlib in 3.9 plus To make it safe I'll have to add some tests to importlib_metadata that encapsulates the expectations that distributions by editables "override" Standard apis |
currently editable wheels have static data for entrypoints and no data for files
it would be a nice help of there was a
EditableDistribution
that provides reasonably accurate file lists for the mapped filesas well as entrypoints as read from the
pyproject.toml
rather thanThe text was updated successfully, but these errors were encountered: