Skip to content

Define pkg as a PackageURL class attribute #184

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

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)

@jaimergp jaimergp closed this Mar 30, 2025
@pombredanne
Copy link
Member

@jaimergp this is fine by me BTW... no objections to make it easier to reuse!

@pombredanne pombredanne reopened this Apr 30, 2025
@pombredanne
Copy link
Member

Ah, I see, this is now with #186

@jaimergp
Copy link
Author

jaimergp commented May 8, 2025

Ah, @pombredanne, if you are fine with this type of change, yes, please, let's reopen!

@johnmhoran johnmhoran reopened this May 14, 2025
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.

3 participants