Skip to content

Some warnings contain non-existing paths #9481

Closed
@astrojuanlu

Description

@astrojuanlu

Describe the bug

While investigating sktime/sktime#1181, I noticed that the warnings (turned into errors) contained some weird paths:

$ python -m sphinx -v -W -T -E -b html -d _build/doctrees -D language=en source/ _build/html
...                                                                                                                                                                                                          
  File "/usr/lib/python3.7/logging/__init__.py", line 751, in filter                                                                                                                                                                          
    result = f.filter(record)                                                                                          
  File "/home/juanlu/Projects/RTD/tmp/sktime/.venv/lib/python3.7/site-packages/sphinx/util/logging.py", line 421, in filter
    raise exc                                              
sphinx.errors.SphinxWarning: /home/juanlu/Projects/RTD/tmp/sktime/docs/source/source/api_reference/classification.rst.rst:16:autosummary: stub file not found 'sktime.classification.compose.ColumnEnsembleClassifier'. Check your autosummary_generate setting. 

Rather than /home/juanlu/Projects/RTD/tmp/sktime/docs/source/source/api_reference/classification.rst.rst, it should say /home/juanlu/Projects/RTD/tmp/sktime/docs/source/api_reference/classification.rst (notice the extra source/ segment and extra .rst extension).

After some debugging, I traced it to this function call:

(Pdb) p self.app.env.doc2path("source/api_reference/classification.rst")
'/home/juanlu/Projects/RTD/tmp/sktime/docs/source/source/api_reference/classification.rst.rst'

happening in these lines:

if isinstance(location, tuple):
docname, lineno = location
if docname and lineno:
record.location = '%s:%s' % (self.app.env.doc2path(docname), lineno)

How to Reproduce

$ git clone https://github.com/alan-turing-institute/sktime
$ cd sktime
$ pip install -r docs/requirements.txt  # Installation instructions taken from https://www.sktime.org/en/latest/contributing.html#id18
$ cd docs
$ python -m sphinx -v -W -T -E -b html -d _build/doctrees -D language=en source/ _build/html
# See error

Expected behavior

The error should contain an actual path, in this case /home/juanlu/Projects/RTD/tmp/sktime/docs/source/api_reference/classification.rst.

Your project

https://github.com/alan-turing-institute/sktime

Screenshots

No response

OS

Linux

Python version

3.7

Sphinx version

3.2.1

Sphinx extensions

sphinx.ext.autodoc, sphinx.ext.autosummary, others

Extra tools

No response

Additional context

sktime/sktime#1181

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions