fix(sphinxdocs),deps: allow using sphinx_stardoc with bzlmod; add stardoc 0.6.2 as dependency (#2295)
Using the sphinx_stardoc rule doesn't work with bzlmod because it refers
to the stardoc repo, which was a dev dependency. This means, even if a
user's root module has visibility to stardoc, rules_python doesn't.
To fix, make stardoc a non-dev dependency. With bzlmod semantics,
stardoc won't actually be loaded unless a user depends on it by using
sphinxdocs.
I ran into this while trying to port rules_testing over to sphinxdocs.
The pigweed project
recently started using sphinxdocs and didn't run into this problem, but
I'm pretty
sure that's because they're using workspace still, which doesn't have
the visibility
constraints that bzlmod does.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 835d541..9cc3cbc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -35,6 +35,7 @@
(or equivalent).
* (toolchains) `py_runtime.implementation_name` now defaults to `cpython`
(previously it defaulted to None).
+* (deps) stardoc 0.6.2 added as dependency.
### Fixed
* (bzlmod) The `python.override(minor_mapping)` now merges the default and the
diff --git a/MODULE.bazel b/MODULE.bazel
index 780d7f8..390e81a 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -66,8 +66,10 @@
)
use_repo(pip, "rules_python_publish_deps")
+# Not a dev dependency to allow usage of //sphinxdocs code, which refers to stardoc repos.
+bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
+
# ===== DEV ONLY DEPS AND SETUP BELOW HERE =====
-bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "rules_bazel_integration_test", version = "0.20.0", dev_dependency = True)
bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True)