ETA on protorpc support for new python 2.7 runtime?

102 views
Skip to first unread message

Ubaldo Huerta

unread,
Nov 17, 2011, 6:59:31 AM11/17/11
to google-prot...@googlegroups.com
People like me, relying on ProtoRPC, wanting to migrate to 2.7 to take advantage to threading and reduced billing are a bit trapped. I don't particularly care if I don't have to use webapp2 for ProtoRPC, as it's inmaterial, since ProtoRPC pretty much hides all the dispatching, etc.

Thanks

Rafe Kaplan

unread,
Nov 17, 2011, 3:05:23 PM11/17/11
to google-prot...@googlegroups.com
The next release of app engine will have a plain WSGI handler that
will work with 2.7. You can use that handler right now if you get
ProtoRPC from source and put it in your application. Or you can copy
that WSGI handler code in to your own.

The downside for this is that it does not dispatch to multiple
services and does not automatically support the registry yet.

If you are using Python 2.7 you probably don't need the
multi-mapping since you can map to each ProtoRPC handler via app.yaml.

There will be better support for these kinds of handlers in the future.

Ubaldo Huerta

unread,
Nov 18, 2011, 4:15:30 AM11/18/11
to google-prot...@googlegroups.com
Hi Rafe, I'm not sure I quite understand. "Not dispatching to multiple services" means that the equivalent of this isn't supported?

SERVICE_ROUTES = [('/api/foo', FooService),
                  ('/api/bar', BarService)]
application = webapp.WSGIApplication(
        service_handlers.service_mapping(SERVICE_ROUTES))

It's OK to not have the registry available. How about multi-threading support in 2.7? Are ProtoRPC internals thread safe?

Rafe Kaplan

unread,
Nov 18, 2011, 1:58:50 PM11/18/11
to google-prot...@googlegroups.com
Right, there is no support yet for a path-to-service map as you have
written. You create a new WSGI handler and then map to it using
app.yaml.

I believe that they are as long as your service handler instance is
thread safe. Recall that a new instance of a service is created upon
each request. All the state of a WSGI handler is read-only once
properly configured.

I must admit it has not been tested under 2.7 very extensively, and
it is still very much experimental. However, it should be ok.

Ubaldo Huerta

unread,
Nov 18, 2011, 4:43:41 PM11/18/11
to google-prot...@googlegroups.com
Oh, I see. I guess you mean that the desired scenario should be written in app.yaml as something like this?

# API (protorpc) handler
- url: /api/foo/.*
  script: api_foo.py

- url: /api/bar/.*
  script: api_bar.py

Obviously, in 2.7 you have to specify in yaml an application object I think, not the python module. This is the 2.5 way of doing thing (I actually haven't ported the app yet, just glanced at the 2.7 documentation)

Ah, well, naturally, my service handler instance code must be thread safe, I was just asking about the internals of ProtoRPC.

Rafe, the "experimental" disclaimers sounds like "consult your lawyer" type of disclaimer. I know it's "experimental", by risk using it production I'm trying to "encouage" you to move it the next level, because I think ProtoRPC is very valuable. 

Thanks

Rafe Kaplan

unread,
Nov 21, 2011, 2:17:40 PM11/21/11
to google-prot...@googlegroups.com
On Fri, Nov 18, 2011 at 1:43 PM, Ubaldo Huerta <uba...@gmail.com> wrote:
> Oh, I see. I guess you mean that the desired scenario should be written in
> app.yaml as something like this?
> # API (protorpc) handler
> - url: /api/foo/.*
>   script: api_foo.py
> - url: /api/bar/.*
>   script: api_bar.py
> Obviously, in 2.7 you have to specify in yaml an application object I think,
> not the python module. This is the 2.5 way of doing thing (I actually
> haven't ported the app yet, just glanced at the 2.7 documentation)

You can also put all the handlers in one file:

foo_services.py:

bar_service = ...
baz_service = ...

app.yaml:

handlers:
- url /bar/.*
script: foo_services.bar_service
- url /baz/.*
script: foo_services.baz_service


> Ah, well, naturally, my service handler instance code must be thread safe, I
> was just asking about the internals of ProtoRPC.

Understood. ProtoRPC has always needed to run in non-appengine
environments, so we have paid attention to thread-safety.

> Rafe, the "experimental" disclaimers sounds like "consult your lawyer" type
> of disclaimer. I know it's "experimental", by risk using it production I'm
> trying to "encouage" you to move it the next level, because I think ProtoRPC
> is very valuable.
> Thanks
>

I apologize if it sounds legalistic. I assure you I am looking at
it form a developer point of view. I mention it because I really am
concerned about its shortcomings. It's worth emphasizing how much I
appreciate that you are using it in this state, and how much I want to
help make sure it works for you.

Shay Erlichmen

unread,
Nov 22, 2011, 5:59:57 AM11/22/11
to google-prot...@googlegroups.com
issue  http://code.google.com/p/google-protorpc/issues/detail?id=35 you can star it and follow the progress.

Ubaldo Huerta

unread,
Jul 5, 2012, 10:31:50 AM7/5/12
to google-prot...@googlegroups.com
Any idea is this issue will ever be fixed. It's a real pity
Reply all
Reply to author
Forward
0 new messages