Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Upgrade proto-plus to support Python 3.13 #1280

Closed
wants to merge 2 commits into from

Conversation

dangarmol
Copy link

This change should fix issue #1275. A similar change has been proposed for googleapis/python-api-core#740.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #1275 🦕

@dangarmol dangarmol requested review from a team as code owners October 22, 2024 11:29
Copy link

google-cla bot commented Oct 22, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: pubsub Issues related to the googleapis/python-pubsub API. labels Oct 22, 2024
@mukund-ananthu mukund-ananthu added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 25, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 25, 2024
@dangarmol
Copy link
Author

That's an interesting failure, I can't really see how it's related to my changes though 🤔

Maybe it's time to drop Python 3.7 and execute the test suite in 3.13 as well?

@mukund-ananthu mukund-ananthu added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 28, 2024
@mukund-ananthu
Copy link
Contributor

mukund-ananthu commented Oct 29, 2024

Maybe it's time to drop Python 3.7

Dropping Python 3.7 from presubmits implies that any issues / regressions in Python 3.7 would not be caught. Any issues / regressions in Python 3.7 would be considered a backward incompatible change. Backward incompatible changes are mostly discouraged, unless there is an exceptional reason - this isn't one of them

@parthea
Copy link
Contributor

parthea commented Oct 29, 2024

Wait for googleapis/synthtool#2031

@dangarmol dangarmol requested a review from parthea October 30, 2024 15:28
@mukund-ananthu
Copy link
Contributor

@parthea :

Pip Freeze:

cachetools==5.5.0
certifi==2024.8.30
charset-normalizer==3.4.0
Deprecated==1.2.14
google-api-core==2.22.0
google-auth==2.35.0
google-cloud-pubsub @ file:///workspaces/python-pubsub
googleapis-common-protos==1.65.0
grpc-google-iam-v1==0.13.1
grpcio==1.67.1
grpcio-status==1.67.1
idna==3.10
importlib_metadata==8.4.0
iniconfig==2.0.0
opentelemetry-api==1.27.0
opentelemetry-sdk==1.27.0
opentelemetry-semantic-conventions==0.48b0
packaging==24.1
pluggy==1.5.0
proto-plus==1.25.0
protobuf==5.28.3
pyasn1==0.6.1
pyasn1_modules==0.4.1
pytest==8.3.3
pytest-asyncio==0.24.0
requests==2.32.3
rsa==4.9
typing_extensions==4.12.2
urllib3==2.2.3
wrapt==1.16.0
zipp==3.20.2

Repro Code:

from google.cloud import pubsub_v1

print("Hello World")

Confirmed that the repro code works for python version = 3.11:

 $ python3 repro.py 
Hello World

Setup .py file with the proto-plus dependency updated

dependencies = [
    "grpcio >= 1.51.3, < 2.0dev",  # https://github.com/googleapis/python-pubsub/issues/609
    # google-api-core >= 1.34.0 is allowed in order to support google-api-core 1.x
    "google-auth >= 2.14.1, <3.0.0dev",
    "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
    "proto-plus >= 1.22.0, < 2.0.0dev",
    "proto-plus >= 1.22.2, < 2.0.0dev; python_version >= '3.11'",
    "proto-plus >= 1.25.0, < 2.0.0dev; python_version >= '3.13'",
    "protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
    "grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev",
    "grpcio-status >= 1.33.2",
    "opentelemetry-api <= 1.22.0; python_version<='3.7'",
    "opentelemetry-api >= 1.27.0; python_version>='3.8'",
    "opentelemetry-sdk <= 1.22.0; python_version<='3.7'",
    "opentelemetry-sdk >= 1.27.0; python_version>='3.8'",
]

I still get an error with the above change:

$ python3.13 repro.py 
Traceback (most recent call last):
  File "/workspaces/python-pubsub/repro.py", line 1, in <module>
    from google.cloud import pubsub_v1
  File "/workspaces/python-pubsub/google/cloud/pubsub_v1/__init__.py", line 17, in <module>
    from google.cloud.pubsub_v1 import types
  File "/workspaces/python-pubsub/google/cloud/pubsub_v1/types.py", line 24, in <module>
    import proto  # type: ignore
    ^^^^^^^^^^^^
ModuleNotFoundError: No module named 'proto'

So, this change does not seem to resolve the issue, although I see that it was applied as a fix for the other client libraries. Wanted to check if you know why this might be happening?

@parthea parthea added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 8, 2024
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Nov 8, 2024
@mukund-ananthu
Copy link
Contributor

Issue solved with #1303 .Closing this.

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. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not compatible Python 3.13.0 ?
4 participants