@@ -8,6 +8,8 @@ allows world-wide storage and retrieval of any amount of data at any time. You c
8
8
Cloud Storage for a range of scenarios including serving website content, storing data
9
9
for archival and disaster recovery, or distributing large data objects to users via direct download.
10
10
11
+ **NOTE **: `3.0 Major Version Notes `_ are available. Feedback welcome.
12
+
11
13
A comprehensive list of changes in each version may be found in the `CHANGELOG `_.
12
14
13
15
- `Product Documentation `_
@@ -37,75 +39,6 @@ Google APIs Client Libraries, in `Client Libraries Explained`_.
37
39
.. _Storage Control API : https://cloud.google.com/storage/docs/reference/rpc/google.storage.control.v2
38
40
.. _Client Libraries Explained : https://cloud.google.com/apis/docs/client-libraries-explained
39
41
40
- 3.0 Major Version Notes
41
- -----------------------
42
-
43
- Feedback Welcome
44
- ~~~~~~~~~~~~~~~~
45
-
46
- If you experience that backwards compatibility for your application is broken
47
- with this major version release, please let us know through the Github issues
48
- system. While some breaks of backwards compatibility may be unavoidable due to
49
- new features in the major version release, we will do our best to minimize
50
- them. Thank you.
51
-
52
- Exception Handling
53
- ~~~~~~~~~~~~~~~~~~
54
-
55
- In Python Storage 3.0, the dependency ``google-resumable-media `` was integrated.
56
- The ``google-resumable-media `` dependency included exceptions
57
- ``google.resumable_media.common.InvalidResponse `` and
58
- ``google.resumable_media.common.DataCorruption ``, which were often imported
59
- directly in user application code. The replacements for these exceptions are
60
- ``google.cloud.storage.exceptions.InvalidResponse `` and
61
- ``google.cloud.storage.exceptions.DataCorruption ``. Please update application code
62
- to import and use these exceptions instead.
63
-
64
- For backwards compatibility, if ``google-resumable-media `` is installed, the new
65
- exceptions will be defined as subclasses of the old exceptions, so applications
66
- should continue to work without modification. This backwards compatibility
67
- feature may be removed in a future major version update.
68
-
69
- Some users may be using the original exception classes from the
70
- ``google-resumable-media `` library without explicitly installing that library. So
71
- as not to break user applications following this pattern,
72
- ``google-resumable-media `` is still in the list of dependencies in this package's
73
- setup.py file. Applications which do not import directly from
74
- ``google-resumable-media `` can safely disregard this dependency.
75
- This backwards compatibility feature **will be removed ** in a future major
76
- version update. Please migrate to using the ``google.cloud.storage.exceptions ``
77
- classes as above.
78
-
79
- Checksum Defaults
80
- ~~~~~~~~~~~~~~~~~
81
-
82
- In Python Storage 3.0, uploads and downloads now have a default of "auto" where
83
- applicable. "Auto" will use crc32c checksums, except for unusual cases where the
84
- fast (C extension) crc32c implementation is not available, in which case it will
85
- use md5 instead. Before Python Storage 3.0, the default was md5 for most
86
- downloads and None for most uploads. Note that ranged downloads ("start" or
87
- "end" set) still do not support any checksumming, and some features in
88
- ``transfer_manager.py `` still support crc32c only.
89
-
90
- Note: The method ``Blob.upload_from_file() `` requires a file in bytes mode, but
91
- when checksum is set to None, as was the previous default, would not throw an
92
- error if passed a file in string mode under some circumstances. With the new
93
- defaults, it will now raise a TypeError. Please use a file opened in bytes
94
- reading mode as required.
95
-
96
- Miscellaneous
97
- ~~~~~~~~~~~~~
98
-
99
- - The ``BlobWriter `` class now attempts to terminate an ongoing resumable upload if
100
- the writer exits with an exception.
101
- - Retry behavior is now identical between media operations (uploads and
102
- downloads) and other operations, and custom predicates are now supported for
103
- media operations as well.
104
- - ``Blob.download_as_filename() `` will now delete the empty file if it results in a
105
- google.cloud.exceptions.NotFound exception (HTTP 404).
106
- - Previously, object upload, metadata update, and delete methods had retries
107
- disabled by default unless the generation or metageneration was specified in
108
- the request. This has now changed so that retries are enabled by default.
109
42
110
43
Quick Start
111
44
-----------
@@ -186,6 +119,26 @@ Windows
186
119
pip install google-cloud-storage
187
120
188
121
122
+ Example Usage
123
+ ~~~~~~~~~~~~~
124
+
125
+ .. code-block :: python
126
+
127
+ # Imports the Google Cloud client library
128
+ from google.cloud import storage
129
+
130
+ # Instantiates a client
131
+ storage_client = storage.Client()
132
+
133
+ # The name for the new bucket
134
+ bucket_name = " my-new-bucket"
135
+
136
+ # Creates the new bucket
137
+ bucket = storage_client.create_bucket(bucket_name)
138
+
139
+ print (f " Bucket { bucket.name} created. " )
140
+
141
+
189
142
Tracing With OpenTelemetry
190
143
~~~~~~~~~~~~~~~~~~~~~~~~~~
191
144
@@ -240,6 +193,77 @@ For a list of libraries that can be instrumented, refer to the `OpenTelemetry Re
240
193
.. _Google Cloud Trace : https://cloud.google.com/trace
241
194
242
195
196
+ 3.0 Major Version Notes
197
+ -----------------------
198
+
199
+ Feedback Welcome
200
+ ~~~~~~~~~~~~~~~~
201
+
202
+ If you experience that backwards compatibility for your application is broken
203
+ with this major version release, please let us know through the Github issues
204
+ system. While some breaks of backwards compatibility may be unavoidable due to
205
+ new features in the major version release, we will do our best to minimize
206
+ them. Thank you.
207
+
208
+ Exception Handling
209
+ ~~~~~~~~~~~~~~~~~~
210
+
211
+ In Python Storage 3.0, the dependency ``google-resumable-media `` was integrated.
212
+ The ``google-resumable-media `` dependency included exceptions
213
+ ``google.resumable_media.common.InvalidResponse `` and
214
+ ``google.resumable_media.common.DataCorruption ``, which were often imported
215
+ directly in user application code. The replacements for these exceptions are
216
+ ``google.cloud.storage.exceptions.InvalidResponse `` and
217
+ ``google.cloud.storage.exceptions.DataCorruption ``. Please update application code
218
+ to import and use these exceptions instead.
219
+
220
+ For backwards compatibility, if ``google-resumable-media `` is installed, the new
221
+ exceptions will be defined as subclasses of the old exceptions, so applications
222
+ should continue to work without modification. This backwards compatibility
223
+ feature may be removed in a future major version update.
224
+
225
+ Some users may be using the original exception classes from the
226
+ ``google-resumable-media `` library without explicitly installing that library. So
227
+ as not to break user applications following this pattern,
228
+ ``google-resumable-media `` is still in the list of dependencies in this package's
229
+ setup.py file. Applications which do not import directly from
230
+ ``google-resumable-media `` can safely disregard this dependency.
231
+ This backwards compatibility feature **will be removed ** in a future major
232
+ version update. Please migrate to using the ``google.cloud.storage.exceptions ``
233
+ classes as above.
234
+
235
+ Checksum Defaults
236
+ ~~~~~~~~~~~~~~~~~
237
+
238
+ In Python Storage 3.0, uploads and downloads now have a default of "auto" where
239
+ applicable. "Auto" will use crc32c checksums, except for unusual cases where the
240
+ fast (C extension) crc32c implementation is not available, in which case it will
241
+ use md5 instead. Before Python Storage 3.0, the default was md5 for most
242
+ downloads and None for most uploads. Note that ranged downloads ("start" or
243
+ "end" set) still do not support any checksumming, and some features in
244
+ ``transfer_manager.py `` still support crc32c only.
245
+
246
+ Note: The method ``Blob.upload_from_file() `` requires a file in bytes mode, but
247
+ when checksum is set to None, as was the previous default, would not throw an
248
+ error if passed a file in string mode under some circumstances. With the new
249
+ defaults, it will now raise a TypeError. Please use a file opened in bytes
250
+ reading mode as required.
251
+
252
+ Miscellaneous
253
+ ~~~~~~~~~~~~~
254
+
255
+ - The ``BlobWriter `` class now attempts to terminate an ongoing resumable upload if
256
+ the writer exits with an exception.
257
+ - Retry behavior is now identical between media operations (uploads and
258
+ downloads) and other operations, and custom predicates are now supported for
259
+ media operations as well.
260
+ - ``Blob.download_as_filename() `` will now delete the empty file if it results in a
261
+ google.cloud.exceptions.NotFound exception (HTTP 404).
262
+ - Previously, object upload, metadata update, and delete methods had retries
263
+ disabled by default unless the generation or metageneration was specified in
264
+ the request. This has now changed so that retries are enabled by default.
265
+
266
+
243
267
Next Steps
244
268
~~~~~~~~~~
245
269
0 commit comments