chore(migration): Migrate code from googleapis/gapic-generator-python into packages/gapic-generator#16107
Conversation
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
…cloud-kms and google-cloud-os-config (#2588)
…n/main' into migration.gapic-generator-python.migration.2026-03-13_17-11-18.migrate
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a significant architectural change by migrating the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces new configuration files and updates existing ones across various aspects of the Python GAPIC generator project. Key changes include setting Bazel version to 6.5.0, enabling C++17 for protobuf, configuring coverage reporting, and defining new .dockerignore and .gitignore rules. A pre-commit hook is added for unit/integration tests and Bazel formatting. GitHub configurations like CODEOWNERS, issue/PR templates, auto-labeling, and CI workflows (tests.yaml) are established. Documentation files (.readthedocs.yml, README.rst, docs/*) are added or updated, along with Kokoro CI configurations. The core BUILD.bazel file is updated to include pandoc toolchains and Python runtime definitions. Several Jinja templates (gapic/ads-templates/*) are added or modified to support new generation logic, including handling mixins, pagers, and client/transport classes. Review comments highlight critical issues such as invalid actions/setup-python version in CI, an incorrect protobuf version in WORKSPACE, a misleading Bazel cache directory name, an incorrect path for golden files in the pre-commit hook, outdated Python version for documentation builds, incorrect code block language in README.rst, outdated Python version and legacy command substitution in _verifying.rst, an outdated Bazel version in bazel.rst, a reStructuredText syntax error in bazel.rst, inconsistent Python version requirements in documentation, and dead code related to Python version checks in __init__.py.j2.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/gapic-generator/.github/workflows/tests.yaml (64)
The version v6 for actions/setup-python is invalid; the latest stable version is v5. Using a non-existent version will cause this workflow to fail. Please update this and all other occurrences in this file to use a valid version, such as v5.
uses: actions/setup-python@v5packages/gapic-generator/WORKSPACE (75)
The protobuf version 30.2 is invalid and will cause the build to fail. Based on the provided SHA256 hash, the correct version appears to be 25.2. Please update the version to ensure the dependency can be downloaded successfully.
_protobuf_version = "25.2"
packages/gapic-generator/.githooks/pre-commit (71)
The Bazel cache directory name includes _java, which seems to be a copy-paste error from another project since this is for the Python generator. This could be confusing for developers. I recommend renaming it to reflect the correct project.
BAZEL_CACHE_DIR=/tmp/bazel_cache_gapic_generator_python
packages/gapic-generator/.githooks/pre-commit (80)
The path src/test/*/*.golden used to detect changes in unit test golden files seems to be a leftover from a Java project structure. For this Python project, unit test golden files are likely located elsewhere. Please update this path to correctly point to the Python unit test golden files to ensure the pre-commit hook triggers correctly.
packages/gapic-generator/.readthedocs.yml (6)
The Python version for building documentation is set to 3.7, which is outdated and inconsistent with the CI workflow (tests.yaml) that specifies version 3.10 for documentation jobs. To ensure consistency and avoid potential build issues with newer language features, please update this to 3.10.
version: "3.10"packages/gapic-generator/README.rst (40)
The code block is marked as c, but the content is Starlark (Bazel's language). This is misleading. I recommend changing it to python or simply code-block:: for better clarity. This applies to other similar blocks in this file.
.. code-block:: python
packages/gapic-generator/docs/getting-started/_verifying.rst (11)
The Python version 3.7 is outdated for this project, which requires Python 3.9+. Additionally, using backticks for command substitution is a legacy practice. I recommend updating the version to 3.9 and using $(...) for command substitution for better compatibility and modern shell scripting standards.
$ virtualenv ~/.local/client-lib --python=$(which python3.9)
packages/gapic-generator/docs/getting-started/bazel.rst (24-25)
The documentation suggests using Bazel version 3.2.0, which is quite old. The project's .bazeliskrc file specifies version 6.5.0. To avoid confusion and ensure users have a working setup, the documentation should be updated to reflect the version used by the project.
curl -L https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 -o bazel
chmod +x bazel
packages/gapic-generator/docs/getting-started/bazel.rst (65)
There is a syntax error in this reStructuredText directive. The .. before the URL will cause a rendering error. Please remove the extra . to fix the link.
.. _Document AI: https://cloud.google.com/solutions/document-ai
packages/gapic-generator/docs/status.rst (14)
The documentation states that the output works on Python 3.5 and above, but other parts of the repository, such as setup.py.j2, specify a requirement of Python 3.9+. This inconsistency should be corrected to reflect the actual minimum supported version.
- The output only works on Python 3.9 and above.
packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/init.py.j2 (68-82)
This block of code checks for Python versions less than 3.9 and issues a warning. However, the setup.py.j2 file specifies python_requires=">=3.9", which means this code will never be executed. This dead code should be removed to clean up the template.
Caution
DO NOT MERGE. This is a practice PR.
See #14907.
This PR should be merged with a merge-commit, not a squash-commit, in order to preserve the git history.