obtaining project name and packages
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
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.
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
On Wed, Mar 29, 2017 at 1:55 PM, Thomas Kluyver
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.
Src: https://code.launchpad.net/~tseaver/pkginfo/trunk PyPI: https://pypi.python.org/pypi/pkginfo 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).
Docs: https://pythonhosted.org/pkginfo/ https://bazaar.launchpad.net/~tseaver/pkginfo/trunk/files/head:/pkginfo/test...
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
cd ./lib/python2.7/site-packages/notebook-4.4.1.dist-info
cat metadata.json | python -m json.tool
{
"classifiers": [
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3"
],
"extensions": {
"python.commands": {
"wrap_console": {
"jupyter-nbextension": "notebook.nbextensions:main",
"jupyter-notebook": "notebook.notebookapp:main",
"jupyter-serverextension": "notebook.serverextensions:main"
}
},
"python.details": {
"contacts": [
{
"email": "jupyter@googlegroups.com",
"name": "Jupyter Development Team",
"role": "author"
}
],
"document_names": {
"description": "DESCRIPTION.rst"
},
"project_urls": {
"Home": "http://jupyter.org"
}
},
"python.exports": {
"console_scripts": {
"jupyter-nbextension": "notebook.nbextensions:main",
"jupyter-notebook": "notebook.notebookapp:main",
"jupyter-serverextension": "notebook.serverextensions:main"
}
}
},
"extras": [
"doc",
"test"
],
"generator": "bdist_wheel (0.29.0)",
"keywords": [
"Interactive",
"Interpreter",
"Shell",
"Web"
],
"license": "BSD",
"metadata_version": "2.0",
"name": "notebook",
"platform": "Linux",
"run_requires": [
{
"extra": "doc",
"requires": [
"Sphinx (>=1.1)"
]
},
{
"requires": [
"ipykernel",
"ipython-genutils",
"jinja2",
"jupyter-client",
"jupyter-core",
"nbconvert",
"nbformat",
"tornado (>=4)",
"traitlets"
]
},
{
"extra": "test",
"requires": [
"nose",
"requests"
]
},
{
"environment": "python_version == \"2.7\"",
"extra": "test",
"requires": [
"mock"
]
},
{
"environment": "sys_platform != \"win32\"",
"requires": [
"terminado (>=0.3.3)"
]
}
],
"summary": "A web-based notebook environment for interactive computing",
"version": "4.4.1"
}
On Wed, Mar 29, 2017 at 3:19 PM, Wes Turner
On Wed, Mar 29, 2017 at 1:55 PM, Thomas Kluyver
wrote: 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.
Src: https://code.launchpad.net/~tseaver/pkginfo/trunk
PyPI: https://pypi.python.org/pypi/pkginfo
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).
Docs: https://pythonhosted.org/pkginfo/
https://bazaar.launchpad.net/~tseaver/pkginfo/trunk/files/ head:/pkginfo/tests/
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
participants (3)
-
Chris Jerdonek
-
Thomas Kluyver
-
Wes Turner