From f2387ddf2fa277cd266fb2b94fd8d5a495be7b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A8r=20Kessels?= Date: Tue, 31 Mar 2026 10:00:18 +0200 Subject: [PATCH] chore: Add type stubs for Django and rest This "fixes" several hundreds of typing errors and warnings. Leaving us with several hundred of relevant warnings and about fifty relevant and potentially problematic errors. Add development dependencies and installation instructions Add requirements-dev.txt with type stubs for Django and DRF Update installation docs in README, dev.Dockerfile and S3_STORAGE_SETUP.md Include dev dependencies installation step in all relevant docs --- Dockerfile | 3 +++ README.md | 4 +++- requirements-dev.txt | 4 ++++ requirements.txt | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 requirements-dev.txt diff --git a/Dockerfile b/Dockerfile index cb7cd10ab..888d4182c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,9 @@ RUN pip install --upgrade pip setuptools wheel # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt +# Install development dependencies +RUN uv pip install --system --no-cache -r requirements-dev.txt + # Make port 8000 available to the world outside this container EXPOSE 8000 diff --git a/README.md b/README.md index 21235280c..047a9104c 100644 --- a/README.md +++ b/README.md @@ -152,8 +152,10 @@ _from within edubadges-server directory_ - `pip install -r requirements.txt` -if on a mac mysqlclient does not build, try: +For development, also install development dependencies: +- `pip install -r requirements-dev.txt` +if on a mac mysqlclient does not build, try: ``` LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient ``` diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 000000000..32a3688a1 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +# Development dependencies +django-stubs==5.1.3 # 5.x is mostly backwards compatible with Django 4.2, see https://github.com/typeddjango/django-stubs/discussions/2101. +django-stubs-ext==5.1.3 +djangorestframework-stubs==3.15.3 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index df9818d6f..2524f720e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,7 +23,7 @@ drf_spectacular_sidecar==2025.2.1 django-object-actions==4.3.0 -pymemcache==4.0.0 +pymemcache==4.0.0 djangorestframework==3.15.2 django-filter==25.1