readthedocs / readthedocs/sphinx-autoapi

Indirect imports not supported

Open
#524 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needed: Design Decision
Dominant language
Python
Stars
494
Forks
147
Avg merge
9m
Merged PRs (30d)
1

Description

If you import something in multiple steps you get an error like "WARNING: Cannot resolve import of $BLAH in $BAR [autoapi.python_import_resolution]". More specifically I'm refering to a scenario like this:

mypack.mod1:

from pathlib import Path

mypack.mod2:

from .mod1 import Path

This is arguably a bad practice and some linters complain about it but it would be nice if it worked.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and tests for the autoapi.python_import_resolution warning, then trace how imports are resolved across modules. Reproduce the mypack.mod1 and mypack.mod2 example and update the relevant behavior so the indirect Path import resolves without the warning; add or adjust a regression test if that area has coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.