Skip to content

Commit

Permalink
chore(python): fix docs publish build
Browse files Browse the repository at this point in the history
Source-Link: googleapis/synthtool@bd9ede2
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:04c35dc5f49f0f503a306397d6d043685f8d2bb822ab515818c4208d7fb2db3a
  • Loading branch information
gcf-owl-bot[bot] committed Jan 16, 2025
1 parent 5fcbcbb commit ce06c9c
Show file tree
Hide file tree
Showing 18 changed files with 425 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2024 Google LLC
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:e8dcfd7cbfd8beac3a3ff8d3f3185287ea0625d859168cc80faccfc9a7a00455
# created: 2024-09-16T21:04:09.091105552Z
digest: sha256:04c35dc5f49f0f503a306397d6d043685f8d2bb822ab515818c4208d7fb2db3a
# created: 2025-01-16T15:24:11.364245182Z
1 change: 1 addition & 0 deletions .github/release-trigger.yml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
enabled: true
multiScmName: python-error-reporting
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
python-version: "3.10"
- name: Install nox
run: |
python -m pip install --upgrade setuptools pip wheel
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ on:
name: unittest
jobs:
unit:
runs-on: ubuntu-latest
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
# Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
runs-on: ubuntu-22.04
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .kokoro/docker/docs/requirements.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
nox
gcp-docuploader
313 changes: 284 additions & 29 deletions .kokoro/docker/docs/requirements.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .kokoro/docs/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ before_action {
}
}


#############################################
# this section merged from .kokoro/common_env_vars.cfg using owlbot.py

Expand Down
4 changes: 0 additions & 4 deletions .kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export PYTHONUNBUFFERED=1

export PATH="${HOME}/.local/bin:${PATH}"

# Install nox
python3.10 -m pip install --require-hashes -r .kokoro/requirements.txt
python3.10 -m nox --version

# build docs
nox -s docs

Expand Down
20 changes: 20 additions & 0 deletions .kokoro/release/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ env_vars: {

###################################################



#############################################
# this section merged from .kokoro/common_env_vars.cfg using owlbot.py

env_vars: {
key: "PRODUCT_AREA_LABEL"
value: "observability"
}
env_vars: {
key: "PRODUCT_LABEL"
value: "error-reporting"
}
env_vars: {
key: "LANGUAGE_LABEL"
value: "python"
}

###################################################

60 changes: 60 additions & 0 deletions .kokoro/samples/python3.13/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py-3.13"
}

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

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-error-reporting/.kokoro/test-samples.sh"
}

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download secrets for samples
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-error-reporting/.kokoro/trampoline_v2.sh"


#############################################
# this section merged from .kokoro/common_env_vars.cfg using owlbot.py

env_vars: {
key: "PRODUCT_AREA_LABEL"
value: "observability"
}
env_vars: {
key: "PRODUCT_LABEL"
value: "error-reporting"
}
env_vars: {
key: "LANGUAGE_LABEL"
value: "python"
}

###################################################

6 changes: 6 additions & 0 deletions .kokoro/samples/python3.13/continuous.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}
11 changes: 11 additions & 0 deletions .kokoro/samples/python3.13/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-error-reporting/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.13/periodic.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.13/presubmit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}
3 changes: 2 additions & 1 deletion .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export PYTHONUNBUFFERED=1
env | grep KOKORO

# Install nox
python3.9 -m pip install --upgrade --quiet nox
# `virtualenv==20.26.6` is added for Python 3.7 compatibility
python3.9 -m pip install --upgrade --quiet nox virtualenv==20.26.6

# Use secrets acessor service account to get secrets
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
Expand Down
6 changes: 4 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ In order to add a feature:
documentation.

- The feature must work fully on the following CPython versions:
3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 on both UNIX and Windows.
3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13 on both UNIX and Windows.

- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
Expand Down Expand Up @@ -72,7 +72,7 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests.

- To run a single unit test::

$ nox -s unit-3.12 -- -k <name of test>
$ nox -s unit-3.13 -- -k <name of test>


.. note::
Expand Down Expand Up @@ -227,13 +227,15 @@ We support:
- `Python 3.10`_
- `Python 3.11`_
- `Python 3.12`_
- `Python 3.13`_

.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
.. _Python 3.9: https://docs.python.org/3.9/
.. _Python 3.10: https://docs.python.org/3.10/
.. _Python 3.11: https://docs.python.org/3.11/
.. _Python 3.12: https://docs.python.org/3.12/
.. _Python 3.13: https://docs.python.org/3.13/


Supported versions can be found in our ``noxfile.py`` `config`_.
Expand Down
18 changes: 13 additions & 5 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,15 @@

DEFAULT_PYTHON_VERSION = "3.8"

UNIT_TEST_PYTHON_VERSIONS: List[str] = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
UNIT_TEST_PYTHON_VERSIONS: List[str] = [
"3.7",
"3.8",
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
]
UNIT_TEST_STANDARD_DEPENDENCIES = [
"mock",
"asyncmock",
Expand Down Expand Up @@ -62,7 +70,6 @@

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()

# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
nox.options.sessions = [
"unit",
"system",
Expand All @@ -71,6 +78,7 @@
"lint_setup_py",
"blacken",
"docs",
"docfx",
"format",
]

Expand Down Expand Up @@ -167,7 +175,7 @@ def install_unittest_dependencies(session, *constraints):
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
Expand Down Expand Up @@ -367,15 +375,15 @@ def docfx(session):
)


@nox.session(python="3.12")
@nox.session(python="3.13")
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def prerelease_deps(session, protobuf_implementation):
"""Run all tests with prerelease versions of dependencies installed."""

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12", "3.13"):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
":preserveSemverRanges",
":disableDependencyDashboard"
],
"ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py"],
"ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py", ".github/workflows/unittest.yml"],
"pip_requirements": {
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
}
Expand Down

0 comments on commit ce06c9c

Please sign in to comment.