Skip to content

Add encode kwarg to .to_string()#191

Merged
pombredanne merged 4 commits intopackage-url:mainfrom
jaimergp:encode-kwarg
Jun 25, 2025
Merged

Add encode kwarg to .to_string()#191
pombredanne merged 4 commits intopackage-url:mainfrom
jaimergp:encode-kwarg

Conversation

@jaimergp
Copy link
Contributor

Not sure if this is an acceptable submission, but I found a need to stringify some (simpler) PURL-derivatives and I'd like to have control over the encoding. Mimicking .to_dict()'s API, I propose exposing this boolean in to_string().

If you don't like to give this option in that method because you fear people misuse it, may I suggest adding a different one like to_unencoded_string() or to_unsafe_string() to discourage usage?

Thanks for taking a look!

Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Thanks!

@pombredanne pombredanne merged commit 9fb5350 into package-url:main Jun 25, 2025
19 checks passed
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.

2 participants