Skip to content

Update proto stubs with latest mypy-protobuf 2.6 #5753

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

Merged
merged 2 commits into from
Jul 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions scripts/generate_proto_stubs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
# followed by committing the changes to typeshed
#
# Update these two variables when rerunning script
PROTOBUF_VERSION=3.14.0
MYPY_PROTOBUF_VERSION=v1.24
PROTOBUF_VERSION=3.17.3
MYPY_PROTOBUF_VERSION=v2.6

set -ex

if uname -a | grep Darwin; then
# brew install coreutils wget
PLAT=osx
else
PLAT=linux
Expand Down Expand Up @@ -43,10 +44,10 @@ PYTHON_PROTOBUF_DIR=protobuf-$PROTOBUF_VERSION
VENV=venv
python3 -m venv $VENV
source $VENV/bin/activate
pip install -r requirements-tests-py3.txt # for black and isort
pip install -r $REPO_ROOT/requirements-tests-py3.txt # for black and isort

# Install mypy-protobuf
pip install git+https://github.com/dropbox/mypy-protobuf@${MYPY_PROTOBUF_VERSION}#subdirectory=python
pip install git+https://github.com/dropbox/mypy-protobuf@${MYPY_PROTOBUF_VERSION}

# Remove existing pyi
find $REPO_ROOT/stubs/protobuf/ -name "*_pb2.pyi" -delete
Expand Down
12 changes: 1 addition & 11 deletions stubs/protobuf/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ google.protobuf.compiler.plugin_pb2.CodeGeneratorRequest.__init__
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.FEATURE_NONE
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.FEATURE_PROTO3_OPTIONAL
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.Feature
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.FeatureValue
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.File.__init__
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse._Feature
google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse.__init__
Expand All @@ -30,7 +29,6 @@ google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_OPTIONAL
google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_REPEATED
google.protobuf.descriptor_pb2.FieldDescriptorProto.LABEL_REQUIRED
google.protobuf.descriptor_pb2.FieldDescriptorProto.Label
google.protobuf.descriptor_pb2.FieldDescriptorProto.LabelValue
google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_BOOL
google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_BYTES
google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_DOUBLE
Expand All @@ -50,15 +48,12 @@ google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_STRING
google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_UINT32
google.protobuf.descriptor_pb2.FieldDescriptorProto.TYPE_UINT64
google.protobuf.descriptor_pb2.FieldDescriptorProto.Type
google.protobuf.descriptor_pb2.FieldDescriptorProto.TypeValue
google.protobuf.descriptor_pb2.FieldDescriptorProto._Label
google.protobuf.descriptor_pb2.FieldDescriptorProto._Type
google.protobuf.descriptor_pb2.FieldDescriptorProto.__init__
google.protobuf.descriptor_pb2.FieldOptions.CORD
google.protobuf.descriptor_pb2.FieldOptions.CType
google.protobuf.descriptor_pb2.FieldOptions.CTypeValue
google.protobuf.descriptor_pb2.FieldOptions.JSType
google.protobuf.descriptor_pb2.FieldOptions.JSTypeValue
google.protobuf.descriptor_pb2.FieldOptions.JS_NORMAL
google.protobuf.descriptor_pb2.FieldOptions.JS_NUMBER
google.protobuf.descriptor_pb2.FieldOptions.JS_STRING
Expand All @@ -72,7 +67,6 @@ google.protobuf.descriptor_pb2.FileDescriptorSet.__init__
google.protobuf.descriptor_pb2.FileOptions.CODE_SIZE
google.protobuf.descriptor_pb2.FileOptions.LITE_RUNTIME
google.protobuf.descriptor_pb2.FileOptions.OptimizeMode
google.protobuf.descriptor_pb2.FileOptions.OptimizeModeValue
google.protobuf.descriptor_pb2.FileOptions.SPEED
google.protobuf.descriptor_pb2.FileOptions._OptimizeMode
google.protobuf.descriptor_pb2.FileOptions.__init__
Expand All @@ -83,7 +77,6 @@ google.protobuf.descriptor_pb2.MethodDescriptorProto.__init__
google.protobuf.descriptor_pb2.MethodOptions.IDEMPOTENCY_UNKNOWN
google.protobuf.descriptor_pb2.MethodOptions.IDEMPOTENT
google.protobuf.descriptor_pb2.MethodOptions.IdempotencyLevel
google.protobuf.descriptor_pb2.MethodOptions.IdempotencyLevelValue
google.protobuf.descriptor_pb2.MethodOptions.NO_SIDE_EFFECTS
google.protobuf.descriptor_pb2.MethodOptions._IdempotencyLevel
google.protobuf.descriptor_pb2.MethodOptions.__init__
Expand Down Expand Up @@ -127,7 +120,7 @@ google.protobuf.service.Service.GetDescriptor
google.protobuf.source_context_pb2.SourceContext.__init__
google.protobuf.struct_pb2.ListValue.__init__
google.protobuf.struct_pb2.NULL_VALUE
google.protobuf.struct_pb2.NullValueValue
google.protobuf.struct_pb2.NullValue
google.protobuf.struct_pb2.Struct.FieldsEntry.__init__
google.protobuf.struct_pb2.Struct.__init__
google.protobuf.struct_pb2.Value.__init__
Expand All @@ -140,9 +133,7 @@ google.protobuf.type_pb2.Field.CARDINALITY_REPEATED
google.protobuf.type_pb2.Field.CARDINALITY_REQUIRED
google.protobuf.type_pb2.Field.CARDINALITY_UNKNOWN
google.protobuf.type_pb2.Field.Cardinality
google.protobuf.type_pb2.Field.CardinalityValue
google.protobuf.type_pb2.Field.Kind
google.protobuf.type_pb2.Field.KindValue
google.protobuf.type_pb2.Field.TYPE_BOOL
google.protobuf.type_pb2.Field.TYPE_BYTES
google.protobuf.type_pb2.Field.TYPE_DOUBLE
Expand All @@ -169,7 +160,6 @@ google.protobuf.type_pb2.Option.__init__
google.protobuf.type_pb2.SYNTAX_PROTO2
google.protobuf.type_pb2.SYNTAX_PROTO3
google.protobuf.type_pb2.Syntax
google.protobuf.type_pb2.SyntaxValue
google.protobuf.type_pb2.Type.__init__
google.protobuf.wrappers_pb2.BoolValue.__init__
google.protobuf.wrappers_pb2.BytesValue.__init__
Expand Down
3 changes: 2 additions & 1 deletion stubs/protobuf/METADATA.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version = "0.1"
version = "3.17"
python2 = true
requires = ["types-futures"]
extra_description = "Generated with aid from mypy-protobuf 2.6"
58 changes: 19 additions & 39 deletions stubs/protobuf/google/protobuf/any_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,26 @@
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.well_known_types import (
Any as google___protobuf___internal___well_known_types___Any,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from typing import (
Optional as typing___Optional,
Text as typing___Text,
)

from typing_extensions import (
Literal as typing_extensions___Literal,
)


builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int


DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class Any(google___protobuf___message___Message, google___protobuf___internal___well_known_types___Any):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
type_url: typing___Text = ...
value: builtin___bytes = ...
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.well_known_types
import google.protobuf.message
import typing
import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ...

class Any(google.protobuf.message.Message, google.protobuf.internal.well_known_types.Any):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
TYPE_URL_FIELD_NUMBER: builtins.int
VALUE_FIELD_NUMBER: builtins.int
type_url: typing.Text = ...
value: builtins.bytes = ...

def __init__(self,
*,
type_url : typing___Optional[typing___Text] = ...,
value : typing___Optional[builtin___bytes] = ...,
type_url : typing.Text = ...,
value : builtins.bytes = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions___Literal[u"type_url",b"type_url",u"value",b"value"]) -> None: ...
type___Any = Any
def ClearField(self, field_name: typing_extensions.Literal[u"type_url",b"type_url",u"value",b"value"]) -> None: ...
global___Any = Any
160 changes: 73 additions & 87 deletions stubs/protobuf/google/protobuf/api_pb2.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,113 +2,99 @@
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.containers import (
RepeatedCompositeFieldContainer as google___protobuf___internal___containers___RepeatedCompositeFieldContainer,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from google.protobuf.source_context_pb2 import (
SourceContext as google___protobuf___source_context_pb2___SourceContext,
)

from google.protobuf.type_pb2 import (
Option as google___protobuf___type_pb2___Option,
SyntaxValue as google___protobuf___type_pb2___SyntaxValue,
)

from typing import (
Iterable as typing___Iterable,
Optional as typing___Optional,
Text as typing___Text,
)

from typing_extensions import (
Literal as typing_extensions___Literal,
)


builtin___bool = bool
builtin___bytes = bytes
builtin___float = float
builtin___int = int


DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class Api(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
name: typing___Text = ...
version: typing___Text = ...
syntax: google___protobuf___type_pb2___SyntaxValue = ...
import builtins
import google.protobuf.descriptor
import google.protobuf.internal.containers
import google.protobuf.message
import google.protobuf.source_context_pb2
import google.protobuf.type_pb2
import typing
import typing_extensions

DESCRIPTOR: google.protobuf.descriptor.FileDescriptor = ...

class Api(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
NAME_FIELD_NUMBER: builtins.int
METHODS_FIELD_NUMBER: builtins.int
OPTIONS_FIELD_NUMBER: builtins.int
VERSION_FIELD_NUMBER: builtins.int
SOURCE_CONTEXT_FIELD_NUMBER: builtins.int
MIXINS_FIELD_NUMBER: builtins.int
SYNTAX_FIELD_NUMBER: builtins.int
name: typing.Text = ...
version: typing.Text = ...
syntax: google.protobuf.type_pb2.Syntax.V = ...

@property
def methods(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___Method]: ...
def methods(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Method]: ...

@property
def options(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[google___protobuf___type_pb2___Option]: ...
def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: ...

@property
def source_context(self) -> google___protobuf___source_context_pb2___SourceContext: ...
def source_context(self) -> google.protobuf.source_context_pb2.SourceContext: ...

@property
def mixins(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[type___Mixin]: ...
def mixins(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___Mixin]: ...

def __init__(self,
*,
name : typing___Optional[typing___Text] = ...,
methods : typing___Optional[typing___Iterable[type___Method]] = ...,
options : typing___Optional[typing___Iterable[google___protobuf___type_pb2___Option]] = ...,
version : typing___Optional[typing___Text] = ...,
source_context : typing___Optional[google___protobuf___source_context_pb2___SourceContext] = ...,
mixins : typing___Optional[typing___Iterable[type___Mixin]] = ...,
syntax : typing___Optional[google___protobuf___type_pb2___SyntaxValue] = ...,
name : typing.Text = ...,
methods : typing.Optional[typing.Iterable[global___Method]] = ...,
options : typing.Optional[typing.Iterable[google.protobuf.type_pb2.Option]] = ...,
version : typing.Text = ...,
source_context : typing.Optional[google.protobuf.source_context_pb2.SourceContext] = ...,
mixins : typing.Optional[typing.Iterable[global___Mixin]] = ...,
syntax : google.protobuf.type_pb2.Syntax.V = ...,
) -> None: ...
def HasField(self, field_name: typing_extensions___Literal[u"source_context",b"source_context"]) -> builtin___bool: ...
def ClearField(self, field_name: typing_extensions___Literal[u"methods",b"methods",u"mixins",b"mixins",u"name",b"name",u"options",b"options",u"source_context",b"source_context",u"syntax",b"syntax",u"version",b"version"]) -> None: ...
type___Api = Api

class Method(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
name: typing___Text = ...
request_type_url: typing___Text = ...
request_streaming: builtin___bool = ...
response_type_url: typing___Text = ...
response_streaming: builtin___bool = ...
syntax: google___protobuf___type_pb2___SyntaxValue = ...
def HasField(self, field_name: typing_extensions.Literal[u"source_context",b"source_context"]) -> builtins.bool: ...
def ClearField(self, field_name: typing_extensions.Literal[u"methods",b"methods",u"mixins",b"mixins",u"name",b"name",u"options",b"options",u"source_context",b"source_context",u"syntax",b"syntax",u"version",b"version"]) -> None: ...
global___Api = Api

class Method(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
NAME_FIELD_NUMBER: builtins.int
REQUEST_TYPE_URL_FIELD_NUMBER: builtins.int
REQUEST_STREAMING_FIELD_NUMBER: builtins.int
RESPONSE_TYPE_URL_FIELD_NUMBER: builtins.int
RESPONSE_STREAMING_FIELD_NUMBER: builtins.int
OPTIONS_FIELD_NUMBER: builtins.int
SYNTAX_FIELD_NUMBER: builtins.int
name: typing.Text = ...
request_type_url: typing.Text = ...
request_streaming: builtins.bool = ...
response_type_url: typing.Text = ...
response_streaming: builtins.bool = ...
syntax: google.protobuf.type_pb2.Syntax.V = ...

@property
def options(self) -> google___protobuf___internal___containers___RepeatedCompositeFieldContainer[google___protobuf___type_pb2___Option]: ...
def options(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.type_pb2.Option]: ...

def __init__(self,
*,
name : typing___Optional[typing___Text] = ...,
request_type_url : typing___Optional[typing___Text] = ...,
request_streaming : typing___Optional[builtin___bool] = ...,
response_type_url : typing___Optional[typing___Text] = ...,
response_streaming : typing___Optional[builtin___bool] = ...,
options : typing___Optional[typing___Iterable[google___protobuf___type_pb2___Option]] = ...,
syntax : typing___Optional[google___protobuf___type_pb2___SyntaxValue] = ...,
name : typing.Text = ...,
request_type_url : typing.Text = ...,
request_streaming : builtins.bool = ...,
response_type_url : typing.Text = ...,
response_streaming : builtins.bool = ...,
options : typing.Optional[typing.Iterable[google.protobuf.type_pb2.Option]] = ...,
syntax : google.protobuf.type_pb2.Syntax.V = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions___Literal[u"name",b"name",u"options",b"options",u"request_streaming",b"request_streaming",u"request_type_url",b"request_type_url",u"response_streaming",b"response_streaming",u"response_type_url",b"response_type_url",u"syntax",b"syntax"]) -> None: ...
type___Method = Method
def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"options",b"options",u"request_streaming",b"request_streaming",u"request_type_url",b"request_type_url",u"response_streaming",b"response_streaming",u"response_type_url",b"response_type_url",u"syntax",b"syntax"]) -> None: ...
global___Method = Method

class Mixin(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
name: typing___Text = ...
root: typing___Text = ...
class Mixin(google.protobuf.message.Message):
DESCRIPTOR: google.protobuf.descriptor.Descriptor = ...
NAME_FIELD_NUMBER: builtins.int
ROOT_FIELD_NUMBER: builtins.int
name: typing.Text = ...
root: typing.Text = ...

def __init__(self,
*,
name : typing___Optional[typing___Text] = ...,
root : typing___Optional[typing___Text] = ...,
name : typing.Text = ...,
root : typing.Text = ...,
) -> None: ...
def ClearField(self, field_name: typing_extensions___Literal[u"name",b"name",u"root",b"root"]) -> None: ...
type___Mixin = Mixin
def ClearField(self, field_name: typing_extensions.Literal[u"name",b"name",u"root",b"root"]) -> None: ...
global___Mixin = Mixin
Loading