Skip to content

WebOb: Add urljoin - #16135

Open
jackwalkerlabs wants to merge 1 commit into
python:mainfrom
jackwalkerlabs:fix/webob-urljoin-stub
Open

WebOb: Add urljoin#16135
jackwalkerlabs wants to merge 1 commit into
python:mainfrom
jackwalkerlabs:fix/webob-urljoin-stub

Conversation

@jackwalkerlabs

Copy link
Copy Markdown

Closes #16134.

WebOb 1.8.11 added webob.util.urljoin as its own RFC 3986 resolver, but the WebOb stubs do not expose it. This adds overloads that preserve the return type for regular string inputs and WebOb’s supported None short-circuits, plus regression cases for each return shape.

Upstream implementation: Pylons/webob@a6c142294813
Upstream None handling: Pylons/webob@d3077b8444f9

Validation:

  • python tests/runtests.py stubs/WebOb --run-stubtest
  • direct WebOb 1.8.11 mypy.stubtest (19 modules)

@github-actions

This comment has been minimized.

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please remove the tests. In typeshed, we only add regression tests for functions and classes which are known to have caused complex problems in the past, or where stubs are difficult to get right. 100% test coverage for typeshed is neither necessary nor desirable, as it would lead to code duplication.

See tests/REGRESSION.md for more information.

Comment thread stubs/WebOb/webob/util.pyi Outdated
Comment on lines +8 to +11
@overload
def urljoin(base: None, url: str) -> str: ...
@overload
def urljoin(base: None, url: None) -> None: ...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

urllib's urljoin doesn't allow a None base so we shouldn't either.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated: the base is now typed as str, and I removed the regression tests as requested. WebOb stubtest and the file-scoped pre-commit checks pass.

@jackwalkerlabs
jackwalkerlabs force-pushed the fix/webob-urljoin-stub branch from 3cfb86d to c124ff5 Compare August 3, 2026 22:37
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau mentioned this pull request Aug 4, 2026
@srittau

srittau commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Sorry, I forgot to mention that in the earlier PR, but we should also bump the version of WebOb to ~= 1.8.11, since this is an API addition.

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.

Daily tests failed on Mon Aug 03 2026

2 participants