Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define pkg as a PackageURL class attribute #184

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jaimergp
Copy link

@jaimergp jaimergp commented Mar 6, 2025

This will allow library users to subclass PackageURL and redefine the scheme to create PURL-like derivatives. (e.g. for the dep: idea described here):

class DependencyURL(PackageURL):
    SCHEME = "dep"

Which can be used in the same way and happily accepts PEP440-like version ranges in the version field 🥳:

>>> dep = DependencyURL.from_string("dep:pypi/requests@>=2.0")
>>> dep
DependencyURL(type='pypi', namespace=None, name='requests', version='>=2.0', qualifiers={}, subpath=None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant