packageurl-python icon indicating copy to clipboard operation
packageurl-python copied to clipboard

Add `PURL_TYPES` and enforce validation of PURL types

Open kdeldycke opened this issue 7 months ago • 2 comments

This PR adds a comprehensive list of all pURL types that are referenced in https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst

It also enforces the validation of a pURL type.

For context, I made this list for my Meta Package Manager project, which is mapping pURL types to package managers.

Closes: https://github.com/package-url/packageurl-python/issues/181

kdeldycke avatar May 31 '25 10:05 kdeldycke

An improvement of this PR would be to use a enum.StrEnum class to reference all these types, so they can be used as constants.

enum.StrEnum being available starting with Python v3.11, we can add the optional StrEnum dependency for python_version < 3.11.

kdeldycke avatar May 31 '25 11:05 kdeldycke

This PR needs to be reset to reflect the deprecation of https://github.com/package-url/purl-spec/blob/main/PURL-TYPES.rst in favor of registered PURL types at: https://github.com/package-url/purl-spec/blob/main/types. The file : https://github.com/package-url/purl-spec/blob/main/purl-types-index.json provides the current list of registered PURL types and is automatically regenerated whenever a new PURL type is added

mjherzog avatar Oct 07 '25 17:10 mjherzog