Accept pathlib.Path objects in path arguments. - #1753
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds pathlib.Path support to Unix socket path arguments across implementations.
Changes:
- Introduces a shared
PathLiketype. - Updates Unix client, server, and router signatures.
- Adds tests and documentation.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/websockets/typing.py |
Defines PathLike. |
src/websockets/asyncio/client.py |
Updates client path typing. |
src/websockets/asyncio/server.py |
Updates server path typing. |
src/websockets/asyncio/router.py |
Updates router path typing. |
src/websockets/sync/client.py |
Normalizes client paths. |
src/websockets/sync/server.py |
Normalizes server paths. |
src/websockets/sync/router.py |
Updates router path typing. |
src/websockets/trio/client.py |
Updates client path typing. |
tests/asyncio/test_client.py |
Tests Path client connections. |
tests/asyncio/test_server.py |
Tests Path server sockets. |
tests/sync/test_client.py |
Tests threading client support. |
tests/sync/test_server.py |
Tests threading server support. |
tests/trio/test_client.py |
Tests Trio client support. |
docs/reference/types.rst |
Documents PathLike. |
docs/project/changelog.rst |
Records path-like support. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was already working in the asyncio and trio implementations because we're relying on high-level helpers that already support such objects. Changes were only necessary for the threading implementation.
aaugustin
force-pushed
the
accept-pathlib-path
branch
from
August 26, 2026 05:47
eeff5d9 to
f4c73b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was already working in the asyncio and trio implementations because
we're relying on high-level helpers that already support such objects.
Changes were only necessary for the threading implementation.