Skip to content

Commit 223d615

Browse files
committed
Fix #9608: apidoc: module is not described if implicit namespace package
To make implicit namespace packages referencable, this outputs empty module definitions for them.
1 parent 6c38f68 commit 223d615

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Features added
2525
Bugs fixed
2626
----------
2727

28+
* #9608: apidoc: apidoc does not generate a module definition for implicit
29+
namespace package
2830
* #9487: autodoc: typehint for cached_property is not shown
2931
* #9509: autodoc: AttributeError is raised on failed resolving typehints
3032
* #9518: autodoc: autodoc_docstring_signature does not effect to ``__init__()``

sphinx/templates/apidoc/package.rst_t

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
{{- [pkgname, "package"] | join(" ") | e | heading }}
2020
{% endif %}
2121

22+
{%- if is_namespace %}
23+
.. py:module:: {{ pkgname }}
24+
{% endif %}
25+
2226
{%- if modulefirst and not is_namespace %}
2327
{{ automodule(pkgname, automodule_options) }}
2428
{% endif %}

tests/test_ext_apidoc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ def test_namespace_package_file(tempdir):
635635
assert content == ("testpkg namespace\n"
636636
"=================\n"
637637
"\n"
638+
".. py:module:: testpkg\n"
639+
"\n"
638640
"Submodules\n"
639641
"----------\n"
640642
"\n"

0 commit comments

Comments
 (0)