Repository navigation
PYTHON-6025 Consolidate non-IO code in AsyncClientSession/ClientSessi… - #3100
Conversation
…on and _Transaction into shared base classes
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Inherited public session members will be omitted from the generated API documentation unless inherited-member documentation is enabled.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Consolidates shared synchronous and asynchronous session/transaction logic into generic base classes.
Changes:
- Adds shared session and transaction base implementations.
- Retains I/O-specific context management and cleanup in concrete classes.
- Improves shared connection/server typing and removes obsolete type ignores.
| File | Description |
|---|---|
pymongo/client_session_shared.py |
Adds shared base implementations. |
pymongo/asynchronous/client_session.py |
Adopts shared bases for async sessions. |
pymongo/synchronous/client_session.py |
Adopts shared bases for sync sessions. |
pymongo/typings.py |
Adds an agnostic server type. |
pymongo/message.py |
Removes unnecessary type ignores. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| break | ||
|
|
||
|
|
||
| class _AgnosticClientSessionBase(Generic[_ClientT, _ConnectionT, _BoundSessionContextT]): |
There was a problem hiding this comment.
hmm okay maintaining docs in the concrete classes sounds kinda annoying to maintain cuz the logic and the docs would live in two different places so i've opted for using :inherited-members: but lmk if that's the wrong choice
There was a problem hiding this comment.
Yeah the rendered docs look good now!

…on and _Transaction into shared base classes
PYTHON-6025
Changes in this PR
Test Plan
Checklist
Checklist for Author
Checklist for Reviewer