This is a Vendasta fork of GoogleCloudPlatform/appengine-python-standard. The only change is widening the
urllib3pin from<2to<3to allow urllib3 2.x, which is needed to resolve HIGH CVEs in urllib3 1.x. See upstream issue #121.If/when upstream merges a fix, this fork can be retired and consumers can switch back to the upstream package.
# 1. Clone this repo and make changes
git clone https://github.com/vendasta/appengine-python-standard.git
cd appengine-python-standard
# 2. Bump the version in setup.py (use .postN suffix to stay sortable after upstream)
# 3. Build sdist and wheel
python3 -m venv /tmp/aps-build
source /tmp/aps-build/bin/activate
pip install build twine keyrings.google-artifactregistry-auth
python3 -m build . --sdist --wheel --outdir dist/
# 4. Upload to Vendasta artifact registry
python3 -m twine upload \
--repository-url=https://us-central1-python.pkg.dev/repcore-prod/python/ \
dist/*
# 5. Verify
pip install --index-url=https://us-central1-python.pkg.dev/repcore-prod/python/simple/ \
appengine-python-standard==<new-version>This is a release of the App Engine services SDK for Python 3. It provides access to various services and API endpoints that were previously only available on the Python 2.7 runtime.
See the documentation to learn more about using this SDK, and learn more about it in this product announcement (Fall 2021).
Additional examples (Datastore [NDB], Task Queues [push tasks], Memcache) can be found in the App Engine migration repo. (Specifically look for samples whose folders have a b but where the Python 2 equivalent folder does not have an a, meaning this SDK is required, e.g., Modules 1 [mod1 and mod1b], 7, 12, etc.)
In your requirements.txt file, add the following:
appengine-python-standard>=1.0.0
To use a pre-release version (Eg. 1.0.1-rc1), modify the above line to appengine-python-standard>=[insert_version] (Eg. appengine-python-standard>=1.0.1-rc1).
In your app's app.yaml, add the following:
app_engine_apis: true
In your main.py, import google.appengine.api.wrap_wsgi_app() and call it on your
WSGI app object.
Example for a standard WSGI app:
import google.appengine.api
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
yield b'Hello world!\n'
app = google.appengine.api.wrap_wsgi_app(app)
Example for a Flask app:
import google.appengine.api
from flask import Flask, request
app = Flask(__name__)
app.wsgi_app = google.appengine.api.wrap_wsgi_app(app.wsgi_app)
Then deploy your app as usual, with gcloud app deploy. The following modules are available:
google.appengine.api.app_identitygoogle.appengine.api.background_threadgoogle.appengine.api.blobstoregoogle.appengine.api.capabilitiesgoogle.appengine.api.croninfogoogle.appengine.api.dispatchinfogoogle.appengine.api.imagesgoogle.appengine.api.mailgoogle.appengine.api.memcachegoogle.appengine.api.modulesgoogle.appengine.api.oauthgoogle.appengine.api.runtimegoogle.appengine.api.searchgoogle.appengine.api.taskqueuegoogle.appengine.api.urlfetchgoogle.appengine.api.usersgoogle.appengine.ext.blobstoregoogle.appengine.ext.dbgoogle.appengine.ext.gqlgoogle.appengine.ext.key_rangegoogle.appengine.ext.ndbgoogle.appengine.ext.testbed
To install the code from the main branch on GitHub rather than the latest
version published to PyPI, put this in your requirements.txt file instead of
appengine-python-standard:
https://github.com/GoogleCloudPlatform/appengine-python-standard/archive/main.tar.gz