Skip to content
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

Port python bindings to Python 3 #66

Closed
wants to merge 8 commits into from

Conversation

Kentzo
Copy link

@Kentzo Kentzo commented Oct 27, 2014

Here I'm going to address remaining issues by merging changes from my diverged fork that made Protobuf 2.5.1 compatible with Python 3 by retaining compatibility with all other supported versions.

I kindly ask authorized developers to review and leave comments and I'll try to address them as soon as I can.

A few questions:

@Kentzo Kentzo changed the title Port Protobuf to work under Python 3 Port python bindings to Python 3 Oct 27, 2014
@xfxyjwf
Copy link
Contributor

xfxyjwf commented Oct 27, 2014

+ @mrovner to help take a look.

return _install(tarball, _build_install_args(options))

if __name__ == '__main__':
sys.exit(main())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. Replacing the old, Python2-only 'ez_setup.py' with one from the setuptools bitbucket repo is definitely the Right Thing. FTR, the permalink for "latest and greatest" ez_setup.py is: https://bootstrap.pypa.io/ez_setup.py

#The first input has to be a string, and literals are unicode
MyProtoClass = reflection.GeneratedProtocolMessageType(str('MyProtoClass'),
(message.Message,),
{'DESCRIPTOR': mydescriptor})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change related to the Python3 port, or is it just ensuring better coverage of what the testcase name says it is about?

@Kentzo
Copy link
Author

Kentzo commented Nov 18, 2014

@xfxyjwf @mrovner Do we still need to support Python 2.5 in protobuf 2.6+ ?

@mrovner
Copy link

mrovner commented Nov 18, 2014

Yes, we still have 2.5 clients.

On Tue, Nov 18, 2014 at 8:53 AM, Ilya Kulakov notifications@github.com
wrote:

@xfxyjwf https://github.com/xfxyjwf @mrovner
https://github.com/mrovner Do we still need to support Python 2.6 in
protobuf 2.6+ ?


Reply to this email directly or view it on GitHub
#66 (comment).

Thanks,
--Mike

@Kentzo
Copy link
Author

Kentzo commented Nov 18, 2014

@tseaver Please edit your reviews given that answer :)

@tseaver
Copy link
Contributor

tseaver commented Nov 18, 2014

@mrovner I thought the question was about keeping 2.6 support: are you saying that we need to ship a protobuf that spans 2.5 through 3.4?

Would bumping a major version to signal dropping 2.5 support while adding 3.x support be reasonable? Users stuck on Python 2.5 would then stay with protobuf 2.6.x, while those who needed Py3k could move to protobuf 2.7.x.

@@ -610,7 +624,10 @@ def FindInitializationErrors(self):
return self._cmsg.FindInitializationErrors()

def __str__(self):
return str(self._cmsg)
if PY2:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might make more sense to move this block up to line 44, instead of having the if statement down here.

@sebastianludwig
Copy link

Is there any way to support this pull request?

@tseaver
Copy link
Contributor

tseaver commented Dec 15, 2014

I note that the master is no aiming at a 3.0.0 release: that would seem like an ideal time to drop support for Python < 2.6.

@@ -172,6 +172,7 @@ def run(self):
'google.protobuf.internal.message_listener',
'google.protobuf.internal.python_message',
'google.protobuf.internal.type_checkers',
'google.protobuf.internal.utils',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we rely on setuptools (boostrapping from ez_setup.py if it isn't present), we should be able to use its find_packages() rather than enumerating modules by hand.

@davidB
Copy link

davidB commented Dec 20, 2014

Hi,

Until support of python, I share my workaround, a script to convert to python3:

# more info at http://python3porting.com/bookindex.html
# download protobuf-2.6.1.tar.gz for python
cd modules
rm -Rf google
tar -xzvf ~/Téléchargements/protobuf-2.6.1.tar.gz protobuf-2.6.1/google
2to3-3.4 protobuf-2.6.1/google -o google -W --no-diffs -p -n
rm -Rf protobuf-2.6.1

2to3 is a tool provide by python3.
I used it be able to use protobuf with bendler (blender 2.72 include python 3.4.2)

@Kentzo
Copy link
Author

Kentzo commented Jan 6, 2015

@mrovner I believe this PR can be closed without merging. Please confirm.

@tamird
Copy link
Contributor

tamird commented May 15, 2015

@Kentzo protobuf now officially doesn't need to support python 2.5 and 2.6. Would you like to rebase this such that only 2.7+ is supported?

@Kentzo
Copy link
Author

Kentzo commented May 21, 2015

@tamird I don't have time to review that right now. We don't plan to migrate to 2.6 anytime soon.

Any help is welcome :)

@tamird
Copy link
Contributor

tamird commented Aug 22, 2015

@haberman probably time to close this guy :)

@haberman
Copy link
Member

Ah yes, this has been addressed in other changes. Closing now.

@haberman haberman closed this Feb 16, 2016
TeBoring pushed a commit to TeBoring/protobuf that referenced this pull request Jan 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet