From be6fb87d6d3e00d798b37dc89324ca88d3da6107 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Thu, 24 Mar 2022 12:37:34 -0600 Subject: [PATCH 1/3] fix(deps): require google-api-core >= 1.31.5, >= 2.3.2 on v1 release (#260) * chore(deps): allow google-api-core v2 on v1 release * ci: fix docs build * chore: lint Co-authored-by: Anthonios Partheniou --- noxfile.py | 4 +++- setup.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index fcfde61..7fd3734 100644 --- a/noxfile.py +++ b/noxfile.py @@ -171,7 +171,9 @@ def docfx(session): """Build the docfx yaml files for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark", "sphinx-docfx-yaml") + session.install( + "sphinx<3.0.0", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml" + ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/setup.py b/setup.py index 3899f26..934ca61 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ version = "1.0.3" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.14.0, < 2.0.0dev", + "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", 'enum34; python_version < "3.4"', "grafeas < 1.0.0dev", From 8cbbed6969c1da0214532411f7d51aa116769bc0 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Fri, 25 Mar 2022 12:18:33 -0600 Subject: [PATCH 2/3] chore: set up CI on v1 branch (#263) * chore: add basic CI to v1 branch * chore: try using nox -s cover * chore: go back to running cover directly * chore: fail under 45 * chore: use sphinx 4 * chore: use sphinx 2 * chore: py 3.7 in GH workflows files * chore: add docfx * chore: format * chore: blacken Co-authored-by: Charles Engelke --- .github/workflows/docs.yml | 38 ++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 58 ++++++++++++++++++++++++++++++++++ .kokoro/release.sh | 4 +-- .kokoro/release/common.cfg | 34 +++----------------- noxfile.py | 10 ++++-- 6 files changed, 135 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..39ee41b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - v1 +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx \ No newline at end of file diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..bc3bfb5 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - v1 +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..f93325a --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,58 @@ +on: + pull_request: + branches: + - v1 +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8'] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v3 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v3 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=45 + diff --git a/.kokoro/release.sh b/.kokoro/release.sh index ab45f68..2973c5c 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -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_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-containeranalysis python3 setup.py sdist bdist_wheel -twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/* +twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 56fda51..052e643 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,42 +23,18 @@ env_vars: { value: "github/python-containeranalysis/.kokoro/release.sh" } -# Fetch the token needed for reporting release status to GitHub -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "yoshi-automation-github-key" - } - } -} - # Fetch PyPI password before_action { fetch_keystore { keystore_resource { keystore_config_id: 73713 - keyname: "google_cloud_pypi_password" + keyname: "google-cloud-pypi-token-keystore-1" } } } -# Fetch magictoken to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "releasetool-magictoken" - } - } -} - -# Fetch api key to use with Magic Github Proxy -before_action { - fetch_keystore { - keystore_resource { - keystore_config_id: 73713 - keyname: "magic-github-proxy-api-key" - } - } +# 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" } diff --git a/noxfile.py b/noxfile.py index 7fd3734..5ffa286 100644 --- a/noxfile.py +++ b/noxfile.py @@ -45,7 +45,7 @@ def lint(session): session.run("flake8", "google", "tests") -@nox.session(python="3.6") +@nox.session(python=DEFAULT_PYTHON_VERSION) def blacken(session): """Run black. @@ -149,7 +149,7 @@ def docs(session): """Build the docs for this library.""" session.install("-e", ".") - session.install("sphinx<3.0.0", "alabaster", "recommonmark") + session.install("sphinx<3.0.0", "alabaster", "recommonmark", "Jinja2<3.1") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( @@ -172,7 +172,11 @@ def docfx(session): session.install("-e", ".") session.install( - "sphinx<3.0.0", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml" + "sphinx<3.0.0", + "alabaster", + "recommonmark", + "gcp-sphinx-docfx-yaml", + "Jinja2<3.1", ) shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) From f7e979c8e0768fc2876e892096d38abc8803c333 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 11:35:31 -0600 Subject: [PATCH 3/3] chore(v1): release 1.0.4 (#270) * chore(v1): release 1.0.4 * chore: format Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Bu Sun Kim --- CHANGELOG.md | 7 +++++++ docs/conf.py | 17 ++++++++++------- .../gapic/container_analysis_client.py | 19 ++++++++++++++----- noxfile.py | 13 +++++++++---- setup.py | 2 +- 5 files changed, 41 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d84aec6..2d6a4c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### [1.0.4](https://github.com/googleapis/python-containeranalysis/compare/v1.0.3...v1.0.4) (2022-04-04) + + +### Bug Fixes + +* **deps:** require google-api-core >= 1.31.5, >= 2.3.2 on v1 release ([#260](https://github.com/googleapis/python-containeranalysis/issues/260)) ([be6fb87](https://github.com/googleapis/python-containeranalysis/commit/be6fb87d6d3e00d798b37dc89324ca88d3da6107)) + ### [1.0.3](https://www.github.com/googleapis/python-containeranalysis/compare/v1.0.2...v1.0.3) (2020-08-11) diff --git a/docs/conf.py b/docs/conf.py index 9fb6f92..5cadbc3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -66,9 +66,9 @@ master_doc = "index" # General information about the project. -project = u"google-cloud-containeranalysis" -copyright = u"2019, Google" -author = u"Google APIs" +project = "google-cloud-containeranalysis" +copyright = "2019, Google" +author = "Google APIs" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -267,7 +267,7 @@ ( master_doc, "google-cloud-containeranalysis.tex", - u"google-cloud-containeranalysis Documentation", + "google-cloud-containeranalysis Documentation", author, "manual", ) @@ -302,7 +302,7 @@ ( master_doc, "google-cloud-containeranalysis", - u"google-cloud-containeranalysis Documentation", + "google-cloud-containeranalysis Documentation", [author], 1, ) @@ -321,7 +321,7 @@ ( master_doc, "google-cloud-containeranalysis", - u"google-cloud-containeranalysis Documentation", + "google-cloud-containeranalysis Documentation", author, "google-cloud-containeranalysis", "google-cloud-containeranalysis Library", @@ -346,7 +346,10 @@ intersphinx_mapping = { "python": ("http://python.readthedocs.org/en/latest/", None), "google-auth": ("https://google-auth.readthedocs.io/en/stable", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.io/grpc/python/", None), } diff --git a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py index e03791b..6475aa5 100644 --- a/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py +++ b/google/cloud/devtools/containeranalysis_v1/gapic/container_analysis_client.py @@ -179,8 +179,12 @@ def __init__( ) self.transport = transport else: - self.transport = container_analysis_grpc_transport.ContainerAnalysisGrpcTransport( - address=api_endpoint, channel=channel, credentials=credentials, + self.transport = ( + container_analysis_grpc_transport.ContainerAnalysisGrpcTransport( + address=api_endpoint, + channel=channel, + credentials=credentials, + ) ) if client_info is None: @@ -289,7 +293,10 @@ def set_iam_policy( client_info=self._client_info, ) - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,) + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + policy=policy, + ) if metadata is None: metadata = [] metadata = list(metadata) @@ -374,7 +381,8 @@ def get_iam_policy( ) request = iam_policy_pb2.GetIamPolicyRequest( - resource=resource, options=options_, + resource=resource, + options=options_, ) if metadata is None: metadata = [] @@ -461,7 +469,8 @@ def test_iam_permissions( ) request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions, + resource=resource, + permissions=permissions, ) if metadata is None: metadata = [] diff --git a/noxfile.py b/noxfile.py index 5ffa286..a90f834 100644 --- a/noxfile.py +++ b/noxfile.py @@ -23,7 +23,7 @@ import nox -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -40,7 +40,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *BLACK_PATHS, ) session.run("flake8", "google", "tests") @@ -57,7 +59,8 @@ def blacken(session): """ session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *BLACK_PATHS, ) @@ -120,7 +123,9 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. session.install( - "mock", "pytest", "google-cloud-testutils", + "mock", + "pytest", + "google-cloud-testutils", ) session.install("-e", ".") diff --git a/setup.py b/setup.py index 934ca61..4ea8ae4 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ name = "google-cloud-containeranalysis" description = "Container Analysis API API client library" -version = "1.0.3" +version = "1.0.4" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",