Skip to content

Commit

Permalink
Merge branch 'update-deps' into 'master'
Browse files Browse the repository at this point in the history
Update python dependencies

See merge request thorgate-public/django-project-template!262
  • Loading branch information
IncrePrior committed Jun 8, 2022
2 parents 9bd0955 + f30f568 commit e9cf772
Show file tree
Hide file tree
Showing 13 changed files with 154 additions and 72 deletions.
112 changes: 83 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ python = "^3.7.0"

cookiecutter = "==1.7.*"
cookiecutter_repo_extensions = "==0.2.*"
docker = "==4.*"
docker = "==5.*"
fqdn = "==1.*"
stringcase = "==1.2.*"
ansible-vault = "^2.1.0"

[tool.poetry.dev-dependencies]
black = "==22.3.0"
docker-compose = "==1.25.*"
pyyaml = "==5.3.*"
docker-compose = "==1.29.*"
pyyaml = "*"
pytest = "==7.*"
pytest-env = "*"
pytest-cookies = "==0.6.1"
Expand Down
15 changes: 13 additions & 2 deletions {{cookiecutter.repo_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ run-python:
docker run -t --rm \
-v $(DPT_POETRY_CACHE_DIR):/root/.cache/pypoetry \
-v $(DPT_PIP_CACHE_DIR):/root/.cache/pip \
-v $(SITE_ROOT):/app $(DJANGO_IMAGE_NAME) $(cmd)
-v $(SITE_ROOT):/app \
-v $(PROJECT_ROOT)/pyproject.toml:/pyproject.toml \
-v $(PROJECT_ROOT)/poetry.lock:/poetry.lock \
$(DJANGO_IMAGE_NAME) $(cmd)


.PHONY:
Expand Down Expand Up @@ -258,7 +261,11 @@ $(SITE_ROOT)/settings/local_test.py:


.PHONY:
{%- if cookiecutter.frontend_style == 'webapp' %}
coverage-py: webapp/webapp/build ## Runs python/django test coverage calculation
{%- else %}
coverage-py: ## Runs python/django test coverage calculation
{%- endif %}
@echo -e "$(CYAN)Running automatic code coverage check$(COFF)"
@docker-compose run --rm django pytest --cov=. --cov-report html --cov-report xml --cov-report term-missing $(cmd)

Expand Down Expand Up @@ -305,10 +312,14 @@ test-js: clean


.PHONY:
test-py: clean
test-py: clean{% if cookiecutter.frontend_style == 'webapp' %} webapp/webapp/build{% endif %}
@echo -e "$(CYAN)Running automatic django tests$(COFF)"
@docker-compose run --rm django py.test $(cmd)
{%- if cookiecutter.frontend_style == 'webapp' %}

webapp/webapp/build:
mkdir -p webapp/webapp/build
{%- endif %}

.PHONY:
test-django: test-py
Expand Down
16 changes: 8 additions & 8 deletions {{cookiecutter.repo_name}}/ansible/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ description = "Ansible scripts for {{ cookiecutter.project_title }} deployment"
authors = ["Thorgate <hi@thorgate.eu>"]

[tool.poetry.dependencies]
python = "^3.6"
ansible = "^2.9"
jinja2 = "^2.10"
docker-compose = "^1.25"
cryptography = "^2.8"
yq = "^2.12.2"
jq = "^1.2.1"
python = "^3.8"
ansible = "^5.7"
jinja2 = "^3.1"
docker-compose = "^1.29"
cryptography = "^37.0.2"
yq = "^2.14.0"
jq = "^1.2.2"

[tool.poetry.dev-dependencies]
PyYAML = "^5.3"
PyYAML = "^5.4"

[build-system]
requires = ["poetry>=1.0"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

- set_fact:
media_backend: "S3"
when: "settings.AWS_ACCESS_KEY_ID and settings.AWS_ACCESS_KEY_ID != '<unset>'"
when: "'AWS_ACCESS_KEY_ID' in settings and settings.AWS_ACCESS_KEY_ID != '<unset>'"
ignore_errors: yes


- set_fact:
media_backend: "GCS"
when: "settings.GS_PROJECT_ID and settings.GS_PROJECT_ID != '<unset>'"
when: "'GS_PROJECT_ID' in settings and settings.GS_PROJECT_ID != '<unset>'"
ignore_errors: yes


Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/docker-compose.cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Note: -cypress suffixes were added to the container names so that
# Cypress tests could be run while the project is up.

version: '2.1'
version: '3.8'

services:
django-cypress:
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/docker-compose.production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ services:
# - {% endif %}

redis:
image: redis:4.0.10-alpine
image: redis:7-alpine
restart: unless-stopped
sysctls:
# To allow maintaining TCP backlog setting that defaults to 511
Expand Down
17 changes: 12 additions & 5 deletions {{cookiecutter.repo_name}}/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ x-django-container-spec: &django-container-spec
- ".data/media:/files/media"
- &poetry-volume "${DPT_POETRY_CACHE_DIR:-.data/pycache/pypoetry}:/root/.cache/pypoetry"
- &pip-volume "${DPT_PIP_CACHE_DIR:-.data/pycache/pip}:/root/.cache/pip"
- &pyproject-volume "./pyproject.toml:/pyproject.toml"
- &poetrylock-volume "./poetry.lock:/poetry.lock"
depends_on:
- postgres
- redis
Expand All @@ -38,7 +40,7 @@ services:
django:
<<: *django-container-spec
ports:
- "${DJANGO_PORT-8000}:80"
- "${DJANGO_PORT:-8000}:80"
# Add -Wall option to see the (deprecation) warnings
# command: python -Wall manage.py runserver 0.0.0.0:80
command: python manage.py runserver 0.0.0.0:80
Expand Down Expand Up @@ -88,6 +90,8 @@ services:
- *py-code-volume
- *poetry-volume
- *pip-volume
- *pyproject-volume
- *poetrylock-volume
depends_on:
- redis
entrypoint: entrypoint.sh --
Expand All @@ -98,6 +102,7 @@ services:
# - {%- endif %}

postgres:
<<: *common-spec
image: postgres:{{cookiecutter.postgres_version}}
# Comment in the following lines to connect to your Dockerized instance of Postgres from your host machine.
# Change the host port (before colon) if you have a local instance of Postgres running on that port.
Expand All @@ -109,20 +114,22 @@ services:
- "./scripts/create-citext-extension.sql:/docker-entrypoint-initdb.d/create-citext-extension.sql"
environment:
# credentials taken from .env file
POSTGRES_USER: "${DJANGO_DATABASE_USER-'{{ cookiecutter.repo_name }}'}"
POSTGRES_PASSWORD: "${DJANGO_DATABASE_PASSWORD-'{{ cookiecutter.repo_name }}'}"
POSTGRES_USER: "${DJANGO_DATABASE_USER:-{{ cookiecutter.repo_name }}}"
POSTGRES_PASSWORD: "${DJANGO_DATABASE_PASSWORD:-{{ cookiecutter.repo_name }}}"

redis:
image: redis:4.0.10-alpine
<<: *common-spec
image: redis:7-alpine
sysctls:
# To allow maintaining TCP backlog setting that defaults to 511
net.core.somaxconn: 512
volumes:
- ".data/redis:/data"

mailhog:
<<: *common-spec
image: mailhog/mailhog:v1.0.0
ports:
- "${MAILHOG_PORT-8025}:8025"
- "${MAILHOG_PORT:-8025}:8025"
logging:
driver: "none"

0 comments on commit e9cf772

Please sign in to comment.