From 874b67b3c73cc524c137f2ac193e6242521fcc6d Mon Sep 17 00:00:00 2001 From: omair Date: Thu, 19 Oct 2023 18:57:09 +0000 Subject: [PATCH] feat: add support for python 3.12 --- .github/sync-repo-settings.yaml | 6 +++ .github/workflows/tests.yaml | 48 +++++++++---------- BUILD.bazel | 2 +- WORKSPACE | 2 +- gapic/ads-templates/noxfile.py.j2 | 1 + gapic/ads-templates/setup.py.j2 | 1 + gapic/templates/noxfile.py.j2 | 3 +- gapic/templates/setup.py.j2 | 1 + noxfile.py | 1 + tests/integration/goldens/asset/noxfile.py | 3 +- tests/integration/goldens/asset/setup.py | 1 + .../goldens/credentials/noxfile.py | 3 +- .../integration/goldens/credentials/setup.py | 1 + tests/integration/goldens/eventarc/noxfile.py | 3 +- tests/integration/goldens/eventarc/setup.py | 1 + tests/integration/goldens/logging/noxfile.py | 3 +- tests/integration/goldens/logging/setup.py | 1 + tests/integration/goldens/redis/noxfile.py | 3 +- tests/integration/goldens/redis/setup.py | 1 + 19 files changed, 53 insertions(+), 32 deletions(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index bae183f3b0..7638a75eab 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -21,6 +21,7 @@ branchProtectionRules: - 'showcase-unit (3.9)' - 'showcase-unit (3.10)' - 'showcase-unit (3.11)' + - 'showcase-unit (3.12)' - 'showcase-unit (3.7, _alternative_templates)' - 'showcase-unit (3.8, _alternative_templates)' - 'showcase-unit (3.9, _alternative_templates)' @@ -31,11 +32,13 @@ branchProtectionRules: - 'showcase-unit (3.9, _alternative_templates_mixins)' - 'showcase-unit (3.10, _alternative_templates_mixins)' - 'showcase-unit (3.11, _alternative_templates_mixins)' + - 'showcase-unit (3.12, _alternative_templates_mixins)' - 'showcase-unit (3.7, _mixins)' - 'showcase-unit (3.8, _mixins)' - 'showcase-unit (3.9, _mixins)' - 'showcase-unit (3.10, _mixins)' - 'showcase-unit (3.11, _mixins)' + - 'showcase-unit (3.12, _mixins)' - 'showcase-unit-add-iam-methods' - 'integration' - 'goldens-lint' @@ -46,16 +49,19 @@ branchProtectionRules: - 'unit (3.9)' - 'unit (3.10)' - 'unit (3.11)' + - 'unit (3.12)' - 'fragment (3.7)' - 'fragment (3.8)' - 'fragment (3.9)' - 'fragment (3.10)' - 'fragment (3.11)' + - 'fragment (3.12)' - 'fragment (3.7, _alternative_templates)' - 'fragment (3.8, _alternative_templates)' - 'fragment (3.9, _alternative_templates)' - 'fragment (3.10, _alternative_templates)' - 'fragment (3.11, _alternative_templates)' + - 'fragment (3.12, _alternative_templates)' - 'OwlBot Post Processor' requiredApprovingReviewCount: 1 requiresCodeOwnerReviews: true diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 1d464c51c9..6ec4542b64 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -36,10 +36,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install nox. run: python -m pip install nox @@ -52,10 +52,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install system dependencies. run: | @@ -95,10 +95,10 @@ jobs: run: | sudo mkdir -p /tmp/workspace/tests/cert/ sudo chown -R ${USER} /tmp/workspace/ - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Copy mtls files run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/ @@ -131,7 +131,7 @@ jobs: showcase-unit: strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins] runs-on: ubuntu-latest steps: @@ -161,10 +161,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install system dependencies. run: | @@ -189,10 +189,10 @@ jobs: variant: ['', _alternative_templates] steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install system dependencies. run: | @@ -214,10 +214,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install system dependencies. run: | @@ -230,7 +230,7 @@ jobs: unit: strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -251,7 +251,7 @@ jobs: fragment: strategy: matrix: - python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] variant: ['', _alternative_templates] runs-on: ubuntu-latest steps: @@ -303,29 +303,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install nox. run: | python -m pip install nox - name: Run blacken and lint on the generated output. run: | - nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.11 blacken lint_setup_py lint - nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.11 blacken lint_setup_py lint - nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.11 blacken lint_setup_py lint - nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.11 blacken lint_setup_py lint - nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.11 blacken lint_setup_py lint + nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.12 blacken lint_setup_py lint + nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.12 blacken lint_setup_py lint + nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.12 blacken lint_setup_py lint + nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.12 blacken lint_setup_py lint + nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.12 blacken lint_setup_py lint style-check: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Python "3.11" + - name: Set up Python "3.12" uses: actions/setup-python@v4 with: - python-version: "3.11" + python-version: "3.12" cache: 'pip' - name: Install autopep8 run: | diff --git a/BUILD.bazel b/BUILD.bazel index 7dab7fa253..51ccfd3320 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -66,4 +66,4 @@ py_binary( requirement("PyYAML"), requirement("grpc-google-iam-v1"), ], -) +) \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE index 6820894328..edcecaee26 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -105,4 +105,4 @@ switched_rules_by_language( name = "com_google_googleapis_imports", gapic = True, grpc = True, -) +) \ No newline at end of file diff --git a/gapic/ads-templates/noxfile.py.j2 b/gapic/ads-templates/noxfile.py.j2 index 91380ededd..f10310fdfb 100644 --- a/gapic/ads-templates/noxfile.py.j2 +++ b/gapic/ads-templates/noxfile.py.j2 @@ -13,6 +13,7 @@ ALL_PYTHON = [ "3.9", "3.10", "3.11", + "3.12", ] @nox.session(python=ALL_PYTHON) diff --git a/gapic/ads-templates/setup.py.j2 b/gapic/ads-templates/setup.py.j2 index 584d3c53cf..b3a8b6d77a 100644 --- a/gapic/ads-templates/setup.py.j2 +++ b/gapic/ads-templates/setup.py.j2 @@ -47,6 +47,7 @@ setuptools.setup( 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', ], diff --git a/gapic/templates/noxfile.py.j2 b/gapic/templates/noxfile.py.j2 index c592f65146..66f86fb660 100644 --- a/gapic/templates/noxfile.py.j2 +++ b/gapic/templates/noxfile.py.j2 @@ -17,6 +17,7 @@ ALL_PYTHON = [ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -26,7 +27,7 @@ PACKAGE_NAME = subprocess.check_output([sys.executable, "setup.py", "--name"], e BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/gapic/templates/setup.py.j2 b/gapic/templates/setup.py.j2 index 16041ab4e9..549d148a57 100644 --- a/gapic/templates/setup.py.j2 +++ b/gapic/templates/setup.py.j2 @@ -77,6 +77,7 @@ setuptools.setup( "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/noxfile.py b/noxfile.py index 152f9f68f7..376afe44a3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -39,6 +39,7 @@ "3.9", "3.10", "3.11", + "3.12", ) NEWEST_PYTHON = ALL_PYTHON[-1] diff --git a/tests/integration/goldens/asset/noxfile.py b/tests/integration/goldens/asset/noxfile.py index c333de24af..fe07873927 100755 --- a/tests/integration/goldens/asset/noxfile.py +++ b/tests/integration/goldens/asset/noxfile.py @@ -28,6 +28,7 @@ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -37,7 +38,7 @@ BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/tests/integration/goldens/asset/setup.py b/tests/integration/goldens/asset/setup.py index 4353b691d2..dd17f631fa 100755 --- a/tests/integration/goldens/asset/setup.py +++ b/tests/integration/goldens/asset/setup.py @@ -80,6 +80,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/tests/integration/goldens/credentials/noxfile.py b/tests/integration/goldens/credentials/noxfile.py index b4f8b23509..31725e6488 100755 --- a/tests/integration/goldens/credentials/noxfile.py +++ b/tests/integration/goldens/credentials/noxfile.py @@ -28,6 +28,7 @@ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -37,7 +38,7 @@ BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/tests/integration/goldens/credentials/setup.py b/tests/integration/goldens/credentials/setup.py index 98a42b7ba2..2a4cfbfe43 100755 --- a/tests/integration/goldens/credentials/setup.py +++ b/tests/integration/goldens/credentials/setup.py @@ -77,6 +77,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/tests/integration/goldens/eventarc/noxfile.py b/tests/integration/goldens/eventarc/noxfile.py index 6d840f9658..d6d52a61c5 100755 --- a/tests/integration/goldens/eventarc/noxfile.py +++ b/tests/integration/goldens/eventarc/noxfile.py @@ -28,6 +28,7 @@ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -37,7 +38,7 @@ BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/tests/integration/goldens/eventarc/setup.py b/tests/integration/goldens/eventarc/setup.py index 6cba716bea..018ec428a8 100755 --- a/tests/integration/goldens/eventarc/setup.py +++ b/tests/integration/goldens/eventarc/setup.py @@ -78,6 +78,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/tests/integration/goldens/logging/noxfile.py b/tests/integration/goldens/logging/noxfile.py index db2905b4a3..9d3b834085 100755 --- a/tests/integration/goldens/logging/noxfile.py +++ b/tests/integration/goldens/logging/noxfile.py @@ -28,6 +28,7 @@ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -37,7 +38,7 @@ BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/tests/integration/goldens/logging/setup.py b/tests/integration/goldens/logging/setup.py index 96a1235326..3148679fcb 100755 --- a/tests/integration/goldens/logging/setup.py +++ b/tests/integration/goldens/logging/setup.py @@ -77,6 +77,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ], diff --git a/tests/integration/goldens/redis/noxfile.py b/tests/integration/goldens/redis/noxfile.py index 0b02ca125e..4d5bd567aa 100755 --- a/tests/integration/goldens/redis/noxfile.py +++ b/tests/integration/goldens/redis/noxfile.py @@ -28,6 +28,7 @@ "3.9", "3.10", "3.11", + "3.12" ] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -37,7 +38,7 @@ BLACK_VERSION = "black==22.3.0" BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"] -DEFAULT_PYTHON_VERSION = "3.11" +DEFAULT_PYTHON_VERSION = "3.12" nox.sessions = [ "unit", diff --git a/tests/integration/goldens/redis/setup.py b/tests/integration/goldens/redis/setup.py index 4ccd159d12..51b5b6014d 100755 --- a/tests/integration/goldens/redis/setup.py +++ b/tests/integration/goldens/redis/setup.py @@ -77,6 +77,7 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", "Topic :: Internet", ],