As an enthusiastic user of the auto-import completion, there is one thing I couldn't manage to deal with: when setting the import format to relative ("python.analysis.importFormat": "relative"). there are still cases that need local absolute imports.
For instance in a project with multiple python packages or a separate tests folder:
- myproject
- mypackage
- __init__.py
- tests
- test_foo.py
Importing from mypackage in test_foo.py results in a relative import from ..mypackage import myfunc which is not what is wanted.
In short the idea is to have a way to switch to absolute imports in certain cases, either with some manual configuration or by detecting when the import goes beyond the root of the package.
As an enthusiastic user of the auto-import completion, there is one thing I couldn't manage to deal with: when setting the import format to relative (
"python.analysis.importFormat": "relative"). there are still cases that need local absolute imports.For instance in a project with multiple python packages or a separate tests folder:
Importing from
mypackageintest_foo.pyresults in a relative importfrom ..mypackage import myfuncwhich is not what is wanted.In short the idea is to have a way to switch to absolute imports in certain cases, either with some manual configuration or by detecting when the import goes beyond the root of the package.