Skip to content

Commit 37600b2

Browse files
committed
Configure mypy, django-stubs, and VS Code settings; update CI workflows and backend/app files
1 parent dc64c03 commit 37600b2

11 files changed

Lines changed: 29 additions & 23 deletions

File tree

.github/workflows/django-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141
working-directory: src
4242
run: |
4343
set -o allexport
44-
source ../.env.ci
44+
source ../.env_files/.env.ci
4545
python manage.py migrate
4646
set +o allexport
4747
4848
- name: Run tests
4949
working-directory: src
5050
run: |
5151
set -o allexport
52-
source ../.env.ci
52+
source ../.env_files/.env.ci
5353
pytest
5454
set +o allexport

.github/workflows/lint.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@ jobs:
2222
- name: Run isort
2323
run: isort --check-only .
2424
- name: Run flake8
25-
run: flake8 .
26-
- name: Run mypy
27-
run: mypy your_project/
25+
run: flake8 .

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"python.testing.pytestEnabled": true,
2323
"editor.formatOnSave": true,
2424
"editor.codeActionsOnSave": {
25-
"source.organizeImports": "always"
25+
"source.organizeImports": "always",
26+
"source.fixAll": "always"
2627
},
2728
"editor.rulers": [
2829
88

setup.cfg

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ line-length = 88 # Set line length to 88
55
disable = C0114 # Disable missing module docstring warning
66

77
[flake8]
8-
max-line-length = 88 # Set line length to 88
9-
extend-ignore = E203, W503 # Ignore specific warnings
8+
max-line-length = 88
9+
extend-ignore = E203, W503
10+
exclude = .git,__pycache__,migrations,venv
11+
per-file-ignores =
12+
src/backend/settings_test.py: F405
1013

11-
[isort]
14+
[tool.isort]
15+
profile = "black"
1216
multi_line_output = 3 # Vertical hanging indent for imports
1317
include_trailing_comma = true # Add trailing comma
1418
force_grid_wrap = 0 # Disable wrapping
1519
use_parentheses = true # Use parentheses for wrapping
1620
ensure_newline_before_comments = true # Newline before comments in imports
1721
line_length = 88 # Set line length to 88
18-
remove_redundant_aliases = true # Remove redundant aliases
22+
remove_redundant_aliases = true # Remove redundant aliases

src/backend/settings.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"django.middleware.security.SecurityMiddleware",
4545
"django.contrib.sessions.middleware.SessionMiddleware",
4646
"django.middleware.common.CommonMiddleware",
47-
"corsheaders.middleware.CorsMiddleware", # CORS middleware should be high in the order
47+
"corsheaders.middleware.CorsMiddleware",
4848
"django.middleware.csrf.CsrfViewMiddleware",
4949
"django.contrib.auth.middleware.AuthenticationMiddleware",
5050
"django.contrib.messages.middleware.MessageMiddleware",
@@ -80,11 +80,13 @@
8080
# Password validation
8181
AUTH_PASSWORD_VALIDATORS = [
8282
{
83-
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
83+
"NAME": (
84+
"django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
85+
)
8486
},
85-
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
86-
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
87-
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
87+
{"NAME": ("django.contrib.auth.password_validation.MinimumLengthValidator")},
88+
{"NAME": ("django.contrib.auth.password_validation.CommonPasswordValidator")},
89+
{"NAME": ("django.contrib.auth.password_validation.NumericPasswordValidator")},
8890
]
8991

9092
# Internationalization settings

src/backend/settings_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from backend.settings import * # noqa: F401,F403
1+
from backend.settings import * # noqa: F401,F403,F405
22

33
DATABASES = {"default": env.db("DATABASE_URI")}

src/backend/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from django.contrib import admin
22
from django.urls import include, path
33
from drf_spectacular.views import SpectacularAPIView, SpectacularSwaggerView
4-
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView
4+
from rest_framework_simplejwt.views import (TokenObtainPairView,
5+
TokenRefreshView)
56

67
urlpatterns = [
78
path("admin/", admin.site.urls),

src/items/apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ class ItemsConfig(AppConfig):
66
name = "items"
77

88
def ready(self):
9-
import items.signals
9+
pass

src/items/migrations/0002_item_external_price.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by Django 5.1.7 on 2025-08-01 11:09
22

33
from decimal import Decimal
4+
45
from django.db import migrations, models
56

67

src/items/tests/test_tasks.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
import pytest
66

77
from items.models import Item
8-
from items.tasks import (
9-
hourly_external_price_sync,
10-
simulate_external_price_sync_for_item,
11-
)
8+
from items.tasks import (hourly_external_price_sync,
9+
simulate_external_price_sync_for_item)
1210
from items.utils.price_sync import sync_all_items
1311

1412

0 commit comments

Comments
 (0)