Simple Python Package Index Parser
Project description
PyPiParser
Simple PyPI Package Index parser for index servers without XML / JSON API.
Note: It's still very much a prototype and missing a lot of potentially cool features, since I wrote it with a specific project need in mind.
Installation
via PIP
pip install pypiparser
Usage
from pypiparser import PackageIndex
# create an index object to work with
index = PackageIndex("http://pypi.example.com")
# get simple index url / base url
print index.index_url
""" Result: http://pypi.example.com/simple """
# check if a package is available on the index
print index.provides_package("pyside2")
""" Result: True """
# get all available package versions from index
print index.get_all_versions("pyside2")
""" Result:
[<'pyside2' (Wheel, v5.9.0a1.dev1527518830, '<PackageIndex, 'http://pypi.example.com'>')>,
<'pyside2' (Wheel, v5.9.0a1.dev1527519010, '<PackageIndex, 'http://pypi.example.com'>')>,
<'pyside2' (Wheel, v5.9.0a1.dev1527519532, '<PackageIndex, 'http://pypi.example.com'>')>,
<'pyside2' (Wheel, v5.9.0a1.dev1527520114, '<PackageIndex, 'http://pypi.example.com'>')>,
<'pyside2' (Wheel, v5.9.0a1.dev1527520119, '<PackageIndex, 'http://pypi.example.com'>')>,
<'pyside2' (Wheel, v5.9.0a1.dev1527520955, '<PackageIndex, 'http://pypi.example.com'>')>] """
# get the newest compatible version with my setup (filter=True)
pkg = index.get_newest_version("pyside2", filter=True)
print pkg
""" Result: <'pyside2' (Wheel, v5.9.0a1.dev1527518830, '<PackageIndex, 'http://pypi.example.com'>')> """
# access metadata
print pkg.distribution
print pkg.version
""" Result:
pyside2
5.9.0a1.dev1527518830
"""
# access metadata as dict
print pkg.as_dict()
""" Result:
{'platform': u'linux_x86_64',
'url': 'http://pypi.example.com/packages/PySide2-5.9.0a1.dev1527518830-5.9.6-cp27-cp27mu-linux_x86_64.whl#md5=d87921063a3701e16478b7e0c2b09012',
'abi': u'cp27mu', 'python': u'cp27',
'version': u'5.9.0a1.dev1527518830',
'build': u'5.9.6', 'distribution': 'pyside2'}
"""
Requirements
- beautifulsoup (MIT license)
- requests (Apache 2.0 license)
Todo
- tarball / egg support
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pypiparser-0.2.3-py2.py3-none-any.whl.
File metadata
- Download URL: pypiparser-0.2.3-py2.py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff4b4b545836b50ef0cc11ec8d9def484ab55499b2a04f0e233bcfe0ee438cc0
|
|
| MD5 |
4220eba020256c5da24d322bd73a9ea5
|
|
| BLAKE2b-256 |
d7e162179115eed7fee2f52e1af95d455f8351a7812cbbd2717a0035d4b3d8d8
|