From 2fd9df8cc6ee0c98cca91e90c64b2512ac96ff4b Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 24 Jul 2024 11:32:51 +0200 Subject: [PATCH 1/4] Allow pre-commit to run on my system's Python (3.10) - so I can install with pipx --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49e1ce6..7388e5d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.12 + python: python3 exclude: ^.*\b(migrations)\b.*$ repos: - repo: https://github.com/pre-commit/pre-commit-hooks -- 2.43.4 From 0f1211fa83e25a058c1fb2d9507671944466ea42 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 24 Jul 2024 11:33:28 +0200 Subject: [PATCH 2/4] Remove health-check for Postgres (it's now in docker-compose.yml) --- entrypoint.sh | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9df57b6..008f7be 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,16 +1,5 @@ #!/bin/sh -echo "Waiting for postgres..." - -POSTGRES_PORT=${POSTGRES_PORT:-5432} -POSTGRES_HOST=${POSTGRES_HOST:-localhost} - -while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do - sleep 0.1 -done - -echo "PostgreSQL started" - # Only migrate, collectstatic and compilemessages if we are NOT in development if [ -z "$DEBUG" ]; then python src/manage.py migrate; -- 2.43.4 From a835db6ab9196993679f538f1051fcffb13506f5 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 24 Jul 2024 11:33:43 +0200 Subject: [PATCH 3/4] Loose requirements pinning in pyproject.toml and re-generate requirements --- pyproject.toml | 20 +++++++------- requirements.txt | 46 ++++++++++++++----------------- requirements/requirements-dev.txt | 18 ++++++------ 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 643b1cd..df44311 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,17 +12,17 @@ authors = [ { name = "Víðir Valberg Guðmundsson", email = "valberg@orn.li" }, ] dependencies = [ - "Django==5.0.7", - "django-money==3.5.2", - "django-allauth==0.63.6", - "psycopg[binary]==3.2.1", - "environs[django]==11.0.0", - "uvicorn==0.30.1", - "whitenoise==6.7.0", - "django-zen-queries==2.1.0", + "Django~=5.0", + "django-money~=3.5", + "django-allauth~=0.63", + "psycopg[binary]~=3.2", + "environs[django]>=11,<12", + "uvicorn~=0.30", + "whitenoise~=6.7", + "django-zen-queries~=2.1", "django-registries==0.0.3", "django-view-decorator==0.0.4", - "django-oauth-toolkit==2.4.0", + "django-oauth-toolkit~=2.4", ] version = "0.0.1" @@ -66,7 +66,7 @@ matrix.python.dependencies = [ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests --cov=append {args}" no-cov = "cov --no-cov {args}" typecheck = "mypy --config-file=pyproject.toml ." -requirements = "pip-compile --output-file requirements/base.txt pyproject.toml" +requirements = "pip-compile pyproject.toml" server = "./src/manage.py runserver 0.0.0.0:8000" migrate = "./src/manage.py migrate" makemigrations = "./src/manage.py makemigrations" diff --git a/requirements.txt b/requirements.txt index 5642b3a..b36b955 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,9 @@ # -# This file is autogenerated by hatch-pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: # -# - django-allauth==0.63.6 -# - django-money==3.5.2 -# - django-oauth-toolkit==2.4.0 -# - django-registries==0.0.3 -# - django-view-decorator==0.0.4 -# - django-zen-queries==2.1.0 -# - django==5.0.7 -# - environs[django]==11.0.0 -# - psycopg[binary]==3.2.1 -# - uvicorn==0.30.1 -# - whitenoise==6.7.0 +# pip-compile pyproject.toml # - asgiref==3.8.1 # via django babel==2.15.0 @@ -34,7 +24,6 @@ dj-email-url==1.0.6 # via environs django==5.0.7 # via - # hatch.envs.default # dj-database-url # django-allauth # django-money @@ -42,22 +31,25 @@ django==5.0.7 # django-registries # django-view-decorator # django-zen-queries + # membersystem (pyproject.toml) django-allauth==0.63.6 - # via hatch.envs.default + # via membersystem (pyproject.toml) django-cache-url==3.4.5 # via environs django-money==3.5.2 - # via hatch.envs.default + # via membersystem (pyproject.toml) django-oauth-toolkit==2.4.0 - # via hatch.envs.default + # via membersystem (pyproject.toml) django-registries==0.0.3 - # via hatch.envs.default + # via membersystem (pyproject.toml) django-view-decorator==0.0.4 - # via hatch.envs.default + # via membersystem (pyproject.toml) django-zen-queries==2.1.0 - # via hatch.envs.default -environs==11.0.0 - # via hatch.envs.default + # via membersystem (pyproject.toml) +environs[django]==11.0.0 + # via + # environs + # membersystem (pyproject.toml) h11==0.14.0 # via uvicorn idna==3.7 @@ -70,8 +62,10 @@ oauthlib==3.2.2 # via django-oauth-toolkit packaging==24.1 # via marshmallow -psycopg==3.2.1 - # via hatch.envs.default +psycopg[binary]==3.2.1 + # via + # membersystem (pyproject.toml) + # psycopg psycopg-binary==3.2.1 # via psycopg py-moneyed==3.0 @@ -95,9 +89,9 @@ typing-extensions==4.12.2 urllib3==2.2.2 # via requests uvicorn==0.30.1 - # via hatch.envs.default + # via membersystem (pyproject.toml) whitenoise==6.7.0 - # via hatch.envs.default + # via membersystem (pyproject.toml) # The following packages are considered to be unsafe in a requirements file: # setuptools diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index f044e8c..88d018a 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -11,17 +11,17 @@ # - django-debug-toolbar==4.2.0 # - django-browser-reload==1.7.0 # - model-bakery==1.17.0 -# - django-allauth==0.63.6 -# - django-money==3.5.2 -# - django-oauth-toolkit==2.4.0 +# - django-allauth~=0.63 +# - django-money~=3.5 +# - django-oauth-toolkit~=2.4 # - django-registries==0.0.3 # - django-view-decorator==0.0.4 -# - django-zen-queries==2.1.0 -# - django==5.0.7 -# - environs[django]==11.0.0 -# - psycopg[binary]==3.2.1 -# - uvicorn==0.30.1 -# - whitenoise==6.7.0 +# - django-zen-queries~=2.1 +# - django~=5.0 +# - environs[django]<12,>=11 +# - psycopg[binary]~=3.2 +# - uvicorn~=0.30 +# - whitenoise~=6.7 # asgiref==3.8.1 -- 2.43.4 From 24f3c30a41b9068b350e9bd66a329aaba18efd33 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 24 Jul 2024 14:07:06 +0200 Subject: [PATCH 4/4] Revert "Remove health-check for Postgres (it's now in docker-compose.yml)" This reverts commit 0f1211fa83e25a058c1fb2d9507671944466ea42. --- entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 008f7be..9df57b6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,5 +1,16 @@ #!/bin/sh +echo "Waiting for postgres..." + +POSTGRES_PORT=${POSTGRES_PORT:-5432} +POSTGRES_HOST=${POSTGRES_HOST:-localhost} + +while ! nc -z "$POSTGRES_HOST" "$POSTGRES_PORT"; do + sleep 0.1 +done + +echo "PostgreSQL started" + # Only migrate, collectstatic and compilemessages if we are NOT in development if [ -z "$DEBUG" ]; then python src/manage.py migrate; -- 2.43.4