Proto commits in nipunn1313/mypy-protobuf

These 60 commits are when the Protocol Buffers files have changed:

Commit:4e9458b
Author:Aidan Jensen
Committer:GitHub

Deprecate if file deprecation option is set (#724) * Deprecate if file deprecation option is set Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> * fix lint Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> * fix lint Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> --------- Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> Co-authored-by: Aidan Jensen <aidan.jensen@robust.ai>

The documentation is generated from this commit.

Commit:d0a0ea9
Author:Aidan Jensen
Committer:GitHub

Add additional deprecation support (#713) * Support comments and deprecation for methods and enum values * Express methods as properties, allows for deprecation * Express enum values as properties, allows for deprecation Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Minor readme updates Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * allow message field deprecation as well Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * only generate method as property if deprecated Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * add a few more test cases Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * logic cleanup Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Update generated code after rebase Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Test sys field Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Write deprecation warnings for servicer methods as well. Type checkers don't catch these for now when implementing a class, but they may in the future. Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> --------- Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>

Commit:9851ab8
Author:Aidan Jensen
Committer:GitHub

Add googleapis as test fodder (#716) * Add google protos Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * alias import statements to fix issues with name collisions Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Don't run 3rd party test by default. Still run in CI Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * fix rebase Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * remove googleapis subtree, clone in tests instead Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * - BREAKING: Refactor import statements - Move to model similar to protoc pyi generator. This prevents name collisions in field names - `from test.a.b import c as _c` - If multiple names collied, append `_{count}` - `from test.a.x import c as _c_1` - Fix bug in duplicate package name imports Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Additional import work * Re-use import aliasing logic for readable stubs and re-exporting. * Fixes issues with readable stubs and grpc sync/async Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Test sys field Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Add envoy protos (and otel, prometheus) Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Move google protos to third_party Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Update mypy_protobuf/main.py * lock to known working refs for thirdparty Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> --------- Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>

Commit:7b20d4e
Author:Aidan Jensen
Committer:GitHub

Support file level field presence feature setting (#717) Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>

Commit:38362fb
Author:Aidan Jensen
Committer:GitHub

Overload __new__ (#710) * Overload __new__ Mypy can't handle a large number of generic overloads (https://github.com/python/mypy/issues/19622) so instead generate 2 different stub classes and override __new__. Seems to have the same functionality, without the generics overhead. Minor feature change in the revealed type of a stub class. Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Write union methods to main typestub. Add Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Clean up generated code and readme * Document async usage * Add tests for async/sync attribute usage * Generate sync methods by default, and type ignore async override for new override Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> * Fix missing method comment regression Signed-off-by: Aidan Jensen <aidandj.github@gmail.com> --------- Signed-off-by: Aidan Jensen <aidandj.github@gmail.com>

Commit:d8f24c3
Author:Aidan Jensen
Committer:GitHub

initial edition 2024 support (#689) Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> Co-authored-by: Aidan Jensen <aidan.jensen@robust.ai>

Commit:6d95984
Author:Aidan Jensen
Committer:GitHub

Protobuf 6.32+ update (#690) * Drop support for py_generic_services * Drop testing support for <6.32 Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> Co-authored-by: Aidan Jensen <aidan.jensen@robust.ai>

Commit:d4fdd2b
Author:Aidan Jensen
Committer:GitHub

Aidan/pep 702 support (#683) * Add initial PEP702 support Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> * Pull comments from deprecation option for warning details Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> * Use ast.parse to make sure the comment string is a valid python string Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> --------- Signed-off-by: Aidan Jensen <aidan.jensen@robust.ai> Co-authored-by: Aidan Jensen <aidan.jensen@robust.ai>

Commit:3424b22
Author:Nipunn Koorapati
Committer:Nipunn Koorapati

Bump to 4.21.6 - in progress

Commit:f4a28eb
Author:Nipunn Koorapati
Committer:GitHub

Switch to use reserved mypy-protobuf extension option numbers (#403) Fixes #396

Commit:1989920
Author:Nipunn Koorapati
Committer:GitHub

Use a single extension message for all the mypy_protobuf field extension types (#398) This allows us to only expend a single extension number

Commit:7a0286b
Author:Nipunn Koorapati
Committer:GitHub

Convert extensions.proto to proto3 (#397)

Commit:9f21fec
Author:Alphadelta14
Committer:GitHub

Save module docstring to top of pyi files (#385) * Save module docstring to top of pyi files * Ideas from CR * Update readme/changelog Co-authored-by: Nipunn Koorapati <nipunn1313@gmail.com>

Commit:41b5cd4
Author:Nipunn Koorapati
Committer:GitHub

Reorder enum helper classes to make pycharm happy (#314) Move circular references into typing context and move down the main class to the bottom so that pycharm is able to figure out the dependencies without errors. Fixes #312

Commit:d70d6a3
Author:Nipunn Koorapati
Committer:GitHub

Fix special chars further (#298) * Use raw strings for comments * Fix special characters in comments further * Use raw string and add test cases from code review

Commit:01a574b
Author:Jared Khan
Committer:GitHub

Add some basic testing of docstring escaping (#297) Co-authored-by: Jared Khan <jared.khan@five.ai>

Commit:2a5b81a
Author:Nipunn Koorapati
Committer:GitHub

Use docstring style comments instead of # comments (#281) Fixes #280

Commit:eb1defa
Author:Nipunn Koorapati
Committer:GitHub

Rudimentary support for comments in proto files (#254) - Messages - Fields in messages - Enums - Enum variants - Extensions - Services - Service methods - Grpc Services - Grpc Service Methods Fixes #166

Commit:0d1da08
Author:Nipunn Koorapati
Committer:GitHub

Add support for messages/enums with python reserved keyword names (#250)

Commit:f6d8aca
Author:Nipunn Koorapati
Committer:GitHub

Support repeated extensions (#248) Generate RepeatedScalarFieldContainer and RepeatedCompositeFieldContainer for those fields.

Commit:a7c4e8a
Author:Nipunn Koorapati
Committer:GitHub

Fix generated code for enums with name conflict with EnumTypeWrapper fields (#246) For example, the following has a field which conflicts with a method on the EnumTypeWrapper class. ``` enum { Name = 1; } ``` Fixes #238

Commit:5eee8e7
Author:Nipunn Koorapati
Committer:GitHub

Fix module level extensions (#245) Update types-protobuf pin from typeshed Depends on https://github.com/python/typeshed/pull/5774 Fixes #244

Commit:a6d11ed
Author:Nipunn Koorapati
Committer:GitHub

Support reserved names for message types (#226) Unfortunately, our tests missed this, because all our tests with reserved names for message types also had reserved names for the identifiers. Added a couple tests for the new scenario, reproed, and fixed by replacing such instances with `Any` (best we can do) Fixes #221

Commit:5d49fc9
Author:Nipunn Koorapati
Committer:GitHub

Fix import public reexport crash (#203) Fix crash when a import public reexport when dependent proto file is not listed on command line for generation

Commit:8f649f6
Author:Nipunn Koorapati
Committer:GitHub

Add public import reexport feature (#186) Support for proto syntax import public "path/to/other.proto";

Commit:883188c
Author:Nipunn Koorapati
Committer:GitHub

Support for mypy_protobuf.casttype, keytype, and valuetype (#178)

Commit:611d31b
Author:Nipunn Koorapati
Committer:GitHub

Rename self to self_ in cases where msg field is named self (#179)

Commit:9d593e5
Author:Nipunn Koorapati
Committer:GitHub

Rename proto/mypy/mypy.proto to proto/mypy_protobuf/extensions.proto (#177)

Commit:0b8c464
Author:Nipunn Koorapati
Committer:GitHub

Add support for well_known_types (#163) Some google.protobuf types are hard coded within the protobuf compiler to have additional base classes. Add those base classes here and confirm that things work in typeshed.

Commit:95e71c7
Author:Nipunn Koorapati
Committer:GitHub

Add support for grpc services generation (#176) Co-authored-by: Eugene Chernyshov <eugene@thefloorcyber.com>

Commit:b24a447
Author:henribru
Committer:GitHub

Add support for optional proto3 fields (#157) * Add support for optional proto3 fields * Expand contributor list * Update changelog * Ignore mypy errors * Add new test output * Add additional new test output

Commit:26ab89b
Author:Nipunn Koorapati
Committer:GitHub

Remove the google .proto files in the repo (#155) They come shipped with protoc - so it's not necessary to have them here. They go stale w/ protoc upgrades if we keep them here.

Commit:6229558
Author:Nipunn Koorapati
Committer:GitHub

Add map support (#140) Depends on https://github.com/python/typeshed/pull/4265 Will need to wait for a new mypy release to pick this up.

Commit:b1228c1
Author:Ethan Pronovost
Committer:GitHub

Minimal implementation of message extensions (#149)

Commit:81228ee
Author:Nipunn Koorapati
Committer:GitHub

Reorganize tests to generate into generated/ directory (#142)

Commit:57c9a33
Author:Nipunn Koorapati
Committer:GitHub

Add test for map case (#139)

Commit:db43f1b
Author:Nipunn Koorapati
Committer:GitHub

Add testing for inner enums in proto3 (#122)

Commit:22a8ad8
Author:Nipunn Koorapati
Committer:GitHub

Fix message/field name aliasing (#112) Fixes #108

Commit:02a7fed
Author:Xiao Meng
Committer:Nipunn Koorapati

Alias builtin types (#92) * alias builtin types to prevent such case: message Foo { google.protobuf.BoolValue bool = 1; } in the generated pyi file, the Foo class will look like: class Foo: @property def bool(self) -> google.protobuf.BoolValue: ... def HasField(self, field_name) -> bool: ... but the bool in HasField definition has been rewritten as property method bool, which will result in mypy error as: error: Invalid type "foo_pb2.Foo.bool" this commit add alias assignments for all builtin types that are used in the pyi, the generated results is like: builtin___bool = bool builtin___bytes = bytes builtin___float = float builtin___int = int and the relevant type hints is like: def HasField(self, field_name) -> builtin___bool: ... thus the built-in variable collision could be prevented * enhance code style - use set literal - rename shadow variable name in sub function - two empty lines between classes * add field name is built-in python var example

Commit:d65a72a
Author:Nipunn Koorapati
Committer:GitHub

Add class to the set of python keywords (#91)

Commit:ae6dc9c
Author:Nipunn Koorapati
Committer:GitHub

update filepath generation to match protoc --python-out (#88) Credit to @arussellsaw for implementing this initially in #72

Commit:0d9ade6
Author:Nipunn Koorapati
Committer:GitHub

Remove emission of python keywords. (#78) Added testing for this behavior. Fixes #73. See #73 for details.

Commit:b0a97c4
Author:Nipunn Koorapati
Committer:GitHub

Upgrade to python-protobuf 3.7 (#77)

Commit:bf6ea19
Author:Nipunn Koorapati
Committer:GitHub

Add literal return values via overload to WhichOneof (#70)

Commit:ce725b1
Author:Nipunn Koorapati
Committer:GitHub

Add oneofs to HasField and ClearField w testing (#68)

Commit:e50978a
Author:Nipunn Koorapati
Committer:GitHub

Type HasField as literal types. Start work on ClearField (#64)

Commit:992b210
Author:Nipunn Koorapati
Committer:GitHub

Support capitalized packages and lowercased messages (#61) Fixes #60

Commit:987d05b
Author:Abhishek Radhakrishnan
Committer:Nipunn Koorapati

Support for nested imports (#57) * Add IDEA and DS_STORE files to .gitignore * Nested import one liner change * Add test protos for nested imports (enums and messages) and matching expectations * Add comment for remains per review comment

Commit:8cedf04
Author:Pascal Corpet
Committer:Nipunn Koorapati

Stub extensions. (#54)

Commit:d6d426d
Author:Pascal Corpet
Committer:Nipunn Koorapati

Import message/enum types from other files even if they are not in a package. (#52) Fixes #51.

Commit:5086192
Author:Nipunn Koorapati
Committer:GitHub

Gate generic service generation behind the file-descriptor option (#49)

Commit:b452a0c
Author:Nipunn Koorapati
Committer:GitHub

Added testing around nested packages (#39) * Added testing around nested packages * Add __init__.py

Commit:ab22ee1
Author:Nipunn Koorapati
Committer:GitHub

Add support for repeated entries in files without a package (#35)

Commit:7b89cf6
Author:Nipunn Koorapati
Committer:GitHub

Fix repeated inner enums codgen (#34)

Commit:88be292
Author:Nipunn Koorapati
Committer:GitHub

Test/fix nested imports inward and outward (#31) Fixes #24

Commit:50d987f
Author:Nipunn Koorapati
Committer:GitHub

Use fully qualified names (#30) Fixes #29

Commit:8988e66
Author:Nipunn Koorapati
Committer:GitHub

Add positive and negative tests for output from mypy (#28) * Add a test which serializes/deserializes with types * Add negative test

Commit:0df796b
Author:Nipunn Koorapati
Committer:GitHub

Replace service with Any while waiting for #25 (#26)

Commit:b134864
Author:Nipunn Koorapati
Committer:Nipunn Koorapati

Add a basic output-matches-expected test I still want additional testing to run mypy and verify the output is reasonable, but this is a good start.

Commit:1b08742
Author:Dave Zbarsky
Committer:Dave Zbarsky

Add go implementation of protoc plugin that generates mypy stubs