-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
The ads templates are missing the the testing folder which includes constraints files.
As an example, see
{% from '_pypi_packages.j2' import pypi_packages %} | |
# This constraints file is used to check that lower bounds | |
# are correct in setup.py | |
# List all library dependencies and extras in this file. | |
# Pin the version to the lower bound. | |
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", | |
# Then this file should have google-cloud-foo==1.14.0 | |
google-api-core==1.34.0 | |
proto-plus==1.22.0 | |
protobuf==3.19.5 | |
{% for package_tuple, package_info in pypi_packages.items() %} | |
{# Quick check to make sure the package is different from this setup.py #} | |
{% if api.naming.warehouse_package_name != package_info.package_name %} | |
{% if api.requires_package(package_tuple) %} | |
{{ package_info.package_name }}=={{ package_info.lower_bound }} | |
{% endif %} | |
{% endif %} | |
{% endfor %} |
These constraints files are used to run tests against the minimum version of dependencies which are defined in setup.py:
gapic-generator-python/gapic/ads-templates/setup.py.j2
Lines 19 to 33 in 46f1790
install_requires=( | |
{# TODO(dovs): remove when 1.x deprecation is complete #} | |
{% if 'rest' in opts.transport %} | |
"google-api-core[grpc] >= 2.10.0, < 3.0.0dev", | |
{% else %} | |
"google-api-core[grpc] >= 1.28.0, < 3.0.0dev", | |
{% endif %} | |
"googleapis-common-protos >= 1.53.0", | |
"grpcio >= 1.10.0", | |
"proto-plus >= 1.19.4, <2.0.0dev", | |
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'", | |
{% if api.requires_package(('google', 'iam', 'v1')) %} | |
'grpc-google-iam-v1', | |
{% endif %} | |
), |
We also need to change the code in noxfile.py
from:
gapic-generator-python/noxfile.py
Lines 112 to 125 in 812abce
# Install the generated fragment library. | |
if self.use_ads_templates: | |
self.session.install(tmp_dir, "-e", ".", "-qqq") | |
else: | |
# Use the constraints file for the specific python runtime version. | |
# We do this to make sure that we're testing against the lowest | |
# supported version of a dependency. | |
# This is needed to recreate the issue reported in | |
# https://github.com/googleapis/gapic-generator-python/issues/1748 | |
# The ads templates do not have constraints files. | |
constraints_path = str( | |
f"{tmp_dir}/testing/constraints-{self.session.python}.txt" | |
) | |
self.session.install(tmp_dir, "-e", ".", "-qqq", "-r", constraints_path) |
to
# Use the constraints file for the specific python runtime version.
# We do this to make sure that we're testing against the lowest
# supported version of a dependency.
# This is needed to recreate the issue reported in
# https://github.com/googleapis/gapic-generator-python/issues/1748
# The ads templates do not have constraints files.
constraints_path = str(
f"{tmp_dir}/testing/constraints-{self.session.python}.txt"
)
# Install the generated fragment library.
if self.use_ads_templates:
self.session.install(tmp_dir, "-e", ".", "-qqq", "-r", constraints_path)
else:
self.session.install(tmp_dir, "-e", ".", "-qqq", "-r", constraints_path)
Metadata
Metadata
Assignees
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.