Skip to content

How to get import auto suggestion from __init__.py files? #337

@rocchidavide

Description

@rocchidavide

My django project structure is something like that:

django-project/
    .venv/
     manage.py
     project/
       settings.py
       bar/
         __init__.py
         models/
           __init__.py
           company.py
         api/
           __init__.py
           companies/
             views.py
             serializers.py

In models/__init__.py there are imports:

from .company import Company

Same way for api package.

The problem
I need that LSP pyright suggests me imports from inits, for example:

from bar.models import Company

instead of

from bar.models.company import Company

My .sublime-project file contains these settings:

{
	"settings":
	{
		"LSP": {
			"LSP-pyright": {
				"settings": {
					"python.pythonPath": "$folder/.venv/bin/python3"
				}
			}
		}
	}
}

Is it possible? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking questions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions