1

Running a small webapp written in Python 3.7 on Google App Engine (Standard). Before deploying new builds, I test the app locally, then again in the GCP Shell using gunicorn.

Being an excitable newbie, I recently discovered f-strings and applied them liberally to my code... without realizing that the shell runs Python 3.5. Unless there's a way around this, the days of testing my app in the shell might be behind me.

I'm aware that the shell environment is ephemeral and gets reset shortly after each session. Tried the pyenv method described here and discovered that all of those changes were lost between sessions, including my .bashrc edits.

Is there a way to permanently upgrade the shell's Python runtime to 3.7+? Or perhaps an easier solution?

brystmar
  • 185
  • 1
  • 14

1 Answers1

0

Cloud Shell is a Docker container. You can change this container to fit your needs.

When you have Cloud Shell running, look for the toolbar icon that looks like a laptop (next to the launch editor icon). Click the icon. This will allow you to change your Cloud Shell environment. Just follow the wizard.

John Hanley
  • 74,467
  • 6
  • 95
  • 159
  • It only contains a link to the image (gcr.io/cloudshell-images/cloudshell:latest) What wizard are you referring? – Shrike Sep 15 '21 at 15:29
  • @Shrike - The wizard is no longer an included feature. Here is a link to the documentation to modify the Cloud Shell container image: https://cloud.google.com/shell/docs/customizing-container-image and a link to customize the environment: https://cloud.google.com/shell/docs/configuring-cloud-shell#environment_customization – John Hanley Sep 15 '21 at 21:08