Skip to content
This repository was archived by the owner on Oct 31, 2023. It is now read-only.
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-binary-authorization
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.0
Choose a base ref
...
head repository: googleapis/python-binary-authorization
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.1
Choose a head ref
  • 8 commits
  • 13 files changed
  • 3 contributors

Commits on Jul 14, 2021

  1. build(python): exit with success status if no samples found (#53)

    Source-Link: googleapis/synthtool@53ea389
    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c
    gcf-owl-bot[bot] authored Jul 14, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2b8c5b3 View commit details
  2. build(python): remove python 3.7 from kokoro Dockerfile (#54)

    Source-Link: googleapis/synthtool@e44dc0c
    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d
    gcf-owl-bot[bot] authored Jul 14, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a3f5721 View commit details

Commits on Jul 20, 2021

  1. fix(deps): pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x …

    …versions (#55)
    
    Expand pins on library dependencies in preparation for these dependencies taking a new major version. See googleapis/google-cloud-python#10566.
    busunkim96 authored Jul 20, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0ca0dc2 View commit details

Commits on Jul 22, 2021

  1. feat: add Samples section to CONTRIBUTING.rst (#56)

    Source-Link: googleapis/synthtool@52e4e46
    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:6186535cbdbf6b9fe61f00294929221d060634dae4a0795c1cefdbc995b2d605
    gcf-owl-bot[bot] authored Jul 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c641b6c View commit details

Commits on Jul 23, 2021

  1. chore: fix kokoro config for samples (#59)

    Source-Link: googleapis/synthtool@dd05f9d
    Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b
    gcf-owl-bot[bot] authored Jul 23, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0278607 View commit details

Commits on Jul 24, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1a65f17 View commit details

Commits on Jul 26, 2021

  1. chore: release 0.3.1 (#60)

    Next release is incorrect due to a docs change being merged as a `feat`. See #58.
    
    Release-As: 0.3.1
    busunkim96 authored Jul 26, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e2b54b5 View commit details
  2. chore: release 0.3.1 (#62)

    🤖 I have created a release \*beep\* \*boop\*
    ---
    ### [0.3.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.3.0...v0.3.1) (2021-07-26)
    
    
    ### Bug Fixes
    
    * **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#55](https://www.github.com/googleapis/python-binary-authorization/issues/55)) ([0ca0dc2](https://www.github.com/googleapis/python-binary-authorization/commit/0ca0dc2671bb8920f56bcbd057b9a13d7b23bf7f))
    * enable self signed jwt for grpc ([#61](https://www.github.com/googleapis/python-binary-authorization/issues/61)) ([1a65f17](https://www.github.com/googleapis/python-binary-authorization/commit/1a65f171f677b7ca659ffe98051f432bed342209))
    
    
    ### Documentation
    
    * add Samples section to CONTRIBUTING.rst ([#56](https://www.github.com/googleapis/python-binary-authorization/issues/56)) ([c641b6c](https://www.github.com/googleapis/python-binary-authorization/commit/c641b6c148779e1952149e5ce5edf62fa0a1c642))
    
    
    ### Miscellaneous Chores
    
    * release 0.3.1 ([#60](https://www.github.com/googleapis/python-binary-authorization/issues/60)) ([e2b54b5](https://www.github.com/googleapis/python-binary-authorization/commit/e2b54b5a97f23c6a01bce151b4fb5809f089f1d6))
    ---
    
    
    This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
    release-please[bot] authored Jul 26, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    0b93c64 View commit details
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
digest: sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719
digest: sha256:aea14a583128771ae8aefa364e1652f3c56070168ef31beb203534222d842b8b
35 changes: 2 additions & 33 deletions .kokoro/docker/docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ RUN apt-get update \
libssl-dev \
libsqlite3-dev \
portaudio19-dev \
python3-distutils \
redis-server \
software-properties-common \
ssh \
@@ -59,40 +60,8 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb


COPY fetch_gpg_keys.sh /tmp
# Install the desired versions of Python.
RUN set -ex \
&& export GNUPGHOME="$(mktemp -d)" \
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
&& /tmp/fetch_gpg_keys.sh \
&& for PYTHON_VERSION in 3.7.8 3.8.5; do \
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
&& rm python-${PYTHON_VERSION}.tar.xz \
&& cd /usr/src/python-${PYTHON_VERSION} \
&& ./configure \
--enable-shared \
# This works only on Python 2.7 and throws a warning on every other
# version, but seems otherwise harmless.
--enable-unicode=ucs4 \
--with-system-ffi \
--without-ensurepip \
&& make -j$(nproc) \
&& make install \
&& ldconfig \
; done \
&& rm -rf "${GNUPGHOME}" \
&& rm -rf /usr/src/python* \
&& rm -rf ~/.cache/

RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
&& python3.7 /tmp/get-pip.py \
&& python3.8 /tmp/get-pip.py \
&& rm /tmp/get-pip.py

CMD ["python3.7"]
CMD ["python3.8"]
45 changes: 0 additions & 45 deletions .kokoro/docker/docs/fetch_gpg_keys.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .kokoro/samples/python3.6/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-binary-authorization/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.7/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-binary-authorization/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.8/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-binary-authorization/.kokoro/test-samples-against-head.sh"
}
2 changes: 1 addition & 1 deletion .kokoro/samples/python3.9/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -7,5 +7,5 @@ env_vars: {

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-pubsub/.kokoro/test-samples-against-head.sh"
value: "github/python-binary-authorization/.kokoro/test-samples-against-head.sh"
}
6 changes: 3 additions & 3 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
@@ -20,9 +20,9 @@ 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 early if samples don't exist
if ! find samples -name 'requirements.txt' | grep -q .; then
echo "No tests run. './samples/**/requirements.txt' not found"
exit 0
fi

18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

### [0.3.1](https://www.github.com/googleapis/python-binary-authorization/compare/v0.3.0...v0.3.1) (2021-07-26)


### Bug Fixes

* **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#55](https://www.github.com/googleapis/python-binary-authorization/issues/55)) ([0ca0dc2](https://www.github.com/googleapis/python-binary-authorization/commit/0ca0dc2671bb8920f56bcbd057b9a13d7b23bf7f))
* enable self signed jwt for grpc ([#61](https://www.github.com/googleapis/python-binary-authorization/issues/61)) ([1a65f17](https://www.github.com/googleapis/python-binary-authorization/commit/1a65f171f677b7ca659ffe98051f432bed342209))


### Documentation

* add Samples section to CONTRIBUTING.rst ([#56](https://www.github.com/googleapis/python-binary-authorization/issues/56)) ([c641b6c](https://www.github.com/googleapis/python-binary-authorization/commit/c641b6c148779e1952149e5ce5edf62fa0a1c642))


### Miscellaneous Chores

* release 0.3.1 ([#60](https://www.github.com/googleapis/python-binary-authorization/issues/60)) ([e2b54b5](https://www.github.com/googleapis/python-binary-authorization/commit/e2b54b5a97f23c6a01bce151b4fb5809f089f1d6))

## [0.3.0](https://www.github.com/googleapis/python-binary-authorization/compare/v0.2.2...v0.3.0) (2021-06-30)


24 changes: 24 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -177,6 +177,30 @@ Build the docs via:

$ nox -s docs

*************************
Samples and code snippets
*************************

Code samples and snippets live in the `samples/` catalogue. Feel free to
provide more examples, but make sure to write tests for those examples.
Each folder containing example code requires its own `noxfile.py` script
which automates testing. If you decide to create a new folder, you can
base it on the `samples/snippets` folder (providing `noxfile.py` and
the requirements files).

The tests will run against a real Google Cloud Project, so you should
configure them just like the System Tests.

- To run sample tests, you can execute::

# Run all tests in a folder
$ cd samples/snippets
$ nox -s py-3.8

# Run a single sample test
$ cd samples/snippets
$ nox -s py-3.8 -- -k <name of test>

********************************************
Note About ``README`` as it pertains to PyPI
********************************************
Original file line number Diff line number Diff line change
@@ -374,6 +374,10 @@ def __init__(
client_cert_source_for_mtls=client_cert_source_func,
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=(
Transport == type(self).get_transport_class("grpc")
or Transport == type(self).get_transport_class("grpc_asyncio")
),
)

def get_policy(
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

import setuptools # type: ignore

version = "0.3.0"
version = "0.3.1"

package_root = os.path.abspath(os.path.dirname(__file__))

@@ -46,7 +46,10 @@
platforms="Posix; MacOS X; Windows",
include_package_data=True,
install_requires=(
"google-api-core[grpc] >= 1.26.0, <2.0.0dev",
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.26.0, <3.0.0dev",
"proto-plus >= 1.4.0",
"packaging >= 14.3",
),
Original file line number Diff line number Diff line change
@@ -143,24 +143,6 @@ def test_binauthz_management_service_v1_beta1_client_from_service_account_info(
assert client.transport._host == "binaryauthorization.googleapis.com:443"


@pytest.mark.parametrize(
"client_class",
[
BinauthzManagementServiceV1Beta1Client,
BinauthzManagementServiceV1Beta1AsyncClient,
],
)
def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt(
client_class,
):
with mock.patch.object(
service_account.Credentials, "with_always_use_jwt_access", create=True
) as use_jwt:
creds = service_account.Credentials(None, None, None)
client = client_class(credentials=creds)
use_jwt.assert_not_called()


@pytest.mark.parametrize(
"transport_class,transport_name",
[
@@ -171,7 +153,7 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
),
],
)
def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt_true(
def test_binauthz_management_service_v1_beta1_client_service_account_always_use_jwt(
transport_class, transport_name
):
with mock.patch.object(
@@ -181,6 +163,13 @@ def test_binauthz_management_service_v1_beta1_client_service_account_always_use_
transport = transport_class(credentials=creds, always_use_jwt_access=True)
use_jwt.assert_called_once_with(True)

with mock.patch.object(
service_account.Credentials, "with_always_use_jwt_access", create=True
) as use_jwt:
creds = service_account.Credentials(None, None, None)
transport = transport_class(credentials=creds, always_use_jwt_access=False)
use_jwt.assert_not_called()


@pytest.mark.parametrize(
"client_class",
@@ -275,6 +264,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -291,6 +281,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is
@@ -307,6 +298,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)

# Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has
@@ -335,6 +327,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options(
client_cert_source_for_mtls=None,
quota_project_id="octopus",
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)


@@ -411,6 +404,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
client_cert_source_for_mtls=expected_client_cert_source,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)

# Check the case ADC client cert is provided. Whether client cert is used depends on
@@ -444,6 +438,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
client_cert_source_for_mtls=expected_client_cert_source,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)

# Check the case client_cert_source and ADC client cert are not provided.
@@ -465,6 +460,7 @@ def test_binauthz_management_service_v1_beta1_client_mtls_env_auto(
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)


@@ -499,6 +495,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_scopes(
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)


@@ -533,6 +530,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_credentials_
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)


@@ -552,6 +550,7 @@ def test_binauthz_management_service_v1_beta1_client_client_options_from_dict():
client_cert_source_for_mtls=None,
quota_project_id=None,
client_info=transports.base.DEFAULT_CLIENT_INFO,
always_use_jwt_access=True,
)