Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: googleapis/python-storage
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.38.0
Choose a base ref
...
head repository: googleapis/python-storage
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.39.0
Choose a head ref

Commits on Apr 27, 2021

  1. chore(revert): revert preventing normalization (#421)

    reverts previous commit for preventing normalization of versioning
    dandhlee authored Apr 27, 2021
    Copy the full SHA
    a91cbb6 View commit details

Commits on Apr 28, 2021

  1. chore: use gcp-sphinx-docfx-yaml (#423)

    makes use of the updated plugin for generating DocFX YAMLs
    dandhlee authored Apr 28, 2021
    Copy the full SHA
    801206d View commit details

Commits on Apr 30, 2021

  1. chore: add SECURITY.md (#424)

    Co-authored-by: google-cloud-policy-bot[bot] <80869356+google-cloud-policy-bot[bot]@users.noreply.github.com>
    google-cloud-policy-bot[bot] authored Apr 30, 2021
    Copy the full SHA
    9777904 View commit details

Commits on May 5, 2021

  1. tests: fix unit tests broken by dependency drift (#430)

    * tests: fix 'TestClient.test_ctor_wo_project'
    
    Broken by googleapis/python-cloud-core#51
    
    Closes #427
    
    * chore(deps): pin googleapis-common-protos' FBO python2.7
    
    Closes #429
    tseaver authored May 5, 2021
    Copy the full SHA
    2e70a58 View commit details

Commits on May 6, 2021

  1. Copy the full SHA
    246a13b View commit details

Commits on May 8, 2021

  1. fix: replace python lifecycle action parsing ValueError with warning (#…

    …437)
    
    * fix: replace python lifecycle action parsing ValueError with warning
    
    * fix lint
    
    * add client upgrade suggestion to unknown OLM rule warning
    
    * update warning message
    cojenco authored May 8, 2021
    Copy the full SHA
    2532d50 View commit details

Commits on May 12, 2021

  1. Copy the full SHA
    1f96069 View commit details

Commits on May 18, 2021

  1. chore(deps): update precommit hook pre-commit/pre-commit-hooks to v4 (#…

    …444)
    
    [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
    
    This PR contains the following updates:
    
    | Package | Type | Update | Change |
    |---|---|---|---|
    | [pre-commit/pre-commit-hooks](https://togithub.com/pre-commit/pre-commit-hooks) | repository | major | `v3.4.0` -> `v4.0.1` |
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>pre-commit/pre-commit-hooks</summary>
    
    ### [`v4.0.1`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.1)
    
    [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v4.0.0...v4.0.1)
    
    ##### Fixes
    
    -   `check-shebang-scripts-are-executable` fix entry point.
        -   [#&#8203;602](https://togithub.com/pre-commit/pre-commit-hooks/issues/602) issue by [@&#8203;Person-93](https://togithub.com/Person-93).
        -   [#&#8203;603](https://togithub.com/pre-commit/pre-commit-hooks/issues/603) PR by [@&#8203;scop](https://togithub.com/scop).
    
    ### [`v4.0.0`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.0)
    
    [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v4.0.0)
    
    ##### Features
    
    -   `check-json`: report duplicate keys.
        -   [#&#8203;558](https://togithub.com/pre-commit/pre-commit-hooks/issues/558) PR by [@&#8203;AdityaKhursale](https://togithub.com/AdityaKhursale).
        -   [#&#8203;554](https://togithub.com/pre-commit/pre-commit-hooks/issues/554) issue by [@&#8203;adamchainz](https://togithub.com/adamchainz).
    -   `no-commit-to-branch`: add `main` to default blocked branches.
        -   [#&#8203;565](https://togithub.com/pre-commit/pre-commit-hooks/issues/565) PR by [@&#8203;ndevenish](https://togithub.com/ndevenish).
    -   `check-case-conflict`: check conflicts in directory names as well.
        -   [#&#8203;575](https://togithub.com/pre-commit/pre-commit-hooks/issues/575) PR by [@&#8203;slsyy](https://togithub.com/slsyy).
        -   [#&#8203;70](https://togithub.com/pre-commit/pre-commit-hooks/issues/70) issue by [@&#8203;andyjack](https://togithub.com/andyjack).
    -   `check-vcs-permalinks`: forbid other branch names.
        -   [#&#8203;582](https://togithub.com/pre-commit/pre-commit-hooks/issues/582) PR by [@&#8203;jack1142](https://togithub.com/jack1142).
        -   [#&#8203;581](https://togithub.com/pre-commit/pre-commit-hooks/issues/581) issue by [@&#8203;jack1142](https://togithub.com/jack1142).
    -   `check-shebang-scripts-are-executable`: new hook which ensures shebang'd scripts are executable.
        -   [#&#8203;545](https://togithub.com/pre-commit/pre-commit-hooks/issues/545) PR by [@&#8203;scop](https://togithub.com/scop).
    
    ##### Fixes
    
    -   `check-executables-have-shebangs`: Short circuit shebang lookup on windows.
        -   [#&#8203;544](https://togithub.com/pre-commit/pre-commit-hooks/issues/544) PR by [@&#8203;scop](https://togithub.com/scop).
    -   `requirements-txt-fixer`: Fix comments which have indentation
        -   [#&#8203;549](https://togithub.com/pre-commit/pre-commit-hooks/issues/549) PR by [@&#8203;greshilov](https://togithub.com/greshilov).
        -   [#&#8203;548](https://togithub.com/pre-commit/pre-commit-hooks/issues/548) issue by [@&#8203;greshilov](https://togithub.com/greshilov).
    -   `pretty-format-json`: write to stdout using UTF-8 encoding.
        -   [#&#8203;571](https://togithub.com/pre-commit/pre-commit-hooks/issues/571) PR by [@&#8203;jack1142](https://togithub.com/jack1142).
        -   [#&#8203;570](https://togithub.com/pre-commit/pre-commit-hooks/issues/570) issue by [@&#8203;jack1142](https://togithub.com/jack1142).
    -   Use more inclusive language.
        -   [#&#8203;599](https://togithub.com/pre-commit/pre-commit-hooks/issues/599) PR by [@&#8203;asottile](https://togithub.com/asottile).
    
    ##### Breaking changes
    
    -   Remove deprecated hooks: `flake8`, `pyflakes`, `autopep8-wrapper`.
        -   [#&#8203;597](https://togithub.com/pre-commit/pre-commit-hooks/issues/597) PR by [@&#8203;asottile](https://togithub.com/asottile).
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: At any time (no schedule defined).
    
    🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
    
    ♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
    
    ---
    
     - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.
    
    ---
    
    This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-storage).
    renovate-bot authored May 18, 2021
    Copy the full SHA
    3fb5086 View commit details

Commits on May 20, 2021

  1. chore: migrate to owl bot (#412)

    * chore: migrate to owl bot
    
    * chore: run the post processor
    
    * 🦉 Updates from OwlBot
    
    Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
    parthea and gcf-owl-bot[bot] authored May 20, 2021
    Copy the full SHA
    179de2a View commit details
  2. fix: add ConnectionError to default retry (#445)

    This adds python built-in [ConnectionError](https://docs.python.org/3/library/exceptions.html#ConnectionError) to default retryable types. 
    ConnectionError was recently added in the [BigQuery library](googleapis/python-bigquery#571) to allow retries. 
    
    Fixes #426 🦕
    cojenco authored May 20, 2021
    Copy the full SHA
    8344253 View commit details
  3. chore: suppress renovate for googleapis-common-protos (#434)

    See #432, which undoes the work of #430.
    tseaver authored May 20, 2021
    Copy the full SHA
    34ce17e View commit details

Commits on May 22, 2021

  1. chore: new owl bot post processor docker image (#448)

    gcr.io/repo-automation-bots/owlbot-python:latest@sha256:3c3a445b3ddc99ccd5d31edc4b4519729635d20693900db32c4f587ed51f7479
    gcf-owl-bot[bot] authored May 22, 2021
    Copy the full SHA
    c7c71cd View commit details

Commits on May 28, 2021

  1. chore: new owl bot post processor docker image (#452)

    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:c66ba3c8d7bc8566f47df841f98cd0097b28fff0b1864c86f5817f4c8c3e8600
    gcf-owl-bot[bot] authored May 28, 2021
    Copy the full SHA
    fe87755 View commit details

Commits on Jun 7, 2021

  1. refactor: add / use 'Client._get_resource' method (#431)

    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 #38
    
    ~~Based on top of the branch from #430.  I will rebase when that PR merges.~~
    tseaver authored Jun 7, 2021
    Copy the full SHA
    e0f1b71 View commit details
  2. refactor: add / use 'Client._patch_resource' method (#436)

    Add retry support to 'ACL.save', 'ACL.save_predefined', and 'ACL.clear'.
    
    Add 'timeout' and 'retry' support to 'Blob.make_private'.
    
    Toward #38.
    tseaver authored Jun 7, 2021
    Copy the full SHA
    e96f852 View commit details
  3. Copy the full SHA
    3a8a920 View commit details
  4. refactor: add / use 'Client._delete_resource' method (#442)

    Also, forward 'retry' through when deleting blobs during 'Bucket.delete'.
    
    Toward #38.
    tseaver authored Jun 7, 2021
    Copy the full SHA
    94fd0ca View commit details

Commits on Jun 8, 2021

  1. Copy the full SHA
    ef764ac View commit details
  2. fix: apply idempotency policies for ACLs (#458)

    * fix: use 'retry=None' as default for 'Client._put_resource'
    * fix: use 'retry=None' as default for 'Client._patch_resource'
    * fix: force 'retry=None' for 'ACL.{save,save_predefined,clear}'
    * fix: remove 'retry' arg from 'Bucket.make_public'
    * fix: remove 'retry' arg from 'Bucket.make_private'
    * fix: remove 'retry' arg from 'Blob.make_public'
    * fix: remove 'retry' arg from 'Blob.make_private'
    
    Per idempotency policy.
    tseaver authored Jun 8, 2021
    Copy the full SHA
    2232f38 View commit details
  3. refactor: add / use 'Client._list_resource' method (#446)

    * 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
    tseaver authored Jun 8, 2021
    Copy the full SHA
    6bd8a20 View commit details

Commits on Jun 9, 2021

  1. tests: avoid requiring real credentials in unit tests (#459)

    Adjust 'Bucket.get_upload_policy' to use credentials from the client,
    rather than its connection.
    
    Closes #416.
    tseaver authored Jun 9, 2021
    Copy the full SHA
    2c87f2f View commit details

Commits on Jun 10, 2021

  1. docs: streamline 'timeout' / 'retry' docs in docstrings (#461)

    * Add 'requests' intersphinx refs
    * Add narrative docs for timeouts and retries
    * Include API docs for the 'retry' module, as well, to unbreak links.
    * Replace boilerplate docstring entries for 'timeout' / 'retry' with links to new narrative docs.
    * Add docstrings for default conditional policies.
    
    Closes #455.
    tseaver authored Jun 10, 2021
    Copy the full SHA
    78b2eba View commit details

Commits on Jun 11, 2021

  1. feat: media operation retries can be configured using the same interf…

    …ace as with non-media operation (#447)
    
    All media operation calls (downloads and uploads) can be configured with Retry objects and ConditionalRetryPolicy objects, nearly identically to non-media operations. This is accomplished by converting the Retry object to a google-resumable-media-python library RetryStrategy object at the point of entry to that library.
    
    Custom predicates of Retry objects (for instance set with Retry(predicate=...)) are not supported for media operations; they will be replaced with a media-operation-specific predicate.
    
    This change is backwards-compatible for users of public methods using num_retries arguments to configure uploads; num_retries continue to be supported but the deprecation warning remains in effect. They will be fully removed and replaced with Retry objects in the future.
    
    With this change, the default parameters for a media operations retry changes to be uniform with non-media operation retries. Specifically, the retry deadline for media operation retries becomes 120 seconds unless otherwise configured.
    andrewsg authored Jun 11, 2021
    Copy the full SHA
    0dbbb8a View commit details

Commits on Jun 14, 2021

  1. fix: revise blob.compose query parameters if_generation_match (#454)

    * revise blob.compose logic to match API usage
    
    * update tests
    
    * update system test
    
    * address comments
    
    * 🦉 Updates from OwlBot
    
    * revise logic for backwards compatibility
    
    * add tests
    
    * revise docstring
    
    * fix test
    
    * revise to DeprecationWarning
    
    * address comments and revise docstrings
    
    Co-authored-by: Tres Seaver <tseaver@palladion.com>
    Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
    3 people authored Jun 14, 2021
    Copy the full SHA
    70d19e7 View commit details

Commits on Jun 17, 2021

  1. chore: new owl bot post processor docker image (#470)

    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:58c7342b0bccf85028100adaa3d856cb4a871c22ca9c01960d996e66c40548ce
    gcf-owl-bot[bot] authored Jun 17, 2021
    Copy the full SHA
    ae8b655 View commit details

Commits on Jun 20, 2021

  1. chore: update precommit hook pre-commit/pre-commit-hooks to v4 (#1083) (

    #472)
    
    [![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)
    
    This PR contains the following updates:
    
    | Package | Type | Update | Change |
    |---|---|---|---|
    | [pre-commit/pre-commit-hooks](https://togithub.com/pre-commit/pre-commit-hooks) | repository | major | `v3.4.0` -> `v4.0.1` |
    
    ---
    
    ### Release Notes
    
    <details>
    <summary>pre-commit/pre-commit-hooks</summary>
    
    ### [`v4.0.1`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.1)
    
    [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v4.0.0...v4.0.1)
    
    ##### Fixes
    
    -   `check-shebang-scripts-are-executable` fix entry point.
        -   [#&#8203;602](https://togithub.com/pre-commit/pre-commit-hooks/issues/602) issue by [@&#8203;Person-93](https://togithub.com/Person-93).
        -   [#&#8203;603](https://togithub.com/pre-commit/pre-commit-hooks/issues/603) PR by [@&#8203;scop](https://togithub.com/scop).
    
    ### [`v4.0.0`](https://togithub.com/pre-commit/pre-commit-hooks/releases/v4.0.0)
    
    [Compare Source](https://togithub.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v4.0.0)
    
    ##### Features
    
    -   `check-json`: report duplicate keys.
        -   [#&#8203;558](https://togithub.com/pre-commit/pre-commit-hooks/issues/558) PR by [@&#8203;AdityaKhursale](https://togithub.com/AdityaKhursale).
        -   [#&#8203;554](https://togithub.com/pre-commit/pre-commit-hooks/issues/554) issue by [@&#8203;adamchainz](https://togithub.com/adamchainz).
    -   `no-commit-to-branch`: add `main` to default blocked branches.
        -   [#&#8203;565](https://togithub.com/pre-commit/pre-commit-hooks/issues/565) PR by [@&#8203;ndevenish](https://togithub.com/ndevenish).
    -   `check-case-conflict`: check conflicts in directory names as well.
        -   [#&#8203;575](https://togithub.com/pre-commit/pre-commit-hooks/issues/575) PR by [@&#8203;slsyy](https://togithub.com/slsyy).
        -   [#&#8203;70](https://togithub.com/pre-commit/pre-commit-hooks/issues/70) issue by [@&#8203;andyjack](https://togithub.com/andyjack).
    -   `check-vcs-permalinks`: forbid other branch names.
        -   [#&#8203;582](https://togithub.com/pre-commit/pre-commit-hooks/issues/582) PR by [@&#8203;jack1142](https://togithub.com/jack1142).
        -   [#&#8203;581](https://togithub.com/pre-commit/pre-commit-hooks/issues/581) issue by [@&#8203;jack1142](https://togithub.com/jack1142).
    -   `check-shebang-scripts-are-executable`: new hook which ensures shebang'd scripts are executable.
        -   [#&#8203;545](https://togithub.com/pre-commit/pre-commit-hooks/issues/545) PR by [@&#8203;scop](https://togithub.com/scop).
    
    ##### Fixes
    
    -   `check-executables-have-shebangs`: Short circuit shebang lookup on windows.
        -   [#&#8203;544](https://togithub.com/pre-commit/pre-commit-hooks/issues/544) PR by [@&#8203;scop](https://togithub.com/scop).
    -   `requirements-txt-fixer`: Fix comments which have indentation
        -   [#&#8203;549](https://togithub.com/pre-commit/pre-commit-hooks/issues/549) PR by [@&#8203;greshilov](https://togithub.com/greshilov).
        -   [#&#8203;548](https://togithub.com/pre-commit/pre-commit-hooks/issues/548) issue by [@&#8203;greshilov](https://togithub.com/greshilov).
    -   `pretty-format-json`: write to stdout using UTF-8 encoding.
        -   [#&#8203;571](https://togithub.com/pre-commit/pre-commit-hooks/issues/571) PR by [@&#8203;jack1142](https://togithub.com/jack1142).
        -   [#&#8203;570](https://togithub.com/pre-commit/pre-commit-hooks/issues/570) issue by [@&#8203;jack1142](https://togithub.com/jack1142).
    -   Use more inclusive language.
        -   [#&#8203;599](https://togithub.com/pre-commit/pre-commit-hooks/issues/599) PR by [@&#8203;asottile](https://togithub.com/asottile).
    
    ##### Breaking changes
    
    -   Remove deprecated hooks: `flake8`, `pyflakes`, `autopep8-wrapper`.
        -   [#&#8203;597](https://togithub.com/pre-commit/pre-commit-hooks/issues/597) PR by [@&#8203;asottile](https://togithub.com/asottile).
    
    </details>
    
    ---
    
    ### Configuration
    
    📅 **Schedule**: At any time (no schedule defined).
    
    🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.
    
    ♻️ **Rebasing**: Renovate will not automatically rebase this PR, because other commits have been found.
    
    🔕 **Ignore**: Close this PR and you won't be reminded about this update again.
    
    ---
    
     - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.
    
    ---
    
    This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/synthtool).
    Source-Link: googleapis/synthtool@333fd90
    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3
    gcf-owl-bot[bot] authored Jun 20, 2021
    Copy the full SHA
    73ee6e3 View commit details

Commits on Jun 21, 2021

  1. tests: harden 'test_bucket_w_default_event_based_hold' (#468)

    Reload blob w/ spurious EBH.
    
    Closes #435.
    tseaver authored Jun 21, 2021
    Copy the full SHA
    3b06f9e View commit details
  2. tests: pre-scrub old HMAC keys before testing creation (#467)

    Avoids hitting 5-key-per-service-account quota.
    
    Closes #334.
    tseaver authored Jun 21, 2021
    Copy the full SHA
    cf22a11 View commit details
  3. docs: streamline docstrings for conditional parmas (#464)

    Add narrative docs for conditional params:
    
    - 'if_generation_match'
    - 'if_generation_not_match'
    - 'if_metageneration_match'
    - 'if_metageneration_not_match'
    
    Streamline docstrings for conditional params, linking to new narrative docs.
    
    Also, move 'timeout' argument to end (just before 'retry', if present) for consistency.
    
    Closes #460.
    tseaver authored Jun 21, 2021
    Copy the full SHA
    6999370 View commit details

Commits on Jun 22, 2021

  1. chore: release 1.39.0 (#465)

    Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
    release-please[bot] authored Jun 22, 2021
    Copy the full SHA
    edce85e View commit details
Showing with 8,382 additions and 6,174 deletions.
  1. +1 −0 .flake8
  2. +3 −0 .github/.OwlBot.lock.yaml
  3. +19 −0 .github/.OwlBot.yaml
  4. +15 −0 .github/header-checker-lint.yml
  5. +3 −1 .gitignore
  6. +20 −6 .kokoro/build.sh
  7. +1 −1 .kokoro/docs/common.cfg
  8. +11 −0 .kokoro/docs/docs-presubmit.cfg
  9. +2 −2 .kokoro/release.sh
  10. +2 −12 .kokoro/release/common.cfg
  11. +6 −0 .kokoro/samples/python3.6/common.cfg
  12. +11 −0 .kokoro/samples/python3.6/periodic-head.cfg
  13. +6 −0 .kokoro/samples/python3.7/common.cfg
  14. +11 −0 .kokoro/samples/python3.7/periodic-head.cfg
  15. +6 −0 .kokoro/samples/python3.8/common.cfg
  16. +11 −0 .kokoro/samples/python3.8/periodic-head.cfg
  17. +28 −0 .kokoro/test-samples-against-head.sh
  18. +102 −0 .kokoro/test-samples-impl.sh
  19. +16 −74 .kokoro/test-samples.sh
  20. +16 −2 .pre-commit-config.yaml
  21. +1 −0 .repo-metadata.json
  22. +1 −0 .trampolinerc
  23. +21 −0 CHANGELOG.md
  24. +87 −36 CODE_OF_CONDUCT.md
  25. +4 −3 LICENSE
  26. +2 −2 MANIFEST.in
  27. +7 −0 SECURITY.md
  28. +17 −1 docs/_static/custom.css
  29. +25 −9 docs/conf.py
  30. +127 −0 docs/generation_metageneration.rst
  31. +2 −0 docs/index.rst
  32. +152 −0 docs/retry_timeout.rst
  33. +99 −112 google/cloud/storage/_helpers.py
  34. +43 −36 google/cloud/storage/acl.py
  35. +3 −5 google/cloud/storage/batch.py
  36. +628 −514 google/cloud/storage/blob.py
  37. +256 −559 google/cloud/storage/bucket.py
  38. +490 −139 google/cloud/storage/client.py
  39. +113 −23 google/cloud/storage/fileio.py
  40. +28 −93 google/cloud/storage/hmac_key.py
  41. +30 −81 google/cloud/storage/notification.py
  42. +29 −1 google/cloud/storage/retry.py
  43. +1 −1 google/cloud/storage/version.py
  44. +10 −11 noxfile.py
  45. +5 −1 synth.py → owlbot.py
  46. +5 −1 renovate.json
  47. +3 −16 setup.py
  48. +0 −83 synth.metadata
  49. +81 −6 tests/system/test_system.py
  50. +297 −237 tests/unit/test__helpers.py
  51. +276 −216 tests/unit/test_acl.py
  52. +1,732 −1,261 tests/unit/test_blob.py
  53. +1,806 −1,457 tests/unit/test_bucket.py
  54. +1,183 −931 tests/unit/test_client.py
  55. +254 −14 tests/unit/test_fileio.py
  56. +114 −115 tests/unit/test_hmac_key.py
  57. +139 −112 tests/unit/test_notification.py
  58. +21 −0 tests/unit/test_retry.py
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ exclude =
*_pb2.py

# Standard linting exemptions.
**/.nox/**
__pycache__,
.git,
*.pyc,
3 changes: 3 additions & 0 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
digest: sha256:b8c131c558606d3cea6e18f8e87befbd448c1482319b0db3c5d5388fa6ea72e3
19 changes: 19 additions & 0 deletions .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest

begin-after-commit-hash: 6acf4a0a797f1082027985c55c4b14b60f673dd7

15 changes: 15 additions & 0 deletions .github/header-checker-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{"allowedCopyrightHolders": ["Google LLC"],
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
"sourceFileExtensions": [
"ts",
"js",
"java",
"sh",
"Dockerfile",
"yaml",
"py",
"html",
"txt"
]
}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -50,8 +50,10 @@ docs.metadata

# Virtual environment
env/

# Test logs
coverage.xml
sponge_log.xml
*sponge_log.xml

# System test environment variables.
system_tests/local_test_setup
26 changes: 20 additions & 6 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
@@ -15,7 +15,11 @@

set -eo pipefail

cd github/python-storage
if [[ -z "${PROJECT_ROOT:-}" ]]; then
PROJECT_ROOT="github/python-storage"
fi

cd "${PROJECT_ROOT}"

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
@@ -30,16 +34,26 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")

# Remove old nox
python3.6 -m pip uninstall --yes --quiet nox-automation
python3 -m pip uninstall --yes --quiet nox-automation

# Install nox
python3.6 -m pip install --upgrade --quiet nox
python3.6 -m nox --version
python3 -m pip install --upgrade --quiet nox
python3 -m nox --version

# If this is a continuous build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
cleanup() {
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
}
trap cleanup EXIT HUP
fi

# If NOX_SESSION is set, it only runs the specified session,
# otherwise run all the sessions.
if [[ -n "${NOX_SESSION:-}" ]]; then
python3.6 -m nox -s "${NOX_SESSION:-}"
python3 -m nox -s ${NOX_SESSION:-}
else
python3.6 -m nox
python3 -m nox
fi
2 changes: 1 addition & 1 deletion .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ env_vars: {

env_vars: {
key: "V2_STAGING_BUCKET"
value: "docs-staging-v2-staging"
value: "docs-staging-v2"
}

# It will upload the docker image after successful builds.
11 changes: 11 additions & 0 deletions .kokoro/docs/docs-presubmit.cfg
Original file line number Diff line number Diff line change
@@ -15,3 +15,14 @@ env_vars: {
key: "TRAMPOLINE_IMAGE_UPLOAD"
value: "false"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-storage/.kokoro/build.sh"
}

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "docs docfx"
}
4 changes: 2 additions & 2 deletions .kokoro/release.sh
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools
export PYTHONUNBUFFERED=1

# Move into the package, build the distribution and upload.
TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token")
cd github/python-storage
python3 setup.py sdist bdist_wheel
twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/*
14 changes: 2 additions & 12 deletions .kokoro/release/common.cfg
Original file line number Diff line number Diff line change
@@ -23,18 +23,8 @@ env_vars: {
value: "github/python-storage/.kokoro/release.sh"
}

# Fetch PyPI password
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "google_cloud_pypi_password"
}
}
}

# Tokens needed to report release status back to GitHub
env_vars: {
key: "SECRET_MANAGER_KEYS"
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem"
}
value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.6/common.cfg
Original file line number Diff line number Diff line change
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.6"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py36"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-storage/.kokoro/test-samples.sh"
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.6/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.7/common.cfg
Original file line number Diff line number Diff line change
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.7"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py37"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-storage/.kokoro/test-samples.sh"
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.7/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.8/common.cfg
Original file line number Diff line number Diff line change
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.8"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py38"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-storage/.kokoro/test-samples.sh"
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.8/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
}
28 changes: 28 additions & 0 deletions .kokoro/test-samples-against-head.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# A customized test runner for samples.
#
# For periodic builds, you can specify this file for testing against head.

# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

cd github/python-storage

exec .kokoro/test-samples-impl.sh
102 changes: 102 additions & 0 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/bin/bash
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar

# Exit early if samples directory doesn't exist
if [ ! -d "./samples" ]; then
echo "No tests run. `./samples` not found"
exit 0
fi

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Debug: show build environment
env | grep KOKORO

# Install nox
python3.6 -m pip install --upgrade --quiet nox

# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
gcloud auth activate-service-account \
--key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
--project="cloud-devrel-kokoro-resources"
fi

# This script will create 3 files:
# - testing/test-env.sh
# - testing/service-account.json
# - testing/client-secrets.json
./scripts/decrypt-secrets.sh

source ./testing/test-env.sh
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json

# For cloud-run session, we activate the service account for gcloud sdk.
gcloud auth activate-service-account \
--key-file "${GOOGLE_APPLICATION_CREDENTIALS}"

export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json

echo -e "\n******************** TESTING PROJECTS ********************"

# Switch to 'fail at end' to allow all tests to complete before exiting.
set +e
# Use RTN to return a non-zero value if the test fails.
RTN=0
ROOT=$(pwd)
# Find all requirements.txt in the samples directory (may break on whitespace).
for file in samples/**/requirements.txt; do
cd "$ROOT"
# Navigate to the project folder.
file=$(dirname "$file")
cd "$file"

echo "------------------------------------------------------------"
echo "- testing $file"
echo "------------------------------------------------------------"

# Use nox to execute the tests for the project.
python3.6 -m nox -s "$RUN_TESTS_SESSION"
EXIT=$?

# If this is a periodic build, send the test log to the FlakyBot.
# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
$KOKORO_GFILE_DIR/linux_amd64/flakybot
fi

if [[ $EXIT -ne 0 ]]; then
RTN=1
echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
else
echo -e "\n Testing completed.\n"
fi

done
cd "$ROOT"

# Workaround for Kokoro permissions issue: delete secrets
rm testing/{test-env.sh,client-secrets.json,service-account.json}

exit "$RTN"
Loading