Skip to content

Accept pathlib.Path objects in path arguments. - #1753

Merged
aaugustin merged 2 commits into
mainfrom
accept-pathlib-path
Aug 26, 2026
Merged

Accept pathlib.Path objects in path arguments.#1753
aaugustin merged 2 commits into
mainfrom
accept-pathlib-path

Conversation

@aaugustin

Copy link
Copy Markdown
Member

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds pathlib.Path support to Unix socket path arguments across implementations.

Changes:

  • Introduces a shared PathLike type.
  • 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.

Comment thread docs/project/changelog.rst Outdated
Comment thread src/websockets/sync/router.py
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
aaugustin force-pushed the accept-pathlib-path branch from eeff5d9 to f4c73b7 Compare August 26, 2026 05:47
@aaugustin
aaugustin merged commit caf68ab into main Aug 26, 2026
@aaugustin
aaugustin deleted the accept-pathlib-path branch August 26, 2026 06:01
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