Skip to content

Commit 7f491f2

Browse files
jinglundongnicain
andauthored
Move samples of GAE Flex Python 3.8 and later to ./flexible (GoogleCloudPlatform#9260)
* Move samples of GAE Flex Python 3.8 and later to the default ./flexible directory. Update README.md files and some references. Remove the Python 3.7 and earlier examples from ./flexible directory. * Remove the runtime_version because we want to promote the :latest behavior. * Update the tag to gae_flex_storage_app. * Add python 3.11 sample apps for Flex tasks, static files and pubsub. Also updated copyrights blocks. * Update some code path references. * Revert the changes to the copyright year. * Revert copyright year in tasks. * Add the previous samples back, because they are still referenced by i8n user guide. * Fix a few more copyright years. --------- Co-authored-by: nicain <nicholascain@google.com>
1 parent 6d238d4 commit 7f491f2

31 files changed

Lines changed: 59 additions & 494 deletions

‎appengine/flexible/README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
These are samples for using Python on Google App Engine Flexible Environment. These samples are typically referenced from the [docs](https://cloud.google.com/appengine/docs).
99

10+
For code samples of Python version 3.7 and earlier, please check
11+
https://github.com/GoogleCloudPlatform/python-docs-samples/tree/main/appengine/flexible.
12+
1013
See our other [Google Cloud Platform github repos](https://github.com/GoogleCloudPlatform) for sample applications and
1114
scaffolding for other frameworks and use cases.
1215

@@ -31,12 +34,9 @@ In general, the samples typically require:
3134
cd python-docs-samples/appengine/flexible
3235
```
3336

34-
4. Open a sample folder, create a virtualenv, install dependencies, and run the sample:
37+
4. Follow https://cloud.google.com/python/docs/setup to set up a Python development environment. Then run:
3538

3639
```
37-
cd hello-world
38-
virtualenv env
39-
source env/bin/activate
4040
pip install -r requirements.txt
4141
python main.py
4242
```
@@ -66,8 +66,8 @@ Some samples in this repositories may have special deployment instructions. Refe
6666

6767
## Contributing changes
6868

69-
* See [CONTRIBUTING.md](../CONTRIBUTING.md)
69+
* See [CONTRIBUTING.md](../../CONTRIBUTING.md)
7070

7171
## Licensing
7272

73-
* See [LICENSE](../LICENSE)
73+
* See [LICENSE](../../LICENSE)

‎appengine/flexible/hello_world/app.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ env: flex
1717
entrypoint: gunicorn -b :$PORT main:app
1818

1919
runtime_config:
20-
python_version: 3
20+
operating_system: ubuntu22
2121

22-
# This sample incurs costs to run on the App Engine flexible environment.
22+
# This sample incurs costs to run on the App Engine flexible environment.
2323
# The settings below are to reduce costs during testing and are not appropriate
2424
# for production use. For more information, see:
2525
# https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-with-app-yaml

‎appengine/flexible/hello_world/main.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015 Google LLC.
1+
# Copyright 2015 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020

2121

2222
@app.route('/')
23-
def hello():
23+
def hello() -> str:
2424
"""Return a friendly HTTP greeting."""
2525
return 'Hello World!'
2626

‎appengine/flexible/hello_world/main_test.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2015 Google LLC.
1+
# Copyright 2015 Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
1515
import main
1616

1717

18-
def test_index():
18+
def test_index() -> str:
1919
main.app.testing = True
2020
client = main.app.test_client()
2121

File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
pytest==7.0.1
1+
pytest==6.2.4
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
Flask==2.1.0; python_version > '3.6'
2-
Flask==2.0.3; python_version < '3.7'
1+
Flask==2.1.1
32
gunicorn==20.1.0

‎appengine/flexible/pubsub/README.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ When running locally, you can use the [Google Cloud SDK](https://cloud.google.co
3232

3333
$ gcloud init
3434

35-
Install dependencies, preferably with a virtualenv:
35+
Install dependencies, please follow https://cloud.google.com/python/docs/setup
36+
to set up a Python development environment. Then run:
3637

37-
$ virtualenv env
38-
$ source env/bin/activate
3938
$ pip install -r requirements.txt
4039

4140
Then set environment variables before starting your application:

‎appengine/flexible/pubsub/app.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ env: flex
1717
entrypoint: gunicorn -b :$PORT main:app
1818

1919
runtime_config:
20-
python_version: 3
20+
operating_system: "ubuntu22"
2121

2222
# [START gae_flex_pubsub_env]
2323
env_variables:

‎appengine/flexible/static_files/app.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ env: flex
1717
entrypoint: gunicorn -b :$PORT main:app
1818

1919
runtime_config:
20-
python_version: 3
20+
operating_system: "ubuntu22"

0 commit comments

Comments
 (0)