-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[Cosmos] refactor dict and list #43244
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors type hints throughout the Azure Cosmos DB SDK codebase to use native Python types dict
and list
instead of importing Dict
and List
from the typing
module. This modernization aligns with Python 3.9+ best practices where the built-in collection types can be used directly as generic types.
- Updates all type annotations from
Dict[...]
todict[...]
andList[...]
tolist[...]
- Removes unused imports of
Dict
andList
from typing modules - Maintains backward compatibility while modernizing the codebase
Reviewed Changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
test files | Updated type hints in test files and fault injection transport |
core API files | Modernized type annotations in user.py, scripts.py, partition_key.py |
database.py | Updated all Dict/List type hints to use native dict/list types |
cosmos_client.py | Refactored type annotations throughout client connection code |
container.py | Updated extensive type hints for container operations and queries |
async implementation files | Modernized type hints in all async variants of core modules |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
/azp run python - cosmos - tests |
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM mostly, but got one comment for CosmosList
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tackling the refactoring bullet-point from #43211. This PR refactors all instances of the
typing
module's Dict and List to the Python-nativedict
andlist
.We are also changing the minimum Python version supported to 3.9 as per the Azure Core guidelines.
Core dropped Python 3.8 already 6 months ago: #40831