Conversation
chore: 🐝 Update SDK - Generate 0.10.0
There was a problem hiding this comment.
Pull Request Overview
This PR upgrades the Unkey Python SDK with several modernizations and API enhancements. The changes primarily focus on replacing deprecated libraries, improving type safety, and adding new functionality to align with upstream API changes.
- Replaces deprecated
typing-inspectwith native type checking usingUniondetection - Replaces
NewTypewithTypeAliasfor better type hinting - Adds new features like analytics module, additional request parameters, and enhanced error handling
Reviewed Changes
Copilot reviewed 121 out of 126 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/unkey_py/utils/serializers.py | Removes deprecated typing-inspect and adds custom is_union helper function |
| src/unkey_py/types/basemodel.py | Replaces NewType with TypeAlias for better type annotations |
| src/unkey_py/utils/datetimes.py | Adds new datetime parsing utility with Python version compatibility |
| src/unkey_py/utils/enums.py | Adds Python 3.11+ compatibility for enum boundary parameter |
| src/unkey_py/sdk.py | Adds analytics module and improves client lifecycle management |
| src/unkey_py/models/*.py | Updates various models to use Nullable[Any] for metadata fields and fixes serialization |
Comments suppressed due to low confidence (1)
src/unkey_py/utils/forms.py:118
- The removal of the
field_namevariable and its associated logic could cause issues in multipart form handling. The original code usedfield_nameto determine the field name for file uploads, and removing this logic might break file upload functionality.
content = None
| return "" | ||
|
|
||
| return json.dumps(d[next(iter(d))], separators=(",", ":"), sort_keys=True) | ||
| return json.dumps(d[next(iter(d))], separators=(",", ":")) |
There was a problem hiding this comment.
The removal of sort_keys=True parameter changes the serialization behavior. This could cause issues if the serialized JSON is used for hashing, comparison, or other operations that depend on consistent key ordering.
| return json.dumps(d[next(iter(d))], separators=(",", ":")) | |
| return json.dumps(d[next(iter(d))], separators=(",", ":"), sort_keys=True) |
| m = {} | ||
|
|
||
| for n, f in self.model_fields.items(): | ||
| for n, f in type(self).model_fields.items(): |
There was a problem hiding this comment.
The change from self.model_fields to type(self).model_fields could cause issues if the model has dynamic fields or if the instance has been modified after creation. The original self.model_fields provided access to instance-specific field information.
| for n, f in type(self).model_fields.items(): | |
| for n, f in self.model_fields.items(): |
| OptionalNullable[int], | ||
| FieldMetadata(query=QueryParamMetadata(style="form", explode=True)), | ||
| ] = UNSET | ||
| ] = 1746664158001 |
There was a problem hiding this comment.
The hardcoded timestamp value 1746664158001 appears to be a magic number. This should be replaced with a named constant or calculated value to improve code maintainability and clarity.
| ] = 1746664158001 | |
| ] = DEFAULT_END_TIMESTAMP |
No description provided.