Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-google-cloud-storage for openSUSE:Factory checked in at 2022-09-13 15:10:05 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-google-cloud-storage (Old) and /work/SRC/openSUSE:Factory/.python-google-cloud-storage.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-google-cloud-storage" Tue Sep 13 15:10:05 2022 rev:15 rq:1003296 version:2.5.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-google-cloud-storage/python-google-cloud-storage.changes 2022-06-09 15:41:50.917353993 +0200 +++ /work/SRC/openSUSE:Factory/.python-google-cloud-storage.new.2083/python-google-cloud-storage.changes 2022-09-13 15:11:30.681001096 +0200 @@ -1,0 +2,7 @@ +Tue Sep 13 09:50:40 UTC 2022 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to 2.5.0 + * Custom Placement Config Dual Region Support (#819) + * open file-like objects in byte mode for uploads (#824) + +------------------------------------------------------------------- Old: ---- google-cloud-storage-2.4.0.tar.gz New: ---- google-cloud-storage-2.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-google-cloud-storage.spec ++++++ --- /var/tmp/diff_new_pack.mN1xAB/_old 2022-09-13 15:11:31.101002279 +0200 +++ /var/tmp/diff_new_pack.mN1xAB/_new 2022-09-13 15:11:31.105002291 +0200 @@ -30,7 +30,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-google-cloud-storage%{pkg_suffix} -Version: 2.4.0 +Version: 2.5.0 Release: 0 Summary: Google Cloud Storage API python client library License: Apache-2.0 ++++++ google-cloud-storage-2.4.0.tar.gz -> google-cloud-storage-2.5.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/PKG-INFO new/google-cloud-storage-2.5.0/PKG-INFO --- old/google-cloud-storage-2.4.0/PKG-INFO 2022-06-08 20:11:58.632982500 +0200 +++ new/google-cloud-storage-2.5.0/PKG-INFO 2022-08-03 18:37:45.188371400 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: google-cloud-storage -Version: 2.4.0 +Version: 2.5.0 Summary: Google Cloud Storage API client library Home-page: https://github.com/googleapis/python-storage Author: Google LLC @@ -22,28 +22,25 @@ Provides-Extra: protobuf License-File: LICENSE -Python Client for Google Cloud Storage -====================================== +Python Client for Google Cloud Storage API +========================================== -|GA| |pypi| |versions| +|stable| |pypi| |versions| -`Google Cloud Storage`_ allows you to store data on -Google infrastructure with very high reliability, performance and -availability, and can be used to distribute large data objects to users -via direct download. +`Google Cloud Storage API`_: is a durable and highly available object storage service. Google Cloud Storage is almost infinitely scalable and guarantees consistency: when a write succeeds, the latest copy of the object will be returned to any GET, globally. - `Client Library Documentation`_ -- `Storage API docs`_ +- `Product Documentation`_ -.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage + :target: https://pypi.org/project/google-cloud-storage/ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage -.. _Google Cloud Storage: https://cloud.google.com/storage/docs -.. _Client Library Documentation: https://googleapis.dev/python/storage/latest -.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1 + :target: https://pypi.org/project/google-cloud-storage/ +.. _Google Cloud Storage API: https://cloud.google.com/storage +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/storage/latest +.. _Product Documentation: https://cloud.google.com/storage Quick Start ----------- @@ -58,51 +55,56 @@ .. _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://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html Installation ~~~~~~~~~~~~ -`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. +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. -Make sure you're using Python 3.7 or later, which includes `venv`_ by default. -With `venv`, it's possible to install this library without needing system +With `virtualenv`_, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. -.. _Set up a Python development environment: https://cloud.google.com/python/docs/setup -.. _`venv`: https://docs.python.org/3/library/venv.html +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Code samples and snippets +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Code samples and snippets live in the `samples/` folder. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ +Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of +Python. + Python >= 3.7 -Deprecated Python Versions -^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _active: https://devguide.python.org/devcycle/#in-development-main-branch +.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python <= 3.6 -Python == 3.6: the last released version which supported Python 3.6 was -``google-cloud-storage 2.0.0``, released 2022-01-12. +If you are using an `end-of-life`_ +version of Python, we recommend that you update as soon as possible to an actively supported version. -Python == 3.5: the last released version which supported Python 3.5 was -``google-cloud-storage 1.32.0``, released 2020-10-16. - -Python == 2.7: the last released version which supported Python 2.7 was -``google-cloud-storage 1.44.0``, released 2022-01-05. +.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches Mac/Linux ^^^^^^^^^ .. code-block:: console - python -m venv env - source env/bin/activate - pip install google-cloud-storage + pip install virtualenv + virtualenv <your-env> + source <your-env>/bin/activate + <your-env>/bin/pip install google-cloud-storage Windows @@ -110,40 +112,20 @@ .. code-block:: console - 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() - - # 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') - - # Retrieve an existing bucket - # https://console.cloud.google.com/storage/browser/[bucket-id]/ - bucket = client.get_bucket('bucket-id') - # Then do other things... - 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.`_ + pip install virtualenv + virtualenv <your-env> + <your-env>\Scripts\activate + <your-env>\Scripts\pip.exe install google-cloud-storage + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Google Cloud Storage API + to see other available methods on the client. +- Read the `Google Cloud Storage API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `README`_ to see the full list of Cloud + APIs that we cover. -.. _Storage samples.: https://github.com/googleapis/python-storage/tree/main/samples +.. _Google Cloud Storage API Product documentation: https://cloud.google.com/storage +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/README.rst new/google-cloud-storage-2.5.0/README.rst --- old/google-cloud-storage-2.4.0/README.rst 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/README.rst 2022-08-03 18:34:53.000000000 +0200 @@ -1,25 +1,22 @@ -Python Client for Google Cloud Storage -====================================== +Python Client for Google Cloud Storage API +========================================== -|GA| |pypi| |versions| +|stable| |pypi| |versions| -`Google Cloud Storage`_ allows you to store data on -Google infrastructure with very high reliability, performance and -availability, and can be used to distribute large data objects to users -via direct download. +`Google Cloud Storage API`_: is a durable and highly available object storage service. Google Cloud Storage is almost infinitely scalable and guarantees consistency: when a write succeeds, the latest copy of the object will be returned to any GET, globally. - `Client Library Documentation`_ -- `Storage API docs`_ +- `Product Documentation`_ -.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage + :target: https://pypi.org/project/google-cloud-storage/ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage -.. _Google Cloud Storage: https://cloud.google.com/storage/docs -.. _Client Library Documentation: https://googleapis.dev/python/storage/latest -.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1 + :target: https://pypi.org/project/google-cloud-storage/ +.. _Google Cloud Storage API: https://cloud.google.com/storage +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/storage/latest +.. _Product Documentation: https://cloud.google.com/storage Quick Start ----------- @@ -34,51 +31,56 @@ .. _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://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html Installation ~~~~~~~~~~~~ -`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. +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. -Make sure you're using Python 3.7 or later, which includes `venv`_ by default. -With `venv`, it's possible to install this library without needing system +With `virtualenv`_, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. -.. _Set up a Python development environment: https://cloud.google.com/python/docs/setup -.. _`venv`: https://docs.python.org/3/library/venv.html +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Code samples and snippets +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Code samples and snippets live in the `samples/` folder. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ +Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of +Python. + Python >= 3.7 -Deprecated Python Versions -^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _active: https://devguide.python.org/devcycle/#in-development-main-branch +.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python <= 3.6 -Python == 3.6: the last released version which supported Python 3.6 was -``google-cloud-storage 2.0.0``, released 2022-01-12. +If you are using an `end-of-life`_ +version of Python, we recommend that you update as soon as possible to an actively supported version. -Python == 3.5: the last released version which supported Python 3.5 was -``google-cloud-storage 1.32.0``, released 2020-10-16. - -Python == 2.7: the last released version which supported Python 2.7 was -``google-cloud-storage 1.44.0``, released 2022-01-05. +.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches Mac/Linux ^^^^^^^^^ .. code-block:: console - python -m venv env - source env/bin/activate - pip install google-cloud-storage + pip install virtualenv + virtualenv <your-env> + source <your-env>/bin/activate + <your-env>/bin/pip install google-cloud-storage Windows @@ -86,40 +88,20 @@ .. code-block:: console - 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() - - # 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') - - # Retrieve an existing bucket - # https://console.cloud.google.com/storage/browser/[bucket-id]/ - bucket = client.get_bucket('bucket-id') - # Then do other things... - 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.`_ + pip install virtualenv + virtualenv <your-env> + <your-env>\Scripts\activate + <your-env>\Scripts\pip.exe install google-cloud-storage + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Google Cloud Storage API + to see other available methods on the client. +- Read the `Google Cloud Storage API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `README`_ to see the full list of Cloud + APIs that we cover. -.. _Storage samples.: https://github.com/googleapis/python-storage/tree/main/samples +.. _Google Cloud Storage API Product documentation: https://cloud.google.com/storage +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/google/cloud/storage/blob.py new/google-cloud-storage-2.5.0/google/cloud/storage/blob.py --- old/google-cloud-storage-2.4.0/google/cloud/storage/blob.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/google/cloud/storage/blob.py 2022-08-03 18:34:53.000000000 +0200 @@ -2456,7 +2456,7 @@ to that project. :type file_obj: file - :param file_obj: A file handle open for reading. + :param file_obj: A file handle opened in binary mode for reading. :type rewind: bool :param rewind: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/google/cloud/storage/bucket.py new/google-cloud-storage-2.5.0/google/cloud/storage/bucket.py --- old/google-cloud-storage-2.4.0/google/cloud/storage/bucket.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/google/cloud/storage/bucket.py 2022-08-03 18:34:53.000000000 +0200 @@ -2419,12 +2419,26 @@ self._location = value @property + def data_locations(self): + """Retrieve the list of regional locations for custom dual-region buckets. + + See https://cloud.google.com/storage/docs/json_api/v1/buckets and + https://cloud.google.com/storage/docs/locations + + Returns ``None`` if the property has not been set before creation, + if the bucket's resource has not been loaded from the server, + or if the bucket is not a dual-regions bucket. + :rtype: list of str or ``NoneType`` + """ + custom_placement_config = self._properties.get("customPlacementConfig", {}) + return custom_placement_config.get("dataLocations") + + @property def location_type(self): - """Retrieve or set the location type for the bucket. + """Retrieve the location type for the bucket. See https://cloud.google.com/storage/docs/storage-classes - :setter: Set the location type for this bucket. :getter: Gets the the location type for this bucket. :rtype: str or ``NoneType`` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/google/cloud/storage/client.py new/google-cloud-storage-2.5.0/google/cloud/storage/client.py --- old/google-cloud-storage-2.4.0/google/cloud/storage/client.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/google/cloud/storage/client.py 2022-08-03 18:34:53.000000000 +0200 @@ -602,6 +602,7 @@ google.cloud.exceptions.NotFound If the bucket is not found. """ + return self._connection.api_request( method="POST", path=path, @@ -847,6 +848,7 @@ project=None, user_project=None, location=None, + data_locations=None, predefined_acl=None, predefined_default_object_acl=None, timeout=_DEFAULT_TIMEOUT, @@ -876,7 +878,11 @@ location (str): (Optional) The location of the bucket. If not passed, the default location, US, will be used. If specifying a dual-region, - can be specified as a string, e.g., 'US-CENTRAL1+US-WEST1'. See: + `data_locations` should be set in conjunction.. See: + https://cloud.google.com/storage/docs/locations + data_locations (list of str): + (Optional) The list of regional locations of a custom dual-region bucket. + Dual-regions require exactly 2 regional locations. See: https://cloud.google.com/storage/docs/locations predefined_acl (str): (Optional) Name of predefined ACL to apply to bucket. See: @@ -979,6 +985,9 @@ if location is not None: properties["location"] = location + if data_locations is not None: + properties["customPlacementConfig"] = {"dataLocations": data_locations} + api_response = self._post_resource( "/b", properties, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/google/cloud/storage/version.py new/google-cloud-storage-2.5.0/google/cloud/storage/version.py --- old/google-cloud-storage-2.4.0/google/cloud/storage/version.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/google/cloud/storage/version.py 2022-08-03 18:34:53.000000000 +0200 @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.4.0" +__version__ = "2.5.0" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/google_cloud_storage.egg-info/PKG-INFO new/google-cloud-storage-2.5.0/google_cloud_storage.egg-info/PKG-INFO --- old/google-cloud-storage-2.4.0/google_cloud_storage.egg-info/PKG-INFO 2022-06-08 20:11:57.000000000 +0200 +++ new/google-cloud-storage-2.5.0/google_cloud_storage.egg-info/PKG-INFO 2022-08-03 18:37:45.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: google-cloud-storage -Version: 2.4.0 +Version: 2.5.0 Summary: Google Cloud Storage API client library Home-page: https://github.com/googleapis/python-storage Author: Google LLC @@ -22,28 +22,25 @@ Provides-Extra: protobuf License-File: LICENSE -Python Client for Google Cloud Storage -====================================== +Python Client for Google Cloud Storage API +========================================== -|GA| |pypi| |versions| +|stable| |pypi| |versions| -`Google Cloud Storage`_ allows you to store data on -Google infrastructure with very high reliability, performance and -availability, and can be used to distribute large data objects to users -via direct download. +`Google Cloud Storage API`_: is a durable and highly available object storage service. Google Cloud Storage is almost infinitely scalable and guarantees consistency: when a write succeeds, the latest copy of the object will be returned to any GET, globally. - `Client Library Documentation`_ -- `Storage API docs`_ +- `Product Documentation`_ -.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg - :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability +.. |stable| image:: https://img.shields.io/badge/support-stable-gold.svg + :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#stability-levels .. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage + :target: https://pypi.org/project/google-cloud-storage/ .. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-storage.svg - :target: https://pypi.org/project/google-cloud-storage -.. _Google Cloud Storage: https://cloud.google.com/storage/docs -.. _Client Library Documentation: https://googleapis.dev/python/storage/latest -.. _Storage API docs: https://cloud.google.com/storage/docs/json_api/v1 + :target: https://pypi.org/project/google-cloud-storage/ +.. _Google Cloud Storage API: https://cloud.google.com/storage +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/storage/latest +.. _Product Documentation: https://cloud.google.com/storage Quick Start ----------- @@ -58,51 +55,56 @@ .. _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://cloud.google.com/storage/docs/reference/libraries#setting_up_authentication +.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html Installation ~~~~~~~~~~~~ -`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. +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. -Make sure you're using Python 3.7 or later, which includes `venv`_ by default. -With `venv`, it's possible to install this library without needing system +With `virtualenv`_, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies. -.. _Set up a Python development environment: https://cloud.google.com/python/docs/setup -.. _`venv`: https://docs.python.org/3/library/venv.html +.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/ + + +Code samples and snippets +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Code samples and snippets live in the `samples/` folder. Supported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^ +Our client libraries are compatible with all current `active`_ and `maintenance`_ versions of +Python. + Python >= 3.7 -Deprecated Python Versions -^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. _active: https://devguide.python.org/devcycle/#in-development-main-branch +.. _maintenance: https://devguide.python.org/devcycle/#maintenance-branches Unsupported Python Versions ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Python <= 3.6 -Python == 3.6: the last released version which supported Python 3.6 was -``google-cloud-storage 2.0.0``, released 2022-01-12. +If you are using an `end-of-life`_ +version of Python, we recommend that you update as soon as possible to an actively supported version. -Python == 3.5: the last released version which supported Python 3.5 was -``google-cloud-storage 1.32.0``, released 2020-10-16. - -Python == 2.7: the last released version which supported Python 2.7 was -``google-cloud-storage 1.44.0``, released 2022-01-05. +.. _end-of-life: https://devguide.python.org/devcycle/#end-of-life-branches Mac/Linux ^^^^^^^^^ .. code-block:: console - python -m venv env - source env/bin/activate - pip install google-cloud-storage + pip install virtualenv + virtualenv <your-env> + source <your-env>/bin/activate + <your-env>/bin/pip install google-cloud-storage Windows @@ -110,40 +112,20 @@ .. code-block:: console - 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() - - # 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') - - # Retrieve an existing bucket - # https://console.cloud.google.com/storage/browser/[bucket-id]/ - bucket = client.get_bucket('bucket-id') - # Then do other things... - 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.`_ + pip install virtualenv + virtualenv <your-env> + <your-env>\Scripts\activate + <your-env>\Scripts\pip.exe install google-cloud-storage + +Next Steps +~~~~~~~~~~ + +- Read the `Client Library Documentation`_ for Google Cloud Storage API + to see other available methods on the client. +- Read the `Google Cloud Storage API Product documentation`_ to learn + more about the product and see How-to Guides. +- View this `README`_ to see the full list of Cloud + APIs that we cover. -.. _Storage samples.: https://github.com/googleapis/python-storage/tree/main/samples +.. _Google Cloud Storage API Product documentation: https://cloud.google.com/storage +.. _README: https://github.com/googleapis/google-cloud-python/blob/main/README.rst diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/tests/system/test_client.py new/google-cloud-storage-2.5.0/tests/system/test_client.py --- old/google-cloud-storage-2.4.0/tests/system/test_client.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/tests/system/test_client.py 2022-08-03 18:34:53.000000000 +0200 @@ -68,21 +68,21 @@ from google.cloud.storage.constants import DUAL_REGION_LOCATION_TYPE new_bucket_name = _helpers.unique_name("dual-region-bucket") - region_1 = "US-EAST1" - region_2 = "US-WEST1" - dual_region = f"{region_1}+{region_2}" + location = "US" + data_locations = ["US-EAST1", "US-WEST1"] with pytest.raises(exceptions.NotFound): storage_client.get_bucket(new_bucket_name) created = _helpers.retry_429_503(storage_client.create_bucket)( - new_bucket_name, location=dual_region + new_bucket_name, location=location, data_locations=data_locations ) buckets_to_delete.append(created) assert created.name == new_bucket_name - assert created.location == dual_region + assert created.location == location assert created.location_type == DUAL_REGION_LOCATION_TYPE + assert created.data_locations == data_locations def test_list_buckets(storage_client, buckets_to_delete): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/google-cloud-storage-2.4.0/tests/unit/test_client.py new/google-cloud-storage-2.5.0/tests/unit/test_client.py --- old/google-cloud-storage-2.4.0/tests/unit/test_client.py 2022-06-08 20:09:23.000000000 +0200 +++ new/google-cloud-storage-2.5.0/tests/unit/test_client.py 2022-08-03 18:34:53.000000000 +0200 @@ -1451,6 +1451,44 @@ _target_object=bucket, ) + def test_create_bucket_w_custom_dual_region(self): + project = "PROJECT" + bucket_name = "bucket-name" + location = "US" + data_locations = ["US-EAST1", "US-WEST1"] + api_response = { + "location": location, + "customPlacementConfig": {"dataLocations": data_locations}, + "name": bucket_name, + } + credentials = _make_credentials() + client = self._make_one(project=project, credentials=credentials) + client._post_resource = mock.Mock() + client._post_resource.return_value = api_response + + bucket = client.create_bucket( + bucket_name, location=location, data_locations=data_locations + ) + + self.assertEqual(bucket.location, location) + self.assertEqual(bucket.data_locations, data_locations) + + expected_path = "/b" + expected_data = { + "location": location, + "customPlacementConfig": {"dataLocations": data_locations}, + "name": bucket_name, + } + expected_query_params = {"project": project} + client._post_resource.assert_called_once_with( + expected_path, + expected_data, + query_params=expected_query_params, + timeout=self._get_default_timeout(), + retry=DEFAULT_RETRY, + _target_object=bucket, + ) + def test_create_bucket_w_explicit_project(self): project = "PROJECT" other_project = "other-project-123"