Skip to content

Commit de84ab3

Browse files
committed
Adopt pyright replacing mypy
1 parent 04fe8cf commit de84ab3

File tree

3 files changed

+11
-29
lines changed

3 files changed

+11
-29
lines changed

dev/myapp/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def helper(self) -> FormHelper:
3737

3838

3939
class EventForm(forms.ModelForm[Event]):
40-
class Meta:
40+
class Meta: # pyright: ignore
4141
model = Event
4242
fields = [
4343
"start_date",
@@ -68,7 +68,7 @@ class Meta:
6868

6969

7070
class EventModalModelForm(BSModalModelForm): # type: ignore
71-
class Meta:
71+
class Meta: # pyright: ignore
7272
model = Event
7373
fields = [
7474
"start_date",

pyproject.toml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ pytest-django = "^4.5.2"
4949
pytest-dotenv = "^0.5.2"
5050
black = "^22.6.0"
5151
isort = "^5.10.1"
52+
pyright = "^1.1.350"
5253
pydocstyle = { extras = ["toml"], version = "^6.1.1" }
53-
mypy = "*"
5454
django-stubs = "^1.12.0"
5555
coverage = { extras = ["toml"], version = "^6.5.0" }
5656
rstcheck = "^6.1.0"
@@ -82,26 +82,8 @@ profile = "black"
8282
convention = "google"
8383
add_select = "D401,D404"
8484

85-
[tool.mypy]
86-
python_version = "3.8"
87-
namespace_packages = true
88-
strict = true
89-
plugins = ["mypy_django_plugin.main"]
90-
91-
[[tool.mypy.overrides]]
92-
module = [
93-
"dev.myapp.migrations.*",
94-
"urllib3.*",
95-
"crispy_forms.*",
96-
"django_filters.*",
97-
"importlib_metadata.*",
98-
"bootstrap_modal_forms.*",
99-
]
100-
ignore_missing_imports = true
101-
102-
[[tool.mypy.overrides]]
103-
module = ["dev.myapp.migrations.*"]
104-
ignore_errors = true
85+
[tool.pyright]
86+
include = ["src", "dev", "tests"]
10587

10688
[tool.django-stubs]
10789
django_settings_module = "dev.mysite.settings"
@@ -150,7 +132,7 @@ docs = "poetry run make -C docs html"
150132
lint = [
151133
{ cmd = "python -m black --check src tests dev" },
152134
{ cmd = "python -m isort --check-only src tests dev" },
153-
{ cmd = "mypy src tests dev" },
135+
{ cmd = "pyright" },
154136
{ cmd = "pydocstyle src" },
155137
{ cmd = "rstcheck --report-level warning README.rst docs/*.rst" },
156138
]

src/bootstrap_datepicker_plus/settings.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _django_settings_source(settings: BaseSettings) -> Dict[str, Any]:
1818
return getattr(django_settings, "BOOTSTRAP_DATEPICKER_PLUS", {})
1919

2020

21-
class WidgetSettings(BaseSettings):
21+
class WidgetSettings(BaseSettings): # pyright: ignore
2222
"""Settings to customize input widgets."""
2323

2424
template_name: Optional[str]
@@ -59,10 +59,10 @@ class Config:
5959
@classmethod
6060
def customise_sources(
6161
cls,
62-
init_settings: SettingsSourceCallable,
63-
env_settings: SettingsSourceCallable,
64-
file_secret_settings: SettingsSourceCallable,
65-
) -> Tuple[SettingsSourceCallable, ...]:
62+
init_settings: SettingsSourceCallable, # pyright: ignore
63+
env_settings: SettingsSourceCallable, # pyright: ignore
64+
file_secret_settings: SettingsSourceCallable, # pyright: ignore
65+
) -> Tuple[SettingsSourceCallable, ...]: # pyright: ignore
6666
"""Add django settings as config source."""
6767
return (
6868
init_settings,

0 commit comments

Comments
 (0)