Skip to content

Conversation

@chalmerlowe
Copy link
Contributor

This commit adds support for Python 3.14 to the library.

The following changes were made:

  • Added a 3.14 trove classifier in setup.py.
  • Added a grpcio version constraint for Python 3.14 in setup.py.
  • Added a 3.14 presubmit configuration file in .kokoro/samples.
  • Added a constraints-3.14.txt file.
  • Updated the CONTRIBUTING.rst file to include 3.14.
  • Updated the README.rst file to include 3.14.
  • Updated owlbot.py to include "3.14" in unit_test_python_versions.
  • Updated noxfile.py to include "3.14" in UNIT_TEST_PYTHON_VERSIONS and the prerelease_deps session.
  • Fixed a flaky test in tests/unit/pubsub_v1/publisher/test_publisher_client.py.

This commit adds support for Python 3.14 to the library.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` file to include 3.14.
- Updated the `README.rst` file to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. labels Oct 10, 2025
@chalmerlowe
Copy link
Contributor Author

@jules
please take a look at the multiple files in .kokoro/samples/python-3.13.
Please update the directory .kokoro/samples/python-3.14 to match (add and/or edit files appropriately).

@chalmerlowe chalmerlowe marked this pull request as ready for review October 10, 2025 11:33
@chalmerlowe chalmerlowe requested review from a team as code owners October 10, 2025 11:33
google-labs-jules bot and others added 4 commits October 10, 2025 11:53
This commit adds support for Python 3.14 to the library.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` file to include 3.14.
- Updated the `README.rst` file to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Added missing configuration files to `.kokoro/samples/python3.14`.
This commit adds support for Python 3.14 to the library.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` file to include 3.14.
- Updated the `README.rst` file to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Added missing configuration files to `.kokoro/samples/python3.14`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
@abbrowne126
Copy link
Collaborator

I believe the build issue has to do with py3.7 support as per offline discussions with @parthea. He mentioned we can remove these unit tests from the kokoro build pipeline, but is it preferable for py3.7 to be dropped as part of the py3.14 support?

@daniel-sanche
Copy link

I think you'll also need to update sync-repo-settings to make 3.14 a required check

It looks like the 3.14 tests aren't even appearing in the test list currently though. I'm not sure why that would be

@@ -0,0 +1 @@
grpcio >= 1.75.1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed in the constraints file? I thought since it's in the setup.py, we'd expect this to be constrained by default.

If I understand correctly, having this as an explicit constraint might actually make us miss bugs, because we're now installing the library with a non-default configuration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To your point:

having this as an explicit constraint might actually make us miss bugs, because we're now installing the library with a non-default configuration

First, with a broad range of allowable dependencies in setup.py (which we want as a library others will consume) we have no control over what is a default configuration. The pip resolver could choose any number of combinations of dependencies. There is no such thing as a default unless you pin to exact versions.

Second, the requirement that "grpcio >= 1.75.1 is the same lower bound in setup.py and in constraints.txt and it is used only for cases where Python runtime 3.14 is installed, because this limitation is in the constraints-3.14.txt file and because we have conditional logic in the setup.py file to check for runtimes. In this case, the lower bounds are identical. Often constraints pin very specific versions of dependencies, but we have chosen to put a lower bound instead of an exact pin.

Thus, I could go either way (keep the constraint OR ditch it).

For context: Pip resolves dependencies per requirements in setup.py (or pyproject.toml) and as a widely used library we strive to keep that range of available dependencies as wide as possible to ensure we minimize dependency conflicts. Constraints files do NOT impact builds unless the user specifically tells pip to use them in the resolution process by passing in the --constraints or -c argument (i.e. pip install my_package -c constraints.txt). I acknowledge that we currently capture the need for a version >= x in the setup.py file so theoretically we don't need to include anything in a constraints.txt.

However: having the value in the constraints.txt file does several things:

  • It provides the user with a clear picture of known good configurations that we have "tested against" (i.e. in our noxfiles we explicitly tell nox to install using constraints.txt). Now, this would be more precise if we pinned to a specific version in the constraint file, but we aren't doing that here.
  • It serves as a redundancy against unexpected or accidental changes to the ranges delimited in setup.py.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not too worried either way. As you say, the bounds in the constraints and the setup are identical, so it feels like having this here is unnecessary, but not a problem either

It serves as a redundancy against unexpected or accidental changes to the ranges delimited in setup.py.

This situation was the concern I had in mind though. If we accidentally lost the grpc version requirement somehow, the tests would still pass because of this constraint, even though real users would run into issues. It seems safer to have the tests fail in that situation, I don't think we'd want redundancy

@daniel-sanche
Copy link

daniel-sanche commented Oct 10, 2025

One more thing I ran into to hopefully save you some time: You'll need to update this list to skip the cpp unit tests

I did this:

py_version = tuple([int(v) for v in session.python.split(".")])
if protobuf_implementation == "cpp" and py_version >= (3, 11):
    session.skip("cpp implementation is not supported in python 3.11+")

google-labs-jules bot and others added 2 commits October 13, 2025 09:27
This commit adds support for Python 3.14 to the library and drops support for Python 3.7 and 3.8.

The following changes were made:
- Dropped support for Python 3.7 and 3.8 across all configuration files, documentation, and CI/CD pipelines.
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` file to include 3.14 and remove 3.7/3.8.
- Updated the `README.rst` file to include 3.14 and remove 3.7/3.8.
- Updated `owlbot.py` to include "3.14" and remove "3.7"/"3.8" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" and remove "3.7"/"3.8" in `UNIT_TEST_PYTHON_VERSIONS`.
- Updated `.github/sync-repo-settings.yaml` to include 3.14 and remove 3.7/3.8.
- Removed Kokoro and testing configurations for Python 3.7 and 3.8.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
@chalmerlowe
Copy link
Contributor Author

One more thing I ran into to hopefully save you some time: You'll need to update this list to skip the cpp unit tests

I did this:

py_version = tuple([int(v) for v in session.python.split(".")])
if protobuf_implementation == "cpp" and py_version >= (3, 11):
    session.skip("cpp implementation is not supported in python 3.11+")

I feel like the code incorporates an adequate check for python versions:

if protobuf_implementation == "cpp" and session.python in (
    "3.11",
    "3.12",
    "3.13",
    "3.14",
):
    # do the things.

@daniel-sanche
Copy link

daniel-sanche commented Oct 13, 2025

I feel like the code incorporates an adequate check for python versions:

if protobuf_implementation == "cpp" and session.python in (
    "3.11",
    "3.12",
    "3.13",
    "3.14",
):
    # do the things.

Oh nevermind, I must have been looking at the wrong branch, ignore my comment. On bigtable, we use a custom noxfile, so I had to address this manually

google-labs-jules bot and others added 5 commits October 15, 2025 18:55
This commit adds support for Python 3.14 to the library and drops support for Python 3.7 and 3.8.

The following changes were made:
- Dropped support for Python 3.7 and 3.8 across all configuration files, documentation, and CI/CD pipelines.
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `constraints-3.14.txt` file and moved it to the `testing/` directory.
- Updated the `CONTRIBUTING.rst` file to include 3.14 and remove 3.7/3.8.
- Updated the `README.rst` file to include 3.14 and remove 3.7/3.8.
- Updated `owlbot.py` to include "3.14" and remove "3.7"/"3.8" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" and remove "3.7"/"3.8" in `UNIT_TEST_PYTHON_VERSIONS`.
- Updated `.github/sync-repo-settings.yaml` to include 3.14 and remove 3.7/3.8.
- Removed Kokoro and testing configurations for Python 3.7 and 3.8.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
This commit adds support for Python 3.14 to the library.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
This commit adds support for Python 3.14 to the library and removes Python 3.7 and 3.8 from the nox sessions.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session, and remove 3.7/3.8.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
- Fixed `NameError` and `ValueError` bugs in `samples/snippets/publisher.py`.
- Removed Python 3.7 and 3.8 from `CONTRIBUTING.rst`, `README.rst`, and `owlbot.py`.
@chalmerlowe chalmerlowe requested a review from a team as a code owner October 17, 2025 18:25
@chalmerlowe chalmerlowe requested a review from ohmayr October 17, 2025 18:25
gcf-owl-bot bot and others added 9 commits October 17, 2025 18:27
This commit adds support for Python 3.14 to the library and fixes a `ValueError` in the `prerelease_deps` nox session.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session, and remove 3.7/3.8.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
- Fixed `NameError` and `ValueError` bugs in `samples/snippets/publisher.py`.
- Removed Python 3.7 and 3.8 from `CONTRIBUTING.rst`, `README.rst`, and `owlbot.py`.
- Fixed a `ValueError` in the `prerelease_deps` nox session.
This commit adds support for Python 3.14 to the library, removes Python 3.7 and 3.8 from the nox sessions, and updates the GitHub Actions workflow.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session, and remove 3.7/3.8.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Updated `.github/workflows/unittest.yml` to include 3.14 and remove 3.7/3.8.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
- Fixed `NameError` and `ValueError` bugs in `samples/snippets/publisher.py`.
- Removed Python 3.7 and 3.8 from `CONTRIBUTING.rst`, `README.rst`, and `owlbot.py`.
- Fixed a `ValueError` in the `prerelease_deps` nox session.
This commit adds support for Python 3.14 to the library, removes Python 3.7 and 3.8 from the nox sessions, and updates the GitHub Actions workflow.

It also includes a fix for an `AttributeError` in the `ThreadScheduler.shutdown` method that occurred in Python 3.14. The fix refactors the shutdown logic to use the `cancel_futures=True` argument, which is available in Python 3.9+ and is the correct way to handle this.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session, and remove 3.7/3.8.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Updated `.github/workflows/unittest.yml` to include 3.14 and remove 3.7/3.8.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
- Fixed `NameError` and `ValueError` bugs in `samples/snippets/publisher.py`.
- Removed Python 3.7 and 3.8 from `CONTRIBUTING.rst`, `README.rst`, and `owlbot.py`.
- Fixed a `ValueError` in the `prerelease_deps` nox session.
This commit adds support for Python 3.14 to the library and fixes a `ValueError` in the `prerelease_deps` nox session.

The following changes were made:
- Added a 3.14 trove classifier in `setup.py`.
- Added a `grpcio` version constraint for Python 3.14 in `setup.py`.
- Added a 3.14 presubmit configuration file in `.kokoro/samples`.
- Added a `testing/constraints-3.14.txt` file.
- Updated the `CONTRIBUTING.rst` and `README.rst` files to include 3.14.
- Updated `owlbot.py` to include "3.14" in `unit_test_python_versions`.
- Updated `noxfile.py` to include "3.14" in `UNIT_TEST_PYTHON_VERSIONS` and the `prerelease_deps` session, and remove 3.7/3.8.
- Updated `.github/sync-repo-settings.yaml` to include 3.14.
- Updated `.github/workflows/unittest.yml` to include 3.14 and remove 3.7/3.8.
- Fixed a flaky test in `tests/unit/pubsub_v1/publisher/test_publisher_client.py`.
- Fixed an `AttributeError` in `google/cloud/pubsub_v1/subscriber/scheduler.py` that occurred in Python 3.14.
- Fixed `NameError` and `ValueError` bugs in `samples/snippets/publisher.py`.
- Removed Python 3.7 and 3.8 from `CONTRIBUTING.rst`, `README.rst`, and `owlbot.py`.
- Fixed a `ValueError` in the `prerelease_deps` nox session by correcting the regex.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: pubsub Issues related to the googleapis/python-pubsub API. samples Issues that are directly related to samples. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants