protobuf should generate code, satisfy the pep8 style.

Created on 25 Oct 2015  路  9Comments  路  Source: protocolbuffers/protobuf

cleanup python wontfix

Most helpful comment

Would it be possible to add a flag such that there's an option to output PEP-8 compliant Python code, even if the default is the current format?

Google Cloud Platform's Python client libraries run PEP-8 compliant linters on the entire code entire code base, which includes protobuf-generated Python files, and the result is a lot of noise about generated code that we cannot possibly fix which drowns out other issues; here's some sample output: https://circleci.com/gh/GoogleCloudPlatform/google-cloud-python/2477

Most issues are about bad spacing, continuations, wrong indent, etc.

All 9 comments

Or even... google's own one!

I'd be happy to send a 4-spaces PR if you guys wanted.

There is a discrepancy in how many spaces to indent between the public Google Python Style Guide and the internal one (the internal one says "2 spaces"). Since protobuf code is already following the internal style guide, I think it's better to keep it as-is.

It would be very nice if Google could get in sync with the majority of the rest of the public python world :(

I find Google projects some of the worst to look at in the open-source python world. go fmt 's homogeneity is something Google could take inspiration from for its python code!

This style issue can only be fixed after our internal Style guide is updated. I do not expect it to happen any time soon. It's out of the scope of protobuf also.

What about the use of upper-camel-case method names on Message? Has the internal style guide changed in that respect too? The public style guide and pep-8 would require snake-case.

@lyschoening Yeah, google's internal python style guide mentions both method_name and MethodName as style conforming method names... I don't like this inconsistency but it's unlikely we can fix/change it...

Would it be possible to add a flag such that there's an option to output PEP-8 compliant Python code, even if the default is the current format?

Google Cloud Platform's Python client libraries run PEP-8 compliant linters on the entire code entire code base, which includes protobuf-generated Python files, and the result is a lot of noise about generated code that we cannot possibly fix which drowns out other issues; here's some sample output: https://circleci.com/gh/GoogleCloudPlatform/google-cloud-python/2477

Most issues are about bad spacing, continuations, wrong indent, etc.

+1 for a flag to fix this. I cannot use protobuf as our company doesn't want to be forced into Google's strange Python coding style.

See https://google.github.io/styleguide/pyguide.html#s3.16-naming. I assume this is the style guide this project follows? If so, this issue should be re-opened.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkohlman picture tkohlman  路  3Comments

louwersj picture louwersj  路  4Comments

supereagle picture supereagle  路  3Comments

nvarini picture nvarini  路  3Comments

stub42 picture stub42  路  3Comments