added PDM dependencies manager.

This commit is contained in:
litvinau.alex 2024-09-23 15:35:35 +03:00
parent 37a20861db
commit 208670c012
3 changed files with 99 additions and 9 deletions

View File

@ -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",

View File

@ -13,13 +13,20 @@ 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
@ -55,13 +62,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
# All absolute dir copies ignore workdir instruction. All relative dir copies are wrt to the workdir instruction
# copy python dependency wheels from python-build-stage
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
# use wheels to install python dependencies
{% if cookiecutter.dependency_manager == 'PDM' %}
COPY pyproject.toml pdm.lock ./
RUN pdm install --prod --no-editable \
{% else %}
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
RUN pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* \
&& rm -rf /wheels/
&& rm -rf /wheels/ \
{% endif %}
COPY ./compose/production/django/entrypoint /entrypoint
RUN sed -i 's/\r$//g' /entrypoint

View File

@ -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"