Giter Club home page Giter Club logo

Comments (9)

nipunn1313 avatar nipunn1313 commented on August 22, 2024 1

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.

gvanrossum avatar gvanrossum commented on August 22, 2024

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.

erictraut avatar erictraut commented on August 22, 2024

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.

gvanrossum avatar gvanrossum commented on August 22, 2024

@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.

erictraut avatar erictraut commented on August 22, 2024

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.

nipunn1313 avatar nipunn1313 commented on August 22, 2024

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.

erictraut avatar erictraut commented on August 22, 2024

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.

nipunn1313 avatar nipunn1313 commented on August 22, 2024

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.

erictraut avatar erictraut commented on August 22, 2024

Thanks! Much appreciated.

from mypy-protobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.