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

feat: Add support for python 312 (ads templates) #1861

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Nov 11, 2023

Fixes #1858 🦕
Fixes #1859 🦕

This PR:

  • Removes usage of exec in both ads and standard templates
  • Updates the setup.py of Ads to be similar to the standard templates
  • Removes usage of pkg_resources
  • Add support for python 3.12 in Ads templates
  • Adds version module gapic_version.py to Ads templates
  • Adds __version__ to __init__.py for Ads templates

@product-auto-label product-auto-label bot added the size: m Pull request size is medium. label Nov 11, 2023
@parthea parthea force-pushed the add-support-for-python-312-ads branch 3 times, most recently from e2540b2 to a00ecc7 Compare November 11, 2023 12:39
@parthea parthea force-pushed the add-support-for-python-312-ads branch from a00ecc7 to 9de4153 Compare November 11, 2023 12:46
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 11, 2023
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Nov 11, 2023
@parthea parthea marked this pull request as ready for review November 13, 2023 15:07
@parthea parthea requested a review from a team as a code owner November 13, 2023 15:07
@parthea parthea merged commit d65a540 into main Nov 13, 2023
64 checks passed
@parthea parthea deleted the add-support-for-python-312-ads branch November 13, 2023 19:33
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(gapic_version=package_version.__version__)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this is grabbing the version that's defined in the above gapic_version file, is that correct?

The implementation is actually to access the version of the Ads client library itself, see the logic here

If you look at go/ads-client-libs-user-agent-design you can see that we opted to use the gccl user agent k/v for our own logging purposes, which is why the gapic_version keyword arg is used here instead of something else.

Is it possible to retrieve the client library version without pkg_resources? If not, then we might need to add that logic in our interceptors before this change can be made.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like this is grabbing the version that's defined in the above gapic_version file, is that correct?

Yes, that is correct. In google-cloud-python, we use release-please to update the version in gapic_version.py prior to releasing. As an example see googleapis/google-cloud-python#12010.

The implementation is actually to access the version of the Ads client library itself, see the logic here

We've moved away from this in GAPIC, and chose to populate gapic_version.py instead of a hardcoded version number in setup.py. Customers can obtain the version number programatically using __version__.

Is it possible to retrieve the client library version without pkg_resources? If not, then we might need to add that logic in our interceptors before this change can be made.

It is possible to use something else like https://docs.python.org/3/library/importlib.metadata.html but we chose to have a version module instead.

packages=packages,
python_requires=">=3.7",
install_requires=dependencies,
include_package_data=True,
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use the generated setup.py file, so I'm not sure it makes sense to make these changes, and perhaps you could remove it from the templates.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is still needed so that we can run tests for the ads templates. We'll need to maintain it as long as we support ads templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for python 3.12 in ads templates Remove usage of pkg_resources in ads templates
3 participants