On Mon, Apr 26, 2021 at 9:37 AM Baptiste Carvello < devel2...@baptiste-carvello.net> wrote:
> Hi, > > sorry for being late to the party, but I may not be the only one wondering… > > Le 14/04/2021 à 20:56, Barry Warsaw a écrit : > > > > I’d forgotten that this PEP was in Deferred state. I think it should be > rejected and I plan on making that change. importlib.metadata is a much > better approach to programmatically determining package versions. > > > > > https://docs.python.org/3/library/importlib.metadata.html#distribution-versions > > This is indeed the correct approach, thanks for letting me learn this. > > However, I unsuccessfully searched for the canonical way to look up the > distribution name based on either a module name or an imported module > object. Is there one? > If you mean how to tie a module back to its name on PyPI, you should be able to look up the "Name" in the project's metadata: https://docs.python.org/3/library/importlib.metadata.html#distribution-metadata . -Brett > > Looks like it could be computed based on information in > "*.egg-info/installed-files.txt", but it's far from trivial. Is > "installed-files.txt" even guaranteed to exist for all distributions? > > Cheers, > Baptiste > _______________________________________________ > Python-Dev mailing list -- python-dev@python.org > To unsubscribe send an email to python-dev-le...@python.org > https://mail.python.org/mailman3/lists/python-dev.python.org/ > Message archived at > https://mail.python.org/archives/list/python-dev@python.org/message/SVQ777EGE56OIWHIKPCURGPXGMUJ7HCY/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/OMHAJ7WU7TVM6WWQHYPI3AYGORCKUNAK/ Code of Conduct: http://python.org/psf/codeofconduct/