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

Update for Python 3k compatibility #39

Closed
wants to merge 12 commits into from
Closed

Update for Python 3k compatibility #39

wants to merge 12 commits into from

Conversation

amorphic
Copy link

This PR updates the jsonrpclib package for Python 3.x (py3k) compatibility.

Most of the commits are syntax updates. Some libraries must also be imported differently depending on whether the Python version is 2.x or 3.x.

The UnixTransport was using httplib.HTTP - a very outdated means of establishing a HTTP connection which was deprecated in 2.x, (but still included for 1.5.2 compatibility) and completely removed in 3.x. This transport has thus been updated to funciton in a similar way to the latest xmlrpc.client code. It should work, but I have no simple means of testing it.

Previously this was using the httplib.HTTP class, which was a
compatibility layer for python 1.5.2(!). Tidied up to use the newer
httplib API for py2.x and http.client in py3k.
@amorphic
Copy link
Author

Any chance you could take a look at this and release a new version? I need this before I can submit a PR to update tornadorpc for py3k compatibility.

@amorphic
Copy link
Author

It turns out that my original PR wasn't passing tests. My bad. I did a little more work trying to get it over the line but then it occurred to me that I might be flogging a dead horse. Here's why:

jsonrpclib has been specifically designed to mirror xmlrpclib and this works really well in py2.x. But in py3k xmlrpclib has been split into xmlrpc.client and xmlrpc.server, so the paradigm is broken.

What's really required is an entirely new, py3k-only package called jsonrpc containing the modules jsonrpc.client and jsonrpc.server. Unfortunately this name is already taken by an old package which hasn't been updated since 2012 and doesn't seem to by py3k-compatible.

The most up-to-date JSON-RPC package is currently json-rpc and it does support py3k, though it does not attempt to mirror the py3k xmlrpc package.

My original goal was a JSON-RPC implementation of Tornado's WebsocketHandler so I think I might go down the path of writing one based on json-rpc.

@amorphic amorphic closed this Sep 17, 2015
@joshmarshall
Copy link
Owner

James --

Thanks for the work on it, I apologize I was out all week at a conference.
If you want to upgrade tornadorpc to use json-rpc, etc. (or even add
WebSocket capabilities there) I'll be happy to accept that as well.

On Thu, Sep 17, 2015 at 12:15 AM, James Stewart notifications@github.com
wrote:

It turns out that my original PR wasn't passing tests. My bad. I did a
little more work trying to get it over the line but then it occurred to me
that I might be flogging a dead horse. Here's why:

jsonrpclib has been specifically designed to mirror xmlrpclib and this
works really well in py2.x. But in py3k xmlrpclib has been split into
xmlrpc.client and xmlrpc.server, so the paradigm is broken.

What's really required is an entirely new, py3k-only package called
jsonrpc containing the modules jsonrpc.client and jsonrpc.server.
Unfortunately this name is already taken by an old package
https://pypi.python.org/pypi/jsonrpc/1.2 which hasn't been updated
since 2012 and doesn't seem to by py3k-compatible.

The most up-to-date JSON-RPC package is currently json-rpc
https://pypi.python.org/pypi/json-rpc/ and it does support py3k, though
it does not attempt to mirror the py3k xmlrpc package.

My original goal was a JSON-RPC implementation of Tornado's
WebsocketHandler so I think I might go down the path of writing one based
on json-rpc.


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

@efokschaner
Copy link
Contributor

@amorphic It would be nice to have that symmetry between jsonrpc and xmlrpc in python 3. I have a few ideas that might help achieve this.

  1. I believe you can put multiple packages on pypi that deliver the same importable package name (obviously installing multiple would cause issues). Only the name used on pypi (thus by pip) needs to be unique.
  2. You can have multiple root import packages in a single pypi package. So json-rpc package could deliver both a jsonrpclib importable package and a jsonrpc(.client/server) importable package in one bundle and share implementation. The entry points (jsonrpclib and jsonrpc) could either support both python 2 & 3 or assert that they are only loaded on the respective version (if it saves work...).
  3. If having the original old jsonrpc package floating around on pypi or github causes you other issues, you could reach out to the documented owners to negotiate for custody of their project / package if they're not interested in it anymore. If this fails, I've heard it's possible to reach out to pypi, they may have a process for reassigning authority over a package that's important to the community where the owners are unresponsive / unhelpful. Github may also be sympathetic to such things and (again unconfirmed) may be able to help funnel users to a more relevant fork of an old project.

Just some thoughts...

@collinanderson collinanderson mentioned this pull request Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants