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

Why use uritools instead of the standard library urllib? #803

Open
pombredanne opened this issue Mar 22, 2024 · 1 comment
Open

Why use uritools instead of the standard library urllib? #803

pombredanne opened this issue Mar 22, 2024 · 1 comment

Comments

@pombredanne
Copy link
Member

Why use uritools instead of the standard library urllib?
Are there specific cases that really demand adding an extra dependency?
It seems barely used https://github.com/search?q=repo%3Aspdx%2Ftools-python+uritools+language%3APython&type=code&l=Python
and it would be best to avoid adding an extra dependency for such a small benefit.

@jspeed-meyers
Copy link
Contributor

jspeed-meyers commented May 5, 2024

I am also supportive of removing a dependency that provides little benefit. I tried to replace uritools functions with urllib equivalents and hit some issues though.

While debugging I noticed this:

(
creation_info_fixture(document_namespace="some_namespace"),
DOCUMENT_SPDX_ID,
"document_namespace must be a valid URI specified in RFC-3986 and must contain no fragment (#), "
"but is: some_namespace",
),

And then further noticed that the Python standard libary urllib module says:

RFC 3986 is considered the current standard and any future changes to
urlparse module should conform with it.  The urlparse module is
currently not entirely compliant with this RFC due to defacto
scenarios for parsing, and for backward compatibility purposes, some
parsing quirks from older RFCs are retained. The testcases in
test_urlparse.py provides a good indicator of parsing behavior.

I wonder if urllib not being compliant with RFC 3986 is why uritools is used instead of urllib? Maybe the need for compliance with RFC 3986 is strong enough to merit adding a dependency on uritools? I personally don't know. But when I tried some simple replacements, it didn't go well :)

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

No branches or pull requests

2 participants