packageurl-python is a Python library for parsing and building Package URLs (purls), a standardized way to identify software packages across various ecosystems. It is currently at version 0.17.6 and maintains an active development pace with frequent patch and minor releases.
pip install packageurl-pythonVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse a Package URL string into a PackageURL object, access its individual components, and then convert it back to a dictionary or string. It also shows how to construct a PackageURL object from its constituent parts.
Upgrade Python to 3.8 or newer, or pin `packageurl-python<0.16.0`.
Review `purl2url` usage, especially for `qpkg` types. Alternative methods for generating `qpkg` download URLs may be required.
Upgrade to `packageurl-python` 0.17.0 or newer to correctly handle colons in names and namespaces.
Thoroughly test `url2purl` and `purl2url` behavior after any `packageurl-python` upgrade, particularly for critical parsing or generation flows.
Consider explicitly using the `encode` argument in `.to_string()` for predictable output, e.g., `purl.to_string(encode=True)`.
Install the library using pip: `pip install packageurl-python`
Ensure all components of the PURL are correctly URL-encoded before passing them to `PackageURL.from_string()` or when constructing a `PackageURL` object. For example, use `urllib.parse.quote_plus()` for problematic characters in individual components if you are building the PURL string manually.
To 'change' a PackageURL, create a new PackageURL instance with the desired modifications instead of attempting to alter an existing one. For example, use the existing object's attributes to construct a new one with the updated value.
Ensure that the string passed to `PackageURL.from_string()` is a non-empty string containing a valid or at least parsable PURL.
No dependency data recorded yet.