Skip to content
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

Linking to implicit namespace package with :py:mod: not working #9608

Closed
estan opened this issue Sep 4, 2021 · 0 comments
Closed

Linking to implicit namespace package with :py:mod: not working #9608

estan opened this issue Sep 4, 2021 · 0 comments

Comments

@estan
Copy link

estan commented Sep 4, 2021

Describe the bug

The documentation for :py:mod: says that it can also be used to link to packages. This seems to work for regular packages, but not implicit namespace packages.

How to Reproduce

mkdir -p testcase/foo
cd testcase
touch foo/bar.py
python3 -m venv venv
source venv/bin/activate
pip install sphinx
mkdir source
echo 'import os; import sys; sys.path.insert(0, os.path.abspath("..")); extensions = ["sphinx.ext.autodoc"]' > source/conf.py
sphinx-apidoc -f --implicit-namespaces -o source foo
echo ':py:mod:`foo`' > source/index.rst
sphinx-build source build
xdg-open build/index.html

Notice how "foo" in the output is not a hyperlink.

On the other hand, if we turn foo into a regular package and re-run sphinx-apidoc / sphinx-build:

touch foo/__init__.py
sphinx-apidoc -f -o source foo
sphinx-build source build
xdg-open build/index.html

Then "foo" is now a hyperlink.

Expected behavior

I expect "foo" in the output to be a link to foo.html#foo-namespace.

Your project

See steps above

Screenshots

No response

OS

Ubuntu 20.04.3 LTS

Python version

3.8.10

Sphinx version

4.1.2

Sphinx extensions

sphinx.ext.autodoc

Extra tools

No response

Additional context

No response

@estan estan added the type:bug label Sep 4, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue Sep 4, 2021
…space package

To make implicit namespace packages referencable, this outputs empty
module definitions for them.
tk0miya added a commit to tk0miya/sphinx that referenced this issue Sep 4, 2021
…space package

To make implicit namespace packages referencable, this outputs empty
module definitions for them.
@tk0miya tk0miya added this to the 4.2.0 milestone Sep 4, 2021
@tk0miya tk0miya closed this as completed in 223d615 Sep 5, 2021
tk0miya added a commit that referenced this issue Sep 5, 2021
…r_implicit_namespace

Fix #9608: apidoc: module is not described if implicit namespace package
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants