-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: move API-methods to client #38
Comments
…to 'Client' (#8604) towards #7762
@IlyaFaer I believe this is complete. I'm closing FR. If there's something that I missed please reopen. |
Reopening in case there's something pending. |
@IlyaFaer haven't heard back for a bit. What's remaining? |
@frankyn as I see it, Blob class Refactor and Deprecate part. |
ISTM that this effort is not complete: e.g., the client does not have a This partial refactoring complicates the tests a lot -- if it were complete, then bucket / blob unit tests would just use mocked clients and assert that the corresponding method is called correctly, rather than creating mock connections (and real clients, see #416) and grubbing around three layers down. Basically, any non-client method using the client's $ git grep api_request google/cloud/storage/{_helpers,blob,bucket,hmac_key,notification}.py
google/cloud/storage/_helpers.py: api_response = client._connection.api_request(
google/cloud/storage/_helpers.py: api_response = client._connection.api_request(
google/cloud/storage/_helpers.py: api_response = client._connection.api_request(
google/cloud/storage/blob.py: client._connection.api_request(
google/cloud/storage/blob.py: info = client._connection.api_request(
google/cloud/storage/blob.py: info = client._connection.api_request(
google/cloud/storage/blob.py: resp = client._connection.api_request(
google/cloud/storage/blob.py: api_response = client._connection.api_request(
google/cloud/storage/blob.py: api_response = client._connection.api_request(
google/cloud/storage/bucket.py: client._connection.api_request(
google/cloud/storage/bucket.py: api_request = functools.partial(
google/cloud/storage/bucket.py: client._connection.api_request, timeout=timeout, retry=retry
google/cloud/storage/bucket.py: api_request=api_request,
google/cloud/storage/bucket.py: client._connection.api_request(
google/cloud/storage/bucket.py: client._connection.api_request(
google/cloud/storage/bucket.py: copy_result = client._connection.api_request(
google/cloud/storage/bucket.py: info = client._connection.api_request(
google/cloud/storage/bucket.py: info = client._connection.api_request(
google/cloud/storage/bucket.py: resp = client._connection.api_request(
google/cloud/storage/bucket.py: api_response = client._connection.api_request(
google/cloud/storage/hmac_key.py: self._client._connection.api_request(
google/cloud/storage/hmac_key.py: self._properties = self._client._connection.api_request(
google/cloud/storage/hmac_key.py: self._properties = self._client._connection.api_request(
google/cloud/storage/hmac_key.py: self._client._connection.api_request(
google/cloud/storage/notification.py: self._properties = client._connection.api_request(
google/cloud/storage/notification.py: client._connection.api_request(
google/cloud/storage/notification.py: response = client._connection.api_request(
google/cloud/storage/notification.py: client._connection.api_request( |
Also, adjust tests for 'Bucket.list_blobs' not to depend on anything but calling 'Client.list_blobs'. Toward #38
Also, provide explicit coverage for 'client._item_to_bucket' and 'client._item_to_hmack_key_metadata' helpers. Toward #38
Also, provide explicit coverage for 'bucket._item_to_notification'. Toward #38
Also, adjust tests for 'Bucket.list_blobs' not to depend on anything but calling 'Client.list_blobs'. Toward #38
Also, provide explicit coverage for 'client._item_to_bucket' and 'client._item_to_hmack_key_metadata' helpers. Toward #38
Also, provide explicit coverage for 'bucket._item_to_notification'. Toward #38
* Adjust tests for 'Bucket.list_blobs' not to depend on anything but calling 'Client.list_blobs'. * Provide explicit coverage for 'client._item_to_bucket' and 'client._item_to_hmack_key_metadata' helpers. * Provide explicit coverage for 'bucket._item_to_notification'. Toward #38
Use an explicit helper client method for `GET` requests, rather than manipulating client's private `_connection.api_request`. As a benefit, tests get *way* clearer. Toward googleapis#38 ~~Based on top of the branch from googleapis#430. I will rebase when that PR merges.~~
Add retry support to 'ACL.save', 'ACL.save_predefined', and 'ACL.clear'. Add 'timeout' and 'retry' support to 'Blob.make_private'. Toward googleapis#38.
Also, forward 'retry' through when deleting blobs during 'Bucket.delete'. Toward googleapis#38.
* Adjust tests for 'Bucket.list_blobs' not to depend on anything but calling 'Client.list_blobs'. * Provide explicit coverage for 'client._item_to_bucket' and 'client._item_to_hmack_key_metadata' helpers. * Provide explicit coverage for 'bucket._item_to_notification'. Toward googleapis#38
Use an explicit helper client method for `GET` requests, rather than manipulating client's private `_connection.api_request`. As a benefit, tests get *way* clearer. Toward googleapis#38 ~~Based on top of the branch from googleapis#430. I will rebase when that PR merges.~~
Add retry support to 'ACL.save', 'ACL.save_predefined', and 'ACL.clear'. Add 'timeout' and 'retry' support to 'Blob.make_private'. Toward googleapis#38.
Also, forward 'retry' through when deleting blobs during 'Bucket.delete'. Toward googleapis#38.
* Adjust tests for 'Bucket.list_blobs' not to depend on anything but calling 'Client.list_blobs'. * Provide explicit coverage for 'client._item_to_bucket' and 'client._item_to_hmack_key_metadata' helpers. * Provide explicit coverage for 'bucket._item_to_notification'. Toward googleapis#38
The Cloud Storage Python client was one of the first google-cloud-python clients, intended to be more reliable and more Pythonic than the google-api-client that it replaced. It is also a 100% hand-written client. Because it predates the auto-generated google-cloud-python clients, the Cloud Storage Python client has inconsistencies with other google-cloud-python clients.
This design proposal is to bring the Cloud Storage client further into alignment with other google-cloud-python clients and make the eventual inclusion of an auto-generated gRPC transport layer less disruptive to users of the Cloud Storage client.
Design document:
https://docs.google.com/document/d/1A4FIxThZK_enK7OV9ChY54IPrlpbdHwuhvVEu6iTHxM/edit?usp=sharing
Please share your feedback on the specifics of this as comments in the design document.
CC @crwilcox @frankyn @lbristol88
Update: according to comment, we need to update samples for moved methods before deprecating the old ones.
The text was updated successfully, but these errors were encountered: