Skip to main content

A purl aka. Package URL parser and builder

Project description

# packageurl-python

Python library to parse and build “purl” aka. Package URLs. See https://github.com/package-url/purl-spec for details.

Join the discussion at https://gitter.im/package-url/Lobby or enter a ticket for support.

License: MIT

Build and tests status

Linux (Travis) on Python 2 and 3

Linux Master branch tests status

Usage

>>> from packageurl import PackageURL
>>> purl = PackageURL.from_string("pkg:maven/org.apache.commons/io@1.3.4")
>>> print(purl.to_dict())
{'type': 'maven', 'namespace': 'org.apache.commons', 'name': 'io', 'version': '1.3.4', 'qualifiers': None, 'subpath': None}
>>> print(purl.to_string())
pkg:maven/org.apache.commons/io@1.3.4
>>> print(str(purl))
pkg:maven/org.apache.commons/io@1.3.4
>>> print(repr(purl))
PackageURL(type='maven', namespace='org.apache.commons', name='io', version='1.3.4', qualifiers={}, subpath=None)

Other utilities:

  • packageurl.contrib.django_models.PackageURLMixin is a Django abstract model mixin to use Package URLs in Django.

  • packageurl.contrib.purl2url.get_url(purl) returns the download URL inferred from a Package URL.

  • packageurl.contrib.url2purl.get_purl(url) returns a Package URL inferred from URL.

Install

pip install packageurl-python

Run tests

install:

python3 thirdparty/virtualenv.pyz --never-download --no-periodic-update .
bin/pip install -e ."[test]"

run tests:

bin/py.test tests

Make a new release

  • start a new release branch

  • update the CHANGELOG.rst and AUTHORS.rst

  • update README.rst if needed

  • bump version in setup.cfg

  • run all tests

  • install restview and validate that all .rst docs are correct

  • commit and push this branch

  • tag and push that tag

  • make a PR to merge branch

  • once merged, run:

    bin/pip install --upgrade pip wheel twine setuptools
  • delete the “dist” and “build” directories:

    rm -rf dist/ build/
  • create a source distribution and wheel with:

    bin/python setup.py sdist bdist_wheel
  • finally, upload to PyPI:

    bin/twine upload dist/*

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

packageurl-python-0.9.7.tar.gz (28.8 kB view details)

Uploaded Source

Built Distribution

packageurl_python-0.9.7-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file packageurl-python-0.9.7.tar.gz.

File metadata

  • Download URL: packageurl-python-0.9.7.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

File hashes

Hashes for packageurl-python-0.9.7.tar.gz
Algorithm Hash digest
SHA256 d43db6af6a350099e32e9e05e737013d0409287b761fa59c58a03e55dbc3648a
MD5 f4bb468e5ca4edb66a82fd94467aaf6e
BLAKE2b-256 95272cc29674751ce3efba5cf9e89ed77383f037b6fedf00c3330eb041b243d5

See more details on using hashes here.

Provenance

File details

Details for the file packageurl_python-0.9.7-py3-none-any.whl.

File metadata

  • Download URL: packageurl_python-0.9.7-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.9

File hashes

Hashes for packageurl_python-0.9.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba971c2f3c5c976574803467e97522ae5f542ade3dfec763192a52abb2d7ea8f
MD5 e0a383e130094eebec0b233fc1fb80b3
BLAKE2b-256 a4ce79a93a3f785d475e062113df8b9c0fee96c26df7e009abe1595b1833f89b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page