-
Notifications
You must be signed in to change notification settings - Fork 84
Add additional deprecation support #713
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
base: main
Are you sure you want to change the base?
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 enhances deprecation support in the mypy-protobuf plugin by generating properties instead of attributes for deprecated protobuf elements, allowing proper deprecation warnings to be surfaced through type checking.
Key changes:
- Deprecated message fields, gRPC methods, and enum values are now generated as properties with
@deprecateddecorators - This enables mypy to catch usage of deprecated elements at type-check time
- Test expectations updated to reflect 9 additional deprecation warnings (from 105 to 114 errors)
Reviewed changes
Copilot reviewed 24 out of 27 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
test_negative/output.expected.* |
Updated expected mypy error counts and line numbers to reflect new deprecation warnings |
test_negative/negative.py |
Added test cases for deprecated fields, methods, and enum values |
test/test_generated_mypy.py |
Updated error count assertion from 90 to 96 |
test/generated_concrete/testproto/test_pb2.pyi |
Generated deprecated message fields as properties with deprecation decorators |
test/generated_concrete/testproto/grpc/dummy_pb2_grpc.pyi |
Generated deprecated gRPC methods as properties with deprecation decorators |
test/generated_concrete/testproto/grpc/dummy_pb2.pyi |
Generated deprecated request fields as properties with deprecation decorators |
stubtest_allowlist.txt |
Updated allowlist for properties that don't exist at runtime |
run_test.sh |
Added logging for stubtest execution |
proto/testproto/test.proto |
Added deprecated field definitions for testing |
proto/testproto/grpc/dummy.proto |
Added deprecated method definitions for testing |
CHANGELOG.md |
Documented the new deprecation property generation feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
* Express methods as properties, allows for deprecation * Express enum values as properties, allows for deprecation Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>
98e7152 to
4d7046f
Compare
This generates properties instead of attributes for methods, enum values, message fields and adds deprecation decoration if the option is set.