mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-03-05 06:34:16 +08:00
Adds support for pyproject.toml files (#639)
* Adds support for pyproject.toml files Since mypy 0.900 the pyproject.toml files are supported. This PR adds a support for it. It searchs for a `tool.django-stubs` section. This is an example configuration: ``` [tool.django-stubs] django_settings_module = "config.settings.local" ``` Fixes #638 * Added TOML tests * Use textwrap.dedent instead of trying to manually replace spaces
This commit is contained in:
12
README.md
12
README.md
@@ -30,7 +30,17 @@ django_settings_module = "myproject.settings"
|
||||
|
||||
in your `mypy.ini` or `setup.cfg` [file](https://mypy.readthedocs.io/en/latest/config_file.html).
|
||||
|
||||
Two things happeining here:
|
||||
[pyproject.toml](https://mypy.readthedocs.io/en/stable/config_file.html#using-a-pyproject-toml-file) configurations are also supported:
|
||||
|
||||
```toml
|
||||
[tool.mypy]
|
||||
plugins = ["mypy_django_plugin.main"]
|
||||
|
||||
[tool.django-stubs]
|
||||
django_settings_module = "myproject.settings"
|
||||
```
|
||||
|
||||
Two things happening here:
|
||||
|
||||
1. We need to explicitly list our plugin to be loaded by `mypy`
|
||||
2. Our plugin also requires `django` settings module (what you put into `DJANGO_SETTINGS_MODULE` variable) to be specified
|
||||
|
||||
Reference in New Issue
Block a user