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

Allow to work with django-configurations #1709

Open
kaldown opened this issue Sep 13, 2023 · 4 comments
Open

Allow to work with django-configurations #1709

kaldown opened this issue Sep 13, 2023 · 4 comments
Labels
3rd party Presence of a third party dependency has been mentioned bug Something isn't working

Comments

@kaldown
Copy link

kaldown commented Sep 13, 2023

Following documentation do not solve the issue of django-stubs working with django-configurations

[tool.mypy]
mypy_path = "./src"
plugins = ["mypy_django_plugin.main"]

[tool.django-stubs]
django_settings_module = "myproj.settings"
strict_settings = false

Returns an Error:

Error constructing plugin instance of NewSemanalDjangoPlugin
...
raise ImproperlyConfigured(install_failure)
django.core.exceptions.ImproperlyConfigured: django-configurations settings importer wasn't correctly installed. Please use one of the starter functions to install it as mentioned in the docs: https://django-configurations.readthedocs.io/

Note:

Whilst commenting usage of django-stubs in [tool.mypy] directive of pyproject.toml leading to expected issue of mypy not being able to catch django types from models.py (for example).

Note 2:

As I see this PR #180 is still open.
Would it be better to remove django-configurations entry from README.md since it could cause confusion?

System information

  • OS: macOS Sonoma
  • python version: 3.11.4
  • django version: 4.2.5
  • mypy version: 1.4.1
  • mypy-extensions version: 1.0.0
  • django-stubs version: 4.2.3
  • django-stubs-ext version: 4.2.2
  • djangorestframework-stubs version: 3.14.2
@sobolevn
Copy link
Member

@kaldown do you want to experiment with code / docs changes to support django-configurations? :)

@kaldown
Copy link
Author

kaldown commented Sep 14, 2023

@kaldown Sure thing, I would glad to.
I need you to look at #180 and tell me if this is not a convenient solution or if there are any caveats you want to be addressed.

I have to admit I never-ever used typing in python. Started with my pet project I gave it a shot, and straight away drove into the "issue". In order to not be overwhelmed by the new tool, and knowing you are one of the main contributors to django-stubs and related projects - I am asking your advice, it would really help me to achieve better results.

If your advice would be to only change documentation or adjust related PR - I'm fine with this too.
Thank you.

@kaldown
Copy link
Author

kaldown commented Sep 19, 2023

Hey @sobolevn , what do you think about my request?

@sobolevn
Copy link
Member

Sorry, I don't have time right now to dig into this :(

@flaeppe flaeppe added the 3rd party Presence of a third party dependency has been mentioned label Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Presence of a third party dependency has been mentioned bug Something isn't working
Development

No branches or pull requests

3 participants