1- ## Google Cloud Platform Python Samples
1+ # Google Cloud Platform Python Samples
22
3- [ ![ Open in Cloud Shell ] [ shell_img ]] [ shell_link ]
3+ Python samples for [ Google Cloud Platform products ] [ cloud ] .
44
5- [ shell_img ] : http://gstatic.com/cloudssh/images/open-btn.png
6- [ shell_link ] : https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/GoogleCloudPlatform/python-docs-samples&page=editor&open_in_editor=./README.md
5+ [ ![ Build Status] [ py-2.7-shield ]] [ py-2.7-link ] [ ![ Build Status] [ py-3.6-shield ]] [ py-3.6-link ] [ ![ Build Status] [ py-3.7-shield ]] [ py-3.7-link ] [ ![ Build Status] [ py-3.8-shield ]] [ py-3.8-link ]
76
8- This repository holds the samples used in the python documentation on [ cloud.google.com ] ( https://cloud.google.com ) .
7+ ## Setup
98
10- [ ![ Build Status] [ py-2.7-shield ]] [ py-2.7-link ]
11- [ ![ Build Status] [ py-3.6-shield ]] [ py-3.6-link ]
12- [ ![ Build Status] [ py-3.7-shield ]] [ py-3.7-link ]
13- [ ![ Build Status] [ py-3.8-shield ]] [ py-3.8-link ]
9+ 1 . Install [ ` pip ` and ` virtualenv ` ] [ cloud_python_setup ] if you do not already have them.
10+
11+ 1 . Clone this repository:
12+
13+ ```
14+ git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
15+ ```
16+
17+ 1. Obtain authentication credentials.
18+
19+ Create local credentials by running the following command and following the
20+ oauth2 flow (read more about the command [here][auth_command]):
21+
22+ ```
23+ gcloud auth application-default login
24+ ```
25+
26+ Read more about [Google Cloud Platform Authentication][gcp_auth].
27+
28+ ## How to run a sample
29+
30+ 1. Change directory to one of the sample folders, e.g. `logging/cloud-client`:
31+
32+ ```
33+ cd logging/cloud-client/
34+ ```
35+
36+ 1. Create a virtualenv. Samples are compatible with Python 3.6+.
37+
38+ ```
39+ python3 -m venv env
40+ source env/bin/activate
41+ ```
42+
43+ 1. Install the dependencies needed to run the samples.
44+
45+ ```
46+ pip install -r requirements.txt
47+ ```
48+
49+ 1. Run the sample:
50+
51+ ```
52+ python snippets.py
53+ ```
54+
55+ ## Contributing
56+
57+ Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md).
58+
59+ [slack_badge]: https://img.shields.io/badge/slack-Google%20Cloud%20Platform-E01563.svg
60+ [slack_link]: https://googlecloud-community.slack.com/
61+ [cloud]: https://cloud.google.com/
62+ [cloud_python_setup]: https://cloud.google.com/python/setup
63+ [auth_command]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login
64+ [gcp_auth]: https://cloud.google.com/docs/authentication#projects_and_resources
1465
1566[py-2.7-shield]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-2.7.svg
1667[py-2.7-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-2.7.html
@@ -20,14 +71,3 @@ This repository holds the samples used in the python documentation on [cloud.goo
2071[py-3.7-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.7.html
2172[py-3.8-shield]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.8.svg
2273[py-3.8-link]: https://storage.googleapis.com/cloud-devrel-public/python-docs-samples/badges/py-3.8.html
23-
24- For a more detailed introduction to a product, check the README.md in the
25- corresponding folder.
26-
27- ## Contributing changes
28-
29- * See [ CONTRIBUTING.md] ( CONTRIBUTING.md )
30-
31- ## Licensing
32-
33- * See [ LICENSE] ( LICENSE )
0 commit comments