Plugin calls `ready` of all installed apps
See original GitHub issueBug report
What’s wrong
django-stubs calls apps.populate(settings.INSTALLED_APPS)
which in turn calls ready
on all apps. And that requires all imports to be present and even can execute SQL queries.
File "/usr/local/lib/python3.8/site-packages/mypy_django_plugin/main.py", line 71, in __init__
self.django_context = DjangoContext(self.plugin_config.django_settings_module)
File "/usr/local/lib/python3.8/site-packages/mypy_django_plugin/django/context.py", line 97, in __init__
apps, settings = initialize_django(self.django_settings_module)
File "/usr/local/lib/python3.8/site-packages/mypy_django_plugin/django/context.py", line 81, in initialize_django
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.8/site-packages/django/apps/registry.py", line 122, in populate
app_config.ready()
...
File "/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "..." does not exist
How is that should be
What’s the purpose of calling apps.populate
? would it be possible to avoid calling ready
on apps and still do what django-stubs needs to do? If I understand correctly, you need only imports to be executed, right? If it sounds interesting I could look into mocking app_config.ready()
calls.
Related: #1060
System information
- OS: Linux Mint
python
version: 3.8.13django
version: 3.2.15mypy
version: 0.971django-stubs
version: 1.12.0django-stubs-ext
version: 0.5.0
Issue Analytics
- State:
- Created a year ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Managing your installed apps
Managing app location and order · On the My apps page, click the Reorder apps button on the top right. The Reorder apps...
Read more >Viewing installed apps | Atlassian Support
To view the list of apps in your cloud product: From the top navigation bar in your product, select Settings ( ). Select...
Read more >Native: tried calling plugins, but the plugin is not installed. · ...
My app is not working right on android 4.4 because plugins don't install. Do you have any idea ? package.json: "dependencies": { "@angular/ ......
Read more >windows - List all installed software on PC
Fire up your console and type: wmic product get name,version. It takes a while, but you'll get the full list of installed programs....
Read more >Build a calling app
A calling app allows users to receive or place audio or video calls on their device. Calling apps use their own user interface...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Haha, yes, you’re right. It’s me being confused, mixing up what’s runtime and not
And that’s the big difference between mypy and django-stubs. The latter actually executes the code, and so potentially suffers from all possible slow-downs, loops, and side-effects. And the issue is about finding a way to avoid it.