I have a tool that does this from a wheel:
https://github.com/takluyver/wheeldex
>From an sdist, I think you need to either build a wheel or install it
before you can get this information reliably.
This package provides an API for querying the distutils metadata written in the PKG-INFO file inside a source distriubtion (an sdist) or a binary distribution (e.g., created by running bdist_egg). It can also query the EGG-INFO directory of an installed distribution, and the *.egg-info stored in a “development checkout” (e.g, created by running setup.py develop).
Some of my installed packages have a 'top_level.txt' file in the
.dist-info folder, containing a list of the top-level package names
installed by that distribution. I don't believe this is formally
specified anywhere, though, and packages created by flit do not have it.
Thomas
On Wed, Mar 29, 2017, at 07:41 PM, Chris Jerdonek wrote:
> Hi, this seems like a simple question, but I haven't been able to find
> the answer online:
>
> What is the current recommended way to get (1) the name of a project,
> and (2) the names of the top-level packages installed by a project
> (not counting the project's dependencies). You have access to / can
> run the project's setup.py, and you're also allowed to assume that the
> project is installed.
>
> For example, for (1) I know you can do--
>
> $ python setup.py --name
>
> But I'm not sure if accessing setup.py is no longer recommended (as
> opposed to going through a tool like pip).
>
> Thanks a lot,
> --Chris
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG@python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
_______________________________________________
Distutils-SIG maillist - Distutils-SIG@python.org
https://mail.python.org/mailman/listinfo/distutils-sig