Legacy Python 2 migration from pull queues to PubSub -- grpcio version issues

I inherited a legacy Python 2.7 App Engine app that I’m migrating to the Python 3 environment.

The Google migration guide for “pull” tasks, recommends moving them to use PubSub. I’ve rewritten our code to use PubSub, and can successfully run it in a local server both against an emulator and against production PubSub topics.

However, I am not able to deploy this new code due to version incompatibilities with grpcio:

I’ve come across a proposed workaround that simply catches the exception caused by the incompatibility, which might be bearable until we can get fully on Python 3, but is gross: https://github.com/googleapis/python-pubsub/issues/742#issuecomment-1224582470

Is there a combination of library versions that would allow me to use google-cloud-pubsub with Python 2.7 on the old App Engine environment?

What other alternatives do I have to do this migration? (Other than moving this code completely outside of App Engine for the moment, say to a Cloud Run function?)

Listing it in your app.yaml means you want Google to install it when you deploy your code.

Given that this is Python 2.7, you can install a package locally and then deploy it as part of your source code (which also means you remove it from the ‘built-in’ libraries section of your app.yaml file).

Essentially I’m saying, try and install the version of grpcio that you need locally and then deploy it as part of your source code.

**…**NoCommandLine
https://nocommandline.com
Analytics & GUI for App Engine,
Cloud Run & Datastore Emulator