best practices for migrating off Cloud Endpoints Frameworks

110 views
Skip to first unread message

Rich Bragg

unread,
Mar 30, 2022, 11:55:23 PM3/30/22
to Google Cloud Endpoints
Hi all,

I'm finally getting around to figuring out how to migrate my App Engine app (which consists of a webapp2 website plus APIs for Android and iOS clients) from Python 2.7 to Python 3, and after weeks of research and experimentation, I believe I have a reasonable understanding about how to handle each piece except for Cloud Endpoints.

Currently my app is using Cloud Endpoints Framework, which allows me to simply decorate my API methods (and in fact, even augment them with the super useful endpoints-proto-datastore library), then use those to generate an OpenAPI doc and/or client libraries for Android and iOS using endpointscfg.py.  As far as I can tell, all the documentation suggests that the New Way for Python 3 is to use Cloud Endpoints with ESPv2, however, it seems that's really just a replacement for the management layer, which I currently don't even use.  Plus, as far as I can tell the approach for using that service is to start with the OpenAPI doc, and then build the API to implement it, which seems to be the complete opposite development flow I currently use, unless I'm misunderstanding.

I'd love to know if anyone has already navigated this path and/or has any advice for how to do so in way that won't break my existing clients and introduce the level of risk that comes with reimplementing all my APIs in a whole new way.  Is there a replacement in Python 3 that allows the same workflow that starts with the Python methods with decorators to generate a compatible OpenAPI doc?  Or is there an advantage to the other approach I'm missing?

Thanks in advance for any advice.

Rich

Lukas Karlsson

unread,
Mar 31, 2022, 9:15:41 AM3/31/22
to Rich Bragg, Google Cloud Endpoints
I was in this same situation and I never really found a great way to replace the Cloud Endpoints Frameworks piece with something else that would allow me to keep most of the code intact.  

I still have at least two APIs that are running in App Engine with Python 2.7 and the Endpoints Frameworks, but instead of trying to upgrade those two apps in place, I started new projects that were built from scratch in Python 3.7+, using Firestore instead of Datastore, and using Flask instead of webapp2.  I am slowly moving all the functionality that was provided by those old APIs to the new next-gen App engine APIs that I built to replace them.  

Then I went down the route of looking at all the various packages that allow you to decorate python 3 functions that can help with auto-generating the OpenAPI spec, but I never found an existing thing that did everything that Cloud Endpoints Frameworks did. So I'm back in the situation where I'm managing the YAML file for the openapi spec as a separate file from the code itself, which isn't great. But I was able to freeze development on the older python 2 apps and focus on the gen 2 for all new functionality.

/l

--
You received this message because you are subscribed to the Google Groups "Google Cloud Endpoints" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-endp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-endpoints/fd7f65be-c939-4191-b242-07c9d74c96bfn%40googlegroups.com.


--

Lukas Karlsson

Cloud Architect / Developer Advocate 

Broad Institute of MIT and Harvard

105 Broadway, Cambridge, MA 02142

karl...@broadinstitute.org

+1-617-714-7142

Pronouns: he/him/his


BroadInstLogoforDigitalRGB.png


Lukas Karlsson

unread,
Mar 31, 2022, 5:26:53 PM3/31/22
to Rich Bragg, Google Cloud Endpoints
I don't expect to see any of those pull requests getting approved. It's been dead for 3 years and at least one of the primary contributors is no longer at Google.  


image.png

The other piece that my Python 2.7 APIs are still dependent on is the endpoints-proto-datastore:


Also quite-abandoned:


/l

On Thu, Mar 31, 2022 at 5:00 PM Rich Bragg <rich....@gmail.com> wrote:
Thanks for the reply, Lukas, it is helpful to know that you came to the same basic conclusion and have found some other way forward. I have been trying to avoid the build from scratch plan since it would probably take me many months to do that, with the best case scenario being that things work exactly as they do now, but it does look like that plan may be inevitable.

That said, given that there doesn't seem to be a replacement solution that uses the same approach as CEF, which I really like for many reasons, another strategy I have been considering (and even started experimenting with) is to just fork and python3-ify the Cloud Endpoints Frameworks libraries and dependencies, and ideally even try to submit them back to the main repos as pull requests.  If I thought there was a chance those pull requests might be accepted, I might even be willing to put some real effort there to make it happen.  Unfortunately, the graveyard of pull requests that have been sitting there for years without comment (see https://github.com/cloudendpoints/endpoints-python/pulls) suggests that it wouldn't be worth the effort, beyond what it would take to get things working for myself.

Rich Bragg

unread,
Mar 31, 2022, 6:23:52 PM3/31/22
to Lukas Karlsson, Google Cloud Endpoints
Yep, agreed.  And I too am using endpoints-proto-datastore as well. :(

Rich Bragg

unread,
Mar 31, 2022, 6:23:55 PM3/31/22
to Lukas Karlsson, Google Cloud Endpoints
Thanks for the reply, Lukas, it is helpful to know that you came to the same basic conclusion and have found some other way forward. I have been trying to avoid the build from scratch plan since it would probably take me many months to do that, with the best case scenario being that things work exactly as they do now, but it does look like that plan may be inevitable.

That said, given that there doesn't seem to be a replacement solution that uses the same approach as CEF, which I really like for many reasons, another strategy I have been considering (and even started experimenting with) is to just fork and python3-ify the Cloud Endpoints Frameworks libraries and dependencies, and ideally even try to submit them back to the main repos as pull requests.  If I thought there was a chance those pull requests might be accepted, I might even be willing to put some real effort there to make it happen.  Unfortunately, the graveyard of pull requests that have been sitting there for years without comment (see https://github.com/cloudendpoints/endpoints-python/pulls) suggests that it wouldn't be worth the effort, beyond what it would take to get things working for myself.

On Thu, Mar 31, 2022 at 6:15 AM Lukas Karlsson <karl...@broadinstitute.org> wrote:
Reply all
Reply to author
Forward
0 new messages