Skip to content

Commit

Permalink
feat: Add support for Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Oct 10, 2024
1 parent 2a64229 commit ae8438b
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 52 deletions.
12 changes: 10 additions & 2 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ branchProtectionRules:
- 'mypy (3.10)'
- 'mypy (3.11)'
- 'mypy (3.12)'
- 'mypy (3.13)'
- 'showcase (3.7, showcase)'
- 'showcase (3.12, showcase)'
- 'showcase (3.13, showcase)'
- 'showcase (3.7, showcase_alternative_templates)'
- 'showcase (3.12, showcase_alternative_templates)'
- 'showcase (3.13, showcase_alternative_templates)'
# TODO(dovs): reenable these when the mtls tests have been debugged and fixed
# See #1218 for details
# - 'showcase-mtls (showcase_mtls)'
Expand All @@ -28,24 +29,28 @@ branchProtectionRules:
- 'showcase-unit (3.10)'
- 'showcase-unit (3.11)'
- 'showcase-unit (3.12)'
- 'showcase-unit (3.13)'
- 'showcase-unit (3.7, _alternative_templates)'
- 'showcase-unit (3.8, _alternative_templates)'
- 'showcase-unit (3.9, _alternative_templates)'
- 'showcase-unit (3.10, _alternative_templates)'
- 'showcase-unit (3.11, _alternative_templates)'
- 'showcase-unit (3.12, _alternative_templates)'
- 'showcase-unit (3.13, _alternative_templates)'
- 'showcase-unit (3.7, _alternative_templates_mixins)'
- 'showcase-unit (3.8, _alternative_templates_mixins)'
- '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.13, _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 (3.13, _mixins)'
- 'showcase-unit-add-iam-methods'
- 'integration'
- 'goldens-lint'
Expand All @@ -58,18 +63,21 @@ branchProtectionRules:
- 'unit (3.10)'
- 'unit (3.11)'
- 'unit (3.12)'
- 'unit (3.13)'
- 'fragment (3.7)'
- 'fragment (3.8)'
- 'fragment (3.9)'
- 'fragment (3.10)'
- 'fragment (3.11)'
- 'fragment (3.12)'
- 'fragment (3.13)'
- '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)'
- 'fragment (3.13, _alternative_templates)'
- 'OwlBot Post Processor'
requiredApprovingReviewCount: 1
requiresCodeOwnerReviews: true
Expand Down
50 changes: 24 additions & 26 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
matrix:
# Run mypy on all of the supported python versions listed in setup.py
# https://github.com/python/mypy/blob/master/setup.py
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -56,7 +56,7 @@ jobs:
# Run showcase tests on the lowest and highest supported runtimes
matrix:
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `showcase_w_rest_async` target when async rest is GA.
python: ["3.7", "3.12"]
python: ["3.7", "3.13"]
target: [showcase, showcase_alternative_templates, showcase_w_rest_async]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -104,10 +104,10 @@ jobs:
run: |
sudo mkdir -p /tmp/workspace/tests/cert/
sudo chown -R ${USER} /tmp/workspace/
- name: Set up Python "3.12"
- name: Set up Python "3.13"
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'
- name: Copy mtls files
run: cp tests/cert/mtls.* /tmp/workspace/tests/cert/
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
showcase-unit:
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"]
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `_w_rest_async` variant when async rest is GA.
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -171,10 +171,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python "3.12"
- name: Set up Python "3.13"
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'
- name: Install system dependencies.
run: |
Expand All @@ -199,10 +199,10 @@ jobs:
variant: ['', _alternative_templates]
steps:
- uses: actions/checkout@v4
- name: Set up Python "3.12"
- name: Set up Python "3.13"
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'
- name: Install system dependencies.
run: |
Expand All @@ -224,10 +224,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python "3.12"
- name: Set up Python "3.13"
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'
- name: Install system dependencies.
run: |
Expand All @@ -240,7 +240,7 @@ jobs:
unit:
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"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -261,7 +261,7 @@ jobs:
fragment:
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"]
variant: ['', _alternative_templates]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -313,29 +313,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
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.12 blacken lint
nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.12 blacken lint
nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.12 blacken lint
nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.12 blacken lint
nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.12 blacken lint
nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.13 blacken lint
nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.13 blacken lint
nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.13 blacken lint
nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.13 blacken lint
nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.13 blacken lint
goldens-prerelease:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: "3.12"
python-version: "3.13"
cache: 'pip'
- name: Install nox.
run: |
Expand All @@ -353,12 +353,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python "3.11"
- name: Set up Python "3.13"
uses: actions/setup-python@v5
with:
# Do not upgrade this check to python 3.12 until
# https://github.com/hhatto/autopep8/issues/712 is fixed
python-version: "3.11"
python-version: "3.13"
cache: 'pip'
- name: Install autopep8
run: |
Expand Down
1 change: 1 addition & 0 deletions gapic/ads-templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ALL_PYTHON = [
"3.10",
"3.11",
"3.12",
"3.13",
]

@nox.session(python=ALL_PYTHON)
Expand Down
1 change: 1 addition & 0 deletions gapic/ads-templates/setup.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ setuptools.setup(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Internet",
],
Expand Down
9 changes: 5 additions & 4 deletions gapic/templates/noxfile.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ALL_PYTHON = [
"3.9",
"3.10",
"3.11",
"3.12"
"3.12",
"3.13",
]

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
Expand All @@ -28,7 +29,7 @@ PACKAGE_NAME = '{{ api.naming.warehouse_package_name }}'

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"]
DEFAULT_PYTHON_VERSION = "3.12"
DEFAULT_PYTHON_VERSION = "3.13"

nox.sessions = [
"unit",
Expand All @@ -50,7 +51,7 @@ nox.sessions = [
def unit(session, protobuf_implementation):
"""Run the unit test suite."""

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+")

session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"')
Expand Down Expand Up @@ -84,7 +85,7 @@ def unit(session, protobuf_implementation):
def prerelease_deps(session, protobuf_implementation):
"""Run the unit test suite against pre-release versions of dependencies."""

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 test environment dependencies
Expand Down
1 change: 1 addition & 0 deletions gapic/templates/setup.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ setuptools.setup(
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Internet",
],
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"3.10",
"3.11",
"3.12",
"3.13",
)

NEWEST_PYTHON = ALL_PYTHON[-1]
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Software Development :: Code Generators",
"Topic :: Software Development :: Libraries :: Python Modules",
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/goldens/asset/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"3.9",
"3.10",
"3.11",
"3.12"
"3.12",
"3.13",
]

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
Expand All @@ -39,7 +40,7 @@

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"]
DEFAULT_PYTHON_VERSION = "3.12"
DEFAULT_PYTHON_VERSION = "3.13"

nox.sessions = [
"unit",
Expand All @@ -61,7 +62,7 @@
def unit(session, protobuf_implementation):
"""Run the unit test suite."""

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+")

session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"')
Expand Down Expand Up @@ -94,7 +95,7 @@ def unit(session, protobuf_implementation):
def prerelease_deps(session, protobuf_implementation):
"""Run the unit test suite against pre-release versions of dependencies."""

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 test environment dependencies
Expand Down
1 change: 1 addition & 0 deletions tests/integration/goldens/asset/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Internet",
],
Expand Down
9 changes: 5 additions & 4 deletions tests/integration/goldens/credentials/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"3.9",
"3.10",
"3.11",
"3.12"
"3.12",
"3.13",
]

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
Expand All @@ -39,7 +40,7 @@

BLACK_VERSION = "black==22.3.0"
BLACK_PATHS = ["docs", "google", "tests", "samples", "noxfile.py", "setup.py"]
DEFAULT_PYTHON_VERSION = "3.12"
DEFAULT_PYTHON_VERSION = "3.13"

nox.sessions = [
"unit",
Expand All @@ -61,7 +62,7 @@
def unit(session, protobuf_implementation):
"""Run the unit test suite."""

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+")

session.install('coverage', 'pytest', 'pytest-cov', 'pytest-asyncio', 'asyncmock; python_version < "3.8"')
Expand Down Expand Up @@ -94,7 +95,7 @@ def unit(session, protobuf_implementation):
def prerelease_deps(session, protobuf_implementation):
"""Run the unit test suite against pre-release versions of dependencies."""

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 test environment dependencies
Expand Down
1 change: 1 addition & 0 deletions tests/integration/goldens/credentials/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: OS Independent",
"Topic :: Internet",
],
Expand Down
Loading

0 comments on commit ae8438b

Please sign in to comment.