This repository was archived by the owner on Mar 31, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 173
docs: refresh readme instructions #667
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
71006c5
revise readme links and venv set up
cojenco accdc42
remove duplicate steps in samples readme
cojenco c2e85fb
add details and link to readme
cojenco acbb113
Merge branch 'main' into readme12
cojenco 6213929
respond comments
cojenco 95a1201
add next steps to quickstart
cojenco 2a1361d
Merge branch 'main' into readme12
cojenco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,20 +34,22 @@ In order to use this library, you first need to go through the following steps: | |
| .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project | ||
| .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project | ||
| .. _Enable the Google Cloud Storage API.: https://cloud.google.com/storage | ||
| .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html | ||
| .. _Setup Authentication.: https://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication | ||
|
|
||
| Installation | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to | ||
| create isolated Python environments. The basic problem it addresses is one of | ||
| dependencies and versions, and indirectly permissions. | ||
| `Set up a Python development environment`_ and install this library in a `venv`. | ||
| `venv`_ is a tool to create isolated Python environments. The basic problem it | ||
| addresses is one of dependencies and versions, and indirectly permissions. | ||
|
|
||
| With `virtualenv`_, it's possible to install this library without needing system | ||
| Make sure you're using Python 3.3 or later, which includes `venv`_ by default. | ||
| With `venv`, it's possible to install this library without needing system | ||
| install permissions, and without clashing with the installed system | ||
| dependencies. | ||
|
|
||
| .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ | ||
| .. _Set up a Python development environment: https://cloud.google.com/python/docs/setup | ||
| .. _`venv`: https://docs.python.org/3/library/venv.html | ||
|
|
||
|
|
||
| Supported Python Versions | ||
|
|
@@ -68,30 +70,33 @@ Mac/Linux | |
|
|
||
| .. code-block:: console | ||
|
|
||
| pip install virtualenv | ||
| virtualenv <your-env> | ||
| source <your-env>/bin/activate | ||
| <your-env>/bin/pip install google-cloud-storage | ||
| python -m venv env | ||
| source env/bin/activate | ||
| pip install google-cloud-storage | ||
|
|
||
|
|
||
| Windows | ||
| ^^^^^^^ | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| pip install virtualenv | ||
| virtualenv <your-env> | ||
| <your-env>\Scripts\activate | ||
| <your-env>\Scripts\pip.exe install google-cloud-storage | ||
| py -m venv env | ||
| .\env\Scripts\activate | ||
| pip install google-cloud-storage | ||
|
|
||
|
|
||
| Example Usage | ||
| ~~~~~~~~~~~~~ | ||
|
|
||
| .. code:: python | ||
|
|
||
| # Imports the Google Cloud client library | ||
| from google.cloud import storage | ||
|
|
||
| # Instantiates a client | ||
| client = storage.Client() | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice comments! |
||
| # Creates a new bucket and uploads an object | ||
| new_bucket = client.create_bucket('new-bucket-id') | ||
| new_blob = new_bucket.blob('remote/path/storage.txt') | ||
| new_blob.upload_from_filename(filename='/local/path.txt') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add a line to the very end of the quickstart doc? "Now that you've set up your Python client for Cloud Storage, you can get started running Storage samples." This just helps provide a next step.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love the idea! Added a next step to the end of the quickstart. |
||
|
|
@@ -103,4 +108,12 @@ Example Usage | |
| blob = bucket.get_blob('remote/path/to/file.txt') | ||
| print(blob.download_as_bytes()) | ||
| blob.upload_from_string('New contents!') | ||
|
|
||
|
|
||
|
|
||
| What's Next | ||
| ~~~~~~~~~~~ | ||
|
|
||
| Now that you've set up your Python client for Cloud Storage, | ||
| you can get started running `Storage samples.`_ | ||
|
|
||
| .. _Storage samples.: https://github.com/googleapis/python-storage/tree/main/samples | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a line that says something along the lines of: "Make sure you're using Python 3.3 and later, which includes venv by default."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course, done.