Skip to content

Commit d3b0660

Browse files
committed
feat: check Python and dependency versions in generated GAPICs
1 parent 1c6e9a4 commit d3b0660

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

gapic/templates/%namespace/%name_%version/%sub/__init__.py.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ from {{package_path}} import gapic_version as package_version
77

88
__version__ = package_version.__version__
99

10+
11+
import google.api_core
12+
13+
{# How do we get the name of the PyPI path into this template? We
14+
want the string arguments below to be something like
15+
"google-cloud-foo (google.cloud.foo)", where the name outside the
16+
parentheses is the PyPI package name, and the the name inside the
17+
parentheses is the qualified Python package name installed. #}
18+
api_core.check_python_version("{package_path}")
19+
api_core.check_dependency_versions("{package_path}")
20+
1021
{# Import subpackages. -#}
1122
{% for subpackage, _ in api.subpackages|dictsort %}
1223
from . import {{ subpackage }}

0 commit comments

Comments
 (0)