remote-wheel¶
Access files from a remote wheel.
Installation¶
python3 -m pip install remote-wheel --user
python3 -m pip install git+https://github.com/repo-helper/remote-wheel@master --user
Examples¶
>>> from shippinglabel.pypi import get_wheel_url
>>> from remote_wheel import RemoteWheelDistribution
>>> with RemoteWheelDistribution.from_url(get_wheel_url("whey", "0.0.17", strict=True)) as wheel:
... wheel
... wheel.url
... wheel.get_wheel()
... wheel.get_metadata().keys()[:10]
<RemoteWheelDistribution('whey', <Version('0.0.17')>)>
'https://files.pythonhosted.org/packages/e4/40/094399239108e774aa0192e168ba34fab982202db86352b05fc1aeb71444/whey-0.0.17-py3-none-any.whl'
<MetadataMapping({'Wheel-Version': '1.0', 'Generator': 'bdist_wheel (0.36.2)', 'Root-Is-Purelib': 'true', 'Tag': 'py3-none-any'})>
['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', 'Author-email', 'License', 'Project-URL', 'Project-URL']
>>> from pypi_simple import PyPISimple
>>> from remote_wheel import RemoteWheelDistribution
>>> with PyPISimple() as client:
... requests_page = client.get_project_page('requests')
>>> pkg = requests_page.packages[-2]
>>> pkg.url
'https://files.pythonhosted.org/packages/92/96/144f70b972a9c0eabbd4391ef93ccd49d0f2747f4f6a2a2738e99e5adc65/requests-2.26.0-py2.py3-none-any.whl#sha256=6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24'
>>> with RemoteWheelDistribution.from_url(pkg.url) as wheel:
... wheel
... wheel.get_wheel()
... wheel.get_metadata().keys()[:10]
<RemoteWheelDistribution('requests', <Version('2.26.0')>)>
<MetadataMapping({'Wheel-Version': '1.0', 'Generator': 'bdist_wheel (0.36.2)', 'Root-Is-Purelib': 'true', 'Tag': 'py2-none-any', 'Tag': 'py3-none-any'})>
['Metadata-Version', 'Name', 'Version', 'Summary', 'Home-page', 'Author', 'Author-email', 'License', 'Project-URL', 'Project-URL']