From 19c76c4e88b7d16a63e1d2b59df5616b2e566b38 Mon Sep 17 00:00:00 2001 From: "litvinau.alex" Date: Mon, 23 Sep 2024 15:35:35 +0300 Subject: [PATCH] added PDM dependencies manager. --- cookiecutter.json | 1 + .../compose/local/django/Dockerfile | 12 ++- {{cookiecutter.project_slug}}/pyproject.toml | 81 +++++++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 86e44f368..9651fc8ef 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -13,6 +13,7 @@ "Apache Software License 2.0", "Not open source" ], + "dependency_manager": ["requirements.txt", "PDM"], "username_type": ["username", "email"], "timezone": "UTC", "windows": "n", diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index fbb62e239..9536df342 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -13,13 +13,21 @@ RUN apt-get update && apt-get install --no-install-recommends -y \ # psycopg dependencies libpq-dev +{% if cookiecutter.dependency_manager == 'PDM' %} +# Устанавливаем PDM +RUN pip install pdm +# Копируем pyproject.toml и pdm.lock +COPY pyproject.toml pdm.lock ./ +# Устанавливаем зависимости с помощью PDM +RUN pdm install --prod --no-editable\ +{% else %} # Requirements are installed here to ensure they will be cached. COPY ./requirements . # Create Python Dependency and Sub-Dependency Wheels. RUN pip wheel --wheel-dir /usr/src/app/wheels \ - -r ${BUILD_ENVIRONMENT}.txt - + -r ${BUILD_ENVIRONMENT}.txt \ +{% endif %} # Python 'run' stage FROM python AS python-run-stage diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 98a883b62..0593b60fd 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -1,3 +1,53 @@ +# ==== prod dependencies ==== +dependencies = [ + "python-slugify==8.0.4", + "Pillow==10.4.0", + {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} + {%- if cookiecutter.windows == 'y' and cookiecutter.use_docker == 'n' %} + "rcssmin==1.1.2 --install-option=\"--without-c-extensions\"", + {%- else %} + "rcssmin==1.1.2", + {%- endif %} + {%- endif %} + "argon2-cffi==23.1.0", + {%- if cookiecutter.use_whitenoise == 'y' %} + "whitenoise==6.7.0", + {%- endif %} + "redis==5.0.8", + {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} + "hiredis==3.0.0", + {%- endif %} + {%- if cookiecutter.use_celery == "y" %} + "celery==5.4.0", + "django-celery-beat==2.7.0", + {%- if cookiecutter.use_docker == 'y' %} + "flower==2.0.1", + {%- endif %} + {%- endif %} + {%- if cookiecutter.use_async == 'y' %} + "uvicorn[standard]==0.30.6", + "uvicorn-worker==0.2.0", + {%- endif %} + "django==5.0.9", + "django-environ==0.11.2", + "django-model-utils==5.0.0", + "django-allauth[mfa]==64.2.1", + "django-crispy-forms==2.3", + "crispy-bootstrap5==2024.2", + {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} + "django-compressor==4.5.1", + {%- endif %} + "django-redis==5.4.0", + {%- if cookiecutter.use_drf == 'y' %} + "djangorestframework==3.15.2", + "django-cors-headers==4.4.0", + "drf-spectacular==0.27.2", + {%- endif %} + {%- if cookiecutter.frontend_pipeline == 'Webpack' %} + "django-webpack-loader==3.1.1", + {%- endif %} +] + # ==== pytest ==== [tool.pytest.ini_options] minversion = "6.0" @@ -140,3 +190,34 @@ extend-unsafe-fixes = [ [tool.ruff.lint.isort] force-single-line = true + +[dev-dependencies] +watchdog = "4.0.2" +Werkzeug = { version = "3.0.4", extras = ["watchdog"] } +ipdb = "0.13.13" +{%- if cookiecutter.use_docker == 'y' %} +psycopg = { version = "3.2.2", extras = ["c"] } +{%- else %} +psycopg = { version = "3.2.2", extras = ["binary"] } +{%- endif %} +{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %} +watchfiles = "0.24.0" +{%- endif %} +mypy = "1.11.2" +django-stubs = { version = "5.0.4", extras = ["compatible-mypy"] } +pytest = "8.3.3" +pytest-sugar = "1.0.0" +{%- if cookiecutter.use_drf == "y" %} +djangorestframework-stubs = "3.15.1" +{%- endif %} +sphinx = "7.4.7" +sphinx-autobuild = "2024.9.19" +ruff = "0.6.6" +coverage = "7.6.1" +djlint = "1.35.2" +pre-commit = "3.8.0" +factory-boy = "3.3.1" +django-debug-toolbar = "4.4.6" +django-extensions = "3.2.3" +django-coverage-plugin = "3.1.0" +pytest-django = "4.9.0"