Skip to main content

A purl aka. Package URL parser and builder

Project description

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

Tests and build status

Tests and build

CI Tests and build 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.10.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

packageurl_python-0.10.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: packageurl-python-0.10.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for packageurl-python-0.10.0.tar.gz
Algorithm Hash digest
SHA256 99df143960b7100fff3b2cf5b0beba2f64b6d8c818f6c9f125aed6fac7438763
MD5 d3b2debea0b66f50a4b0d879b84a1ae0
BLAKE2b-256 cdfd93ee7ed9c41f0a1ad61f98233fce5dfa78e8c79c3ff75e34d08b3d6df91f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for packageurl_python-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c7dc928aaa9465f04c86eaa956c75247d5f140ec8d50bc111b55314f143324bb
MD5 38bee8fa42a7a8a2c14a377d43d5564a
BLAKE2b-256 c8981214e0ea939e8030f703b4cceee3c549a0fc04bfc9e183c0b1fccb107b8e

See more details on using hashes here.

Supported by

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