Skip to content

chore(migration): Migrate code from googleapis/sphinx-docfx-yaml into packages/gcp-sphinx-docfx-yaml#16160

Merged
parthea merged 298 commits intomainfrom
migration.sphinx-docfx-yaml.migration.2026-03-25_00-16-05.migrate
Mar 26, 2026
Merged

chore(migration): Migrate code from googleapis/sphinx-docfx-yaml into packages/gcp-sphinx-docfx-yaml#16160
parthea merged 298 commits intomainfrom
migration.sphinx-docfx-yaml.migration.2026-03-25_00-16-05.migrate

Conversation

@ohmayr
Copy link
Copy Markdown
Contributor

@ohmayr ohmayr commented Mar 25, 2026

See #15998.

This PR should be merged with a merge-commit, not a squash-commit, in order to preserve the git history.

dandhlee and others added 30 commits July 21, 2021 15:47
Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com>
* feat: add subPackage types

* fix: update type in summary and use markdown to highlight names

* fix: use short and disambiguated names

* nit: update to f string for single-line string
* feat: add subclasses to children and reference

* chore: lint

* nit: update comment to clarify confusion
Co-authored-by: Dan Lee <71398022+dandhlee@users.noreply.github.com>
* accept change from upstream

* feat: add full support for xrefs

* test: update test case

* fix: expand xref format for proper processing

* test: update unit test

* fix: handle xrefs for other products in the future
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* fix: allow bracketed xref to work

* test: update unit test

* test: update to include xref checking in unit test
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* fix: parse xrefs differently with new xref format

* fix: update Docstring parser

* test: update unit test

* fix: move error catching to another block

* test: update unittest to include error scenarios

* fix: clean up messy formatting
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Source-Link: googleapis/synthtool@facee4c
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:9743664022bd63a8084be67f144898314c7ca12f0a03e422ac17c733c129d803

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* fix: recover lost arguments to functions

* fix: add default argument types

* fix: work for None type arguments

* fix: omit variables without types

* chore: update comment about default arguments

* chore: fix to make comment more readable
* feat: group left-nav entries by versions

* fix: remove uid from package groups, fix index

* fix: disambiguate only on index and not on toc

* chore: add unit test
* fix: retrieve file name as much as possible

* fix: use default return when there are duplicates
* feat: add markdown page support

* feat: add sphinx-markdown-builder in the plugin

* chore: add docuploader to setup.py

* test: skip running markdown builder for unittest

* chore: fix Kokoro

* test: run Kokoro test against head of the branch only

* chore: update comments

* fix: address comments from PR

* fix: lint updates

* test: add unit test coverage for new function added

* revert(test): revert testing only against HEAD

* chore: update comment with issues referenced inline

* test: add test case with space after the hashtag
* fix: use the uid when applicalbe for toc entries

* test: use latest build for Kokoro

* test: revert kokoro setting

* test: update test case

* fix: remove check_name_with_uid function

* chore: lint update
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* fix: do not omit arguments retrieved from docstring

* chore: update comments
* fix: check for markdown header more carefully

* test: update unit test

* fix: update parser and unit test

* fix: removing redundant code and adding comment

* test: update lint and open file formats

* fix: update to parse_markdown_header
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Adding support for handling docstring items in `top_summary`. Notably, `.. code-block::` and `.. attributes::` will be supported, and any other items as they appear.

Similar to how return/exception/params were extracted, iterating through the summary to look for keywords like `code-block`, `attribute` and more in patterns that show up in `.. keyword::` format. If the docstring is malformed from the source, we do not handle it in the plugin. Hand-written docstrings may not work well against the autogenerated reStructuredText, however we should fix those from the client library side than to make special adjustments in the plugin like the bad formatted keywords.

For each keyword:
- For `code-block`, convert the code snippet in code block using multi-line commenting blocks. 
    - code should be indented, extract lines until there is no indentation/leading whitespace found and/or found other keywords.
    - Adjust spacing and line breaks as necessary to better display them on cloud site.

- For `attributes`, there are 3 main parts: name, description and type.
    - Extract the name first, followed by the description, then type. Once all 3 are extracted, add it to the list of attributes.
    - Attributes will be added to the YAML file directly, to be processed in doc-templates.
    - If attributes are not well formatted, do not add them to the list to be outputted to YAML.

Afterwards, incorporate them back into `top_summary` and to be added into the YAMLs.

Fixes internally filed issue.
- [x] Tests pass
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* test: update kokoro job to continue on failure

* fix: update comments
* chore: move Renovate config to .github, turn off dashboard

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* fix: make the plugin be more verbose

* fix: include file path when necessary

* fix: consolidate error message

* fix: update to use string join
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 consolidates the sphinx-docfx-yaml project into a monorepo by migrating its entire codebase and associated infrastructure into a dedicated package directory. This move streamlines development and maintenance by centralizing various configurations, build processes, and documentation within a unified repository structure.

Highlights

  • Code Migration: The entire googleapis/sphinx-docfx-yaml repository has been migrated into a new packages/gcp-sphinx-docfx-yaml directory within the current monorepo structure. This includes all source code, documentation, configuration files, and CI/CD workflows.
  • GitHub Configuration: New GitHub-specific configuration files have been added for the migrated package, including CODEOWNERS, issue templates, pull request templates, auto-labeling, Blunderbuss assignments, header checker linting, and repository synchronization settings.
  • CI/CD Workflows: Kokoro and GitHub Actions workflows have been set up for the new package, covering continuous integration, presubmit tests, prerelease dependency checks, and documentation generation, utilizing trampoline scripts and secret management.
  • Documentation and Testing: The package now includes its own CHANGELOG.md, README.rst, CODE_OF_CONDUCT.md, CONTRIBUTING.md, LICENSE, and SECURITY.md. Comprehensive unit and golden tests have been added or migrated to ensure the functionality and output of the Sphinx DocFX YAML generator.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates the gcp-sphinx-docfx-yaml package to a new monorepo structure, involving extensive updates across GitHub configurations, Kokoro build scripts, and project metadata files. Key changes include updating CODEOWNERS, issue templates, CI/CD workflows, and dependency management. The review highlights several critical issues: f-string syntax errors in docfx_yaml/extension.py, outdated repository paths in Kokoro configurations, and incorrect URLs in .repo-metadata.json, CHANGELOG.md, and bug_report.md. Additionally, there's a typo in an error message and suggestions to improve logging practices by directing error/warning messages to sys.stderr and using consistent command substitution syntax in shell scripts.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/gcp-sphinx-docfx-yaml/docfx_yaml/extension.py (600-601)

critical

The f-string for this ValueError is split across two lines, which will result in a SyntaxError. It should be combined into a single line.

                    raise ValueError(f"Content in the block should be indented.Please check the docstring: \n{summary}")

packages/gcp-sphinx-docfx-yaml/docfx_yaml/extension.py (625-626)

critical

The f-string for this ValueError is split across two lines, which will result in a SyntaxError. It should be combined into a single line.

                    raise ValueError("Content in the block should be indented."f"Please check the docstring: \n{summary}")

packages/gcp-sphinx-docfx-yaml/.kokoro/continuous/common.cfg (17-26)

high

The paths for build_file and TRAMPOLINE_BUILD_FILE seem to refer to the old repository structure (sphinx-docfx-yaml). Since the code is being migrated to packages/gcp-sphinx-docfx-yaml, these paths might need to be updated to reflect the new location within the monorepo (e.g., packages/gcp-sphinx-docfx-yaml/.kokoro/trampoline.sh). This same issue appears to be present in docs/common.cfg and presubmit/common.cfg as well. Please verify that these paths are correct for the new repository structure.

packages/gcp-sphinx-docfx-yaml/.repo-metadata.json (4-9)

high

The URLs for product_documentation, client_documentation, issue_tracker, and the repo field appear to point to the old repository (googleapis/sphinx-docfx-yaml). Since this PR is migrating the code, these values should be updated to reflect the new location.

packages/gcp-sphinx-docfx-yaml/.github/ISSUE_TEMPLATE/bug_report.md (13)

medium

This link points to the old repository's issues. It should be updated to point to the new issue tracker for this package. This value is likely derived from .repo-metadata.json, which also seems to contain outdated information.

packages/gcp-sphinx-docfx-yaml/.kokoro/generate-docs.sh (91)

medium

For consistency and to avoid potential issues with nesting, it's better to use $(...) for command substitution instead of backticks.

    GITHUB_TAGS=$(git describe --tags $(git rev-list --tags --max-count=1))

packages/gcp-sphinx-docfx-yaml/CHANGELOG.md (7)

medium

The links in the changelog, such as the one on this line, point to the old repository googleapis/sphinx-docfx-yaml. These should be updated to reflect the new repository structure.

packages/gcp-sphinx-docfx-yaml/docfx_yaml/extension.py (80-81)

medium

It's a best practice to write error messages to sys.stderr rather than sys.stdout. This allows for better separation of standard output and error streams. You'll need to import the sys module.

    print(Bcolors.FAIL + 'can not import conf.py! ' 'you should have a conf.py in working project folder' + Bcolors.ENDC, file=sys.stderr)

packages/gcp-sphinx-docfx-yaml/docfx_yaml/extension.py (432)

medium

There is a typo in the error message. "enoucntered" should be "encountered".

        raise ValueError(f"Wrong formatting encountered for \n{line}")

packages/gcp-sphinx-docfx-yaml/docfx_yaml/extension.py (1475)

medium

This error message should be printed to sys.stderr instead of sys.stdout for better error handling and stream separation. You'll need to import the sys module.

            print(f"Could not format the given code: \n{e})", file=sys.stderr)

packages/gcp-sphinx-docfx-yaml/docfx_yaml/writer.py (1157)

medium

System message warnings should be printed to sys.stderr to separate them from standard output. You'll need to import the sys module.

        print(bcolors.WARNING + "System message warnings: %s" % node.astext() + bcolors.ENDC, file=sys.stderr)

@ohmayr ohmayr force-pushed the migration.sphinx-docfx-yaml.migration.2026-03-25_00-16-05.migrate branch from 6f94786 to 7824260 Compare March 26, 2026 08:01
@ohmayr ohmayr marked this pull request as ready for review March 26, 2026 08:44
@ohmayr ohmayr requested review from a team as code owners March 26, 2026 08:44
@parthea parthea added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 26, 2026
Comment thread .librarian/state.yaml
@parthea parthea assigned ohmayr and unassigned parthea Mar 26, 2026
@parthea parthea dismissed their stale review March 26, 2026 22:03

Stale review

@parthea parthea merged commit 943a979 into main Mar 26, 2026
29 of 30 checks passed
@parthea parthea deleted the migration.sphinx-docfx-yaml.migration.2026-03-25_00-16-05.migrate branch March 26, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Indicates a pull request not ready for merge, due to either quality or timing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants