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

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

Open
rocchidavide opened this issue Jun 25, 2024 · 1 comment
Open

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

rocchidavide opened this issue Jun 25, 2024 · 1 comment
Labels
question Asking questions

Comments

@rocchidavide
Copy link

rocchidavide commented Jun 25, 2024

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!

@jfcherng jfcherng added the question Asking questions label Jun 25, 2024
@jfcherng
Copy link
Collaborator

It seems to just import from where it's defined... I actually recommend asking in https://github.com/microsoft/pyright since we don't implement pyright itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking questions
Projects
None yet
Development

No branches or pull requests

2 participants