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
Metadata
Release files for pypiparser 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypiparser-0.2.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for pypiparser-0.2.4-py2.py3-none-any.whl |
Release files / pypiparser-0.2.4-py2.py3-none-any.whl
| Download URL | pypiparser-0.2.4-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
c3585495ead43ce1680e1a584ce8a0db65b865f20f9b8a5426ce6aff06d3b2b0
|
|
BLAKE2b-256 checksum How to use checksums |
d422f2ebbaa48673fc3fba6825604f1cec271f6e2c5447fa7b58354f0a404aa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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.16
|
Security for pypiparser 0.2.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.