Code samples used on cloud.google.com
Last updated Jul 7, 2026
8.1k
Stars
6.7k
Forks
309
Issues
+6
Stars/day
Attention Score
96
Language breakdown
Jupyter Notebook 83.4%
Python 15.6%
JavaScript 0.7%
HTML 0.1%
Shell 0.1%
Dockerfile 0.1%
โธ Files
click to expand
README
Google Cloud Platform Python Samples
Python samples for [Google Cloud Platform products][cloud].
Google Cloud Samples
Check out some of the samples found on this repository on the Google Cloud Samples page.
Setup
- Install [
pipandvirtualenv][cloudpythonsetup] if you do not already have them.
- Clone this repository:
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git
- Obtain authentication credentials.
gcloud auth application-default login
Read more about [Google Cloud Platform Authentication][gcp_auth].
How to run a sample
- Change directory to one of the sample folders, e.g.
logging/cloud-client:
cd logging/cloud-client/
- Create a virtualenv. Samples are compatible with Python 3.6+.
python3 -m venv env
source env/bin/activate
- Install the dependencies needed to run the samples.
pip install -r requirements.txt
- Run the sample:
python snippets.py
Contributing
Contributions welcome! See the Contributing Guide.
[slack_badge]: https://img.shields.io/badge/slack-Google%20Cloud%20Platform-E01563.svg [slack_link]: https://googlecloud-community.slack.com/ [cloud]: https://cloud.google.com/ [cloudpythonsetup]: https://cloud.google.com/python/setup [auth_command]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login [gcpauth]: https://cloud.google.com/docs/authentication#projectsand_resources
๐ More in this category