In ihrer setup.py Python-Pakete bietet einige Informationen. Diese Information kann dann in der PKG_INFO-Datei des Eies gefunden werden.Wie erhalte ich eine Python-Verteilungs-URL?
Wie kann ich auf sie zugreifen, nachdem ich das Paket installiert habe?
Zum Beispiel, wenn ich habe folgendes Modul:
setup(name='myproject',
version='1.2.0.dev0',
description='Demo of a setup.py file.',
long_description=README + "\n\n" + CHANGELOG + "\n\n" + CONTRIBUTORS,
license='Apache License (2.0)',
classifiers=[
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"License :: OSI Approved :: Apache Software License"
],
keywords="web sync json storage services",
url='https://github.com/Kinto/kinto')
Wie kann ich Python verwenden, um die Informationen in der setup.py zur Verfügung gestellt, um wieder?
Ich dachte an etwas ähnlich wie:
import pkg_resource
url = pkg_resource.get_distribution(__package__).url
Jede Idee?
scheint ein Duplikat http://stackoverflow.com/questions/20683118/how-to-access-python-package-metadata zu sein -von-innerhalb der Python-Konsole – Natim