From f3bdb36ca8ceb1374cab43b884704adf10203fb7 Mon Sep 17 00:00:00 2001 From: bronsen Date: Thu, 21 Nov 2024 19:46:09 +0100 Subject: [PATCH 1/3] [requirements] have manage.py ensure requirements are up to date --- src/manage.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/manage.py b/src/manage.py index 22d839f..46d6fb9 100755 --- a/src/manage.py +++ b/src/manage.py @@ -3,6 +3,7 @@ import os import sys +from pathlib import Path def main(): @@ -11,6 +12,19 @@ def main(): from configurations.management import execute_from_command_line + try: + import pip_lock + except ModuleNotFoundError: + raise ModuleNotFoundError( + "Couldn't import pip-lock. Are you on the right virtualenv and up to date?" + ) + + requirements_path = str(Path(__file__).parent.parent / "requirements/base.txt") + pip_lock.check_requirements( + requirements_path, + post_text="\nRun the following:\n\npython -m pip install -r requirements/base.txt\n", + ) + execute_from_command_line(sys.argv) From 1d44ea830e67e96edf84a343d68fc69cd9adf57b Mon Sep 17 00:00:00 2001 From: bronsen Date: Thu, 21 Nov 2024 19:46:35 +0100 Subject: [PATCH 2/3] [settings] Make it more complicated, why not --- src/dx/settings.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dx/settings.py b/src/dx/settings.py index 2ff9590..bbdd462 100644 --- a/src/dx/settings.py +++ b/src/dx/settings.py @@ -4,6 +4,15 @@ from configurations import Configuration BASE_DIR = Path(__file__).resolve().parent.parent +class EnableDebug(Configuration): + """ + Intended as a MIXIN + """ + + DEBUG = True + INSTALLED_APPS = Configuration.INSTALLED_APPS + ["django_debug_toolbar"] + + class Base(Configuration): DEBUG = False DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" @@ -22,7 +31,7 @@ class Base(Configuration): USE_TZ = True -class Dev(Base): +class Dev(EnableDebug, Base): # Dangerous: disable host header validation ALLOWED_HOSTS = ["*"] DATABASES = { @@ -31,7 +40,6 @@ class Dev(Base): "NAME": "db.sqlite3", }, } - DEBUG = True INSTALLED_APPS = Base.INSTALLED_APPS + ["django_extensions"] From e70af2376be4228f1506d3a288fd002b5dc3a673 Mon Sep 17 00:00:00 2001 From: bronsen Date: Thu, 21 Nov 2024 19:47:14 +0100 Subject: [PATCH 3/3] [ci] create woodpecker pipline thing It's gonna break anyway --- .woodpecker/workflow.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .woodpecker/workflow.yaml diff --git a/.woodpecker/workflow.yaml b/.woodpecker/workflow.yaml new file mode 100644 index 0000000..d7ad11e --- /dev/null +++ b/.woodpecker/workflow.yaml @@ -0,0 +1,11 @@ +when: + - event: push + branch: main + +steps: + - name: lint-and-test + image: debian + commands: + - pip install -r requirements/test.txt + - ruff check src + - python -m pytest