Comments (9)
This generated constructors issue should be fixed with #74.
The virtualenvironment issue was quite interesting and should be fixed with #76. Didn't actually have to do with py2/py3, but rather with google's new release of the python library python-protobuf (this project didn't pin the version!). My setup continued to work because I still had the old version installed.
from mypy-protobuf.
Good idea. Can you submit a patch for this? (IIUC we care more about the Python generator than about the Go one.)
from mypy-protobuf.
I was going to write a patch as suggested. Before changing any code, I ran the test script, and I'm seeing failures. Are the tests supposed to be in a passing state, or is this a known issue? Maybe it's a problem with my configuration?
Here's a snippet of the output I see when I run run_test.sh
. I'm using MacOS and Python 3.6.
with pytest.raises(ValueError, match="Unknown field garbage."):
> s_untyped.HasField("garbage")
E ValueError: Protocol message Simple1 has no field garbage.
test/test_generated_mypy.py:117: ValueError
...
# Erase the types to verify that incorrect inputs fail at runtime
# Each test here should be duplicated in test_negative to ensure mypy fails it too
s_untyped = s # type: Any
with pytest.raises(ValueError, match="Unknown field garbage."):
> s_untyped.HasField(u"garbage")
E ValueError: Protocol message SimpleProto3 has no field garbage.
test/test_generated_mypy.py:135: ValueError
from mypy-protobuf.
@nipunn1313: Any idea what could cause this? I can't even start trying to repro these since my env is broken in other ways.
@erictraut: Did you read the comments in run_test.sh ("Uncomment these to run on mac")?
from mypy-protobuf.
I've gone far enough down the rabbit hole trying to get this to work on my system. It should be a trivial code fix for someone who has the build & test environment working.
from mypy-protobuf.
Hey @erictraut - I have the setup working on my machine - so could take a look here.
I am curious what issue you were having with your setup.
The "Uncomment these to run on mac" lines actually don't appear necessary any more if you have a python3 installation explicitly on mac (which exists nowadays!). I will remove those from the run_test.sh script!
from mypy-protobuf.
When I ran the test script unmodified (without uncommenting those lines), I received the errors I pasted above. This was using a Python 3.6 virtual environment.
from mypy-protobuf.
I put up a pull request to take care of this! Thanks!
I've been running it locally in a python2 virtualenvironment and it's been working.
It's configured to run w/ both python2 and python3 virtual environments in travis, but something must be off about that configuration as I'm able to repro the issue you described.
Will poke at it afterwards.
Will file an issue for it.
from mypy-protobuf.
Thanks! Much appreciated.
from mypy-protobuf.
Related Issues (20)
- enums: argument has incompatible type "int"; expected "ValueType" HOT 2
- Compare mypy-protobuf to protobuf --pyi_out support (starting with 3.20) HOT 7
- Use official style for generated stubs HOT 5
- Reserve extension numbers within the protobuf global extension registry
- flake8-noqa reports unused `noqa` comments in generated protobuf stubs HOT 3
- Library stubs not installed for "google.protobuf.service_reflection" HOT 4
- my-protobuf-3.4.0 breaks backward compatibility by silently upgrading to protobuf-4 HOT 10
- Add version to header comment. HOT 3
- No module named mypy_protobuf HOT 8
- Not generating .py files from protouf file using this plugin HOT 1
- Question: why not use Python’s Enum HOT 11
- Get generated code to be black-compatible for readability
- Compatibility with flake8-pyi>=23.5.0 HOT 1
- timeout should be float HOT 2
- Release version on pypi is to low! HOT 2
- A better way to annotation the AsyncStub HOT 9
- Document the experience on configuring properly with Visual Studio Code HOT 1
- Fix github actions warnings
- Add error code to bare type ignore
- Ignoring field names equal to reserved keywords like "from" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mypy-protobuf.