-
Notifications
You must be signed in to change notification settings - Fork 22
Add all_requirements only if missing #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MaximilianSoerenPollak
merged 3 commits into
eclipse-score:main
from
etas-contrib:changeable-docs-hub
Mar 2, 2026
+90
−3
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| Add Extensions | ||
| =================== | ||
a-zw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| The docs-as-code module defines its own Python environment in ``MODULE.bazel`` | ||
| and as a user you cannot extend that. | ||
| If you want to add Sphinx extensions, | ||
| you must duplicate the Python environment first. | ||
|
|
||
| Once you have your own Python environment, | ||
| supply all necessary packages to ``docs`` via the ``deps`` attribute. | ||
|
|
||
| .. code-block:: starlark | ||
| :caption: In your BUILD file | ||
|
|
||
| load("@your_python_env//:requirements.bzl", "all_requirements") | ||
|
|
||
| docs( | ||
| # ...other attributes... | ||
| deps = all_requirements | ||
| ) | ||
|
|
||
| Inside ``docs()``, the docs-as-code module will check if you have supplied all necessary dependencies. | ||
|
|
||
| How to Create a Python Environment? | ||
| ----------------------------------- | ||
|
|
||
| The general documentation is `in the rules_python documentation <https://rules-python.readthedocs.io/en/latest/toolchains.html>`_. | ||
|
|
||
a-zw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| You can also peek into `this docs-as-code repo's MODULE.bazel file <https://github.com/eclipse-score/docs-as-code/blob/main/MODULE.bazel>`_ | ||
| how ``docs_as_code_hub_env`` is defined and use it as a template for ``your_python_env``. | ||
|
|
||
| Recommendation: | ||
| Use `compile_pip_requirements <https://rules-python.readthedocs.io/en/latest/api/rules_python/python/pip.html#compile_pip_requirements>`_ | ||
| because it is a solid practice anyways. | ||
| Next, get ``@score_docs_as_code//src:requirements.in`` as one of the inputs | ||
| to ensure you have all the necessary dependencies for docs-as-code. | ||
|
|
||
| .. code-block:: starlark | ||
| :caption: Example BUILD file snippet | ||
|
|
||
| load("@rules_python//python:pip.bzl", "compile_pip_requirements") | ||
|
|
||
| compile_pip_requirements( | ||
| name = "requirements", | ||
| srcs = [ | ||
| "@score_docs_as_code//src:requirements.in", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be the txt or the in?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the in is better so compile-pip can detect conflicts. |
||
| "requirements.in", | ||
| ], | ||
| requirements_txt = "requirements_lock.txt", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing these debug prints can be removed, or do we want to keep them?