chore: split sphinxdocs into its own module#3629
chore: split sphinxdocs into its own module#3629rickeylev wants to merge 7 commits intobazel-contrib:mainfrom
Conversation
Summary of ChangesHello @rickeylev, 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 significantly refactors the project structure by isolating the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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 is a significant refactoring that splits sphinxdocs into its own Bazel module to reduce dependencies. The changes are extensive and mostly look correct, with many path and dependency updates to support the new module structure.
I've identified a few issues that need attention:
- A potential bug in a presubmit script for Windows due to incorrect shell command syntax.
- An incorrect Python import in a test that will likely cause it to fail.
- A typo in a code example within the documentation.
- Some inconsistency regarding a duplicated utility file (
util.bzl). While the duplication might be intentional to break dependencies, a related visibility change inrules_pythonis confusing and should be clarified or reverted.
Please see my detailed comments for suggestions on how to address these points.
| from stardoc.proto import stardoc_output_pb2 | ||
|
|
||
| from sphinxdocs.private import proto_to_markdown | ||
| from private import proto_to_markdown |
There was a problem hiding this comment.
The proto_to_markdown_lib target in sphinxdocs/private/BUILD.bazel has imports = ["."], which adds the sphinxdocs/private directory to the PYTHONPATH. Therefore, you should import proto_to_markdown directly. The current import from private import proto_to_markdown will likely fail because private is not a package (it's missing an __init__.py and incompatible_default_to_explicit_init_py is enabled in .bazelrc).
| from private import proto_to_markdown | |
| import proto_to_markdown |
| visibility = [ | ||
| "//:__subpackages__", | ||
| ], | ||
| visibility = ["//visibility:public"], |
There was a problem hiding this comment.
You're making util_bzl public here, but the sphinxdocs module is introducing its own copy of util.bzl instead of using this one. This leads to code duplication and is confusing. If the intent is to decouple sphinxdocs from rules_python's private implementation details (like PyInfo), it would be better to not make this target public and stick with the copied version in sphinxdocs. If this visibility change is no longer needed, please revert it to avoid confusion.
| # File: docs/BUILD | ||
|
|
||
| load("@rules_python//sphinxdocs:readthedocs.bzl.bzl", "readthedocs_install") | ||
| load("//:readthedocs.bzl.bzl", "readthedocs_install") |
aignas
left a comment
There was a problem hiding this comment.
Naming of new imports from rules_python LGTM.
| The key purpose of the shell script it to set the | ||
| `--@rules_python//sphinxdocs:extra_env` and | ||
| `--@rules_python//sphinxdocs:extra_defines` flags. These are used to communicate | ||
| `--//:extra_env` and |
There was a problem hiding this comment.
Should we use @sphinxdocs// instead of //
| # These are only exported because they're passed as files to the // | ||
| # macros, and thus must be visible to other packages. They should only be | ||
| # referenced by the //sphinxdocs macros. | ||
| # referenced by the // macros. |
There was a problem hiding this comment.
| # referenced by the // macros. | |
| # referenced by the @sphinxdocs macros. |
Splitting sphinxdocs into its own module is desirable to reduce the dependency
footprint of rules_python outside of development mode modules.
Work towards #2511