diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b6c6864..61ec9db 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,10 +11,9 @@ jobs: - uses: actions/setup-python@v4 with: python-version: '3.13' - - run: pip install pipenv - - run: pipenv install --dev -v - - run: pipenv run mypy . - - run: pipenv run black --config black.toml --check . - - run: pipenv run pylint --enable-all-extensions django101 - - run: pipenv run pylint --enable-all-extensions blog - - run: pipenv run python manage.py test + - run: pip install uv + - run: uv sync --dev -v + - run: uv run mypy . + - run: uv run ruff check + - run: uv run ruff format --check + - run: uv run python manage.py test diff --git a/blog/views.py b/blog/views.py index ea811c9..046d6e6 100644 --- a/blog/views.py +++ b/blog/views.py @@ -14,9 +14,7 @@ class PostListView(generic.ListView): template_name = "blog/post/list.html" -def post_detail( - request: HttpRequest, year: int, month: int, day: int, post_slug: str -): +def post_detail(request: HttpRequest, year: int, month: int, day: int, post_slug: str): post = get_object_or_404( Post.published, slug=post_slug, @@ -49,6 +47,4 @@ def post_share(request: HttpRequest, post_id: int): send_mail(subject, message, "parham.alvani@gmail.com", [cd["to"]]) else: form = EmailPostForm() - return render( - request, "blog/post/share.html", {"post": post, "form": form} - ) + return render(request, "blog/post/share.html", {"post": post, "form": form}) diff --git a/django101/settings.py b/django101/settings.py index 56e3741..29998ef 100644 --- a/django101/settings.py +++ b/django101/settings.py @@ -20,9 +20,7 @@ # See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = ( - "django-insecure-bz2%zv(*w^5=8#zso=zh6ebp0ivbt6$wxzz@0rq+-ag(r5@&n-" -) +SECRET_KEY = "django-insecure-bz2%zv(*w^5=8#zso=zh6ebp0ivbt6$wxzz@0rq+-ag(r5@&n-" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True diff --git a/django101/urls.py b/django101/urls.py index 5872b88..cbac399 100644 --- a/django101/urls.py +++ b/django101/urls.py @@ -13,6 +13,7 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin from django.urls import path, include from django.conf import settings diff --git a/manage.py b/manage.py index f81ccd7..1bac669 100755 --- a/manage.py +++ b/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python """Django's command-line utility for administrative tasks.""" + import os import sys diff --git a/pyproject.toml b/pyproject.toml index 532ecb8..e436a06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,5 +15,6 @@ dependencies = [ dev = [ "django-stubs>=5.1.1", "djlint>=1.36.4", + "mypy>=1.14.0", "ruff>=0.8.4", ] diff --git a/uv.lock b/uv.lock index 9bb8a8b..3199304 100644 --- a/uv.lock +++ b/uv.lock @@ -100,6 +100,7 @@ dependencies = [ dev = [ { name = "django-stubs" }, { name = "djlint" }, + { name = "mypy" }, { name = "ruff" }, ] @@ -115,6 +116,7 @@ requires-dist = [ dev = [ { name = "django-stubs", specifier = ">=5.1.1" }, { name = "djlint", specifier = ">=1.36.4" }, + { name = "mypy", specifier = ">=1.14.0" }, { name = "ruff", specifier = ">=0.8.4" }, ] @@ -203,6 +205,33 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/aa/42/797895b952b682c3dafe23b1834507ee7f02f4d6299b65aaa61425763278/json5-0.10.0-py3-none-any.whl", hash = "sha256:19b23410220a7271e8377f81ba8aacba2fdd56947fbb137ee5977cbe1f5e8dfa", size = 34049 }, ] +[[package]] +name = "mypy" +version = "1.14.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mypy-extensions" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8c/7b/08046ef9330735f536a09a2e31b00f42bccdb2795dcd979636ba43bb2d63/mypy-1.14.0.tar.gz", hash = "sha256:822dbd184d4a9804df5a7d5335a68cf7662930e70b8c1bc976645d1509f9a9d6", size = 3215684 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/13/33/8380efd0ebdfdfac7fc0bf065f03a049800ca1e6c296ec1afc634340d992/mypy-1.14.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e9f6f4c0b27401d14c483c622bc5105eff3911634d576bbdf6695b9a7c1ba741", size = 11251509 }, + { url = "https://files.pythonhosted.org/packages/15/6d/4e1c21c60fee11af7d8e4f2902a29886d1387d6a836be16229eb3982a963/mypy-1.14.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:56b2280cedcb312c7a79f5001ae5325582d0d339bce684e4a529069d0e7ca1e7", size = 10244282 }, + { url = "https://files.pythonhosted.org/packages/8b/cf/7a8ae5c0161edae15d25c2c67c68ce8b150cbdc45aefc13a8be271ee80b2/mypy-1.14.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:342de51c48bab326bfc77ce056ba08c076d82ce4f5a86621f972ed39970f94d8", size = 12867676 }, + { url = "https://files.pythonhosted.org/packages/9c/d0/71f7bbdcc7cfd0f2892db5b13b1e8857673f2cc9e0c30e3e4340523dc186/mypy-1.14.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:00df23b42e533e02a6f0055e54de9a6ed491cd8b7ea738647364fd3a39ea7efc", size = 12964189 }, + { url = "https://files.pythonhosted.org/packages/a7/40/fb4ad65d6d5f8c51396ecf6305ec0269b66013a5bf02d0e9528053640b4a/mypy-1.14.0-cp313-cp313-win_amd64.whl", hash = "sha256:e8c8387e5d9dff80e7daf961df357c80e694e942d9755f3ad77d69b0957b8e3f", size = 9888247 }, + { url = "https://files.pythonhosted.org/packages/39/32/0214608af400cdf8f5102144bb8af10d880675c65ed0b58f7e0e77175d50/mypy-1.14.0-py3-none-any.whl", hash = "sha256:2238d7f93fc4027ed1efc944507683df3ba406445a2b6c96e79666a045aadfab", size = 2752803 }, +] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/98/a4/1ab47638b92648243faf97a5aeb6ea83059cc3624972ab6b8d2316078d3f/mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782", size = 4433 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/e2/5d3f6ada4297caebe1a2add3b126fe800c96f56dbe5d1988a2cbe0b267aa/mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d", size = 4695 }, +] + [[package]] name = "packaging" version = "24.2"