Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/python-app-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ jobs:

- name: Install dependencies
run: |
pip install .
pip install ".[dev]"

- name: Run linters
run: |
source .venv/bin/activate
ruff .
black .

Expand All @@ -41,6 +40,5 @@ jobs:
GH_CLIENT_ID: "###"
GH_CLIENT_SECRET: "###"
run: |
source .venv/bin/activate
python manage.py collectstatic
pytest --cov=. -n auto # Run tests with coverage and in parallel
2 changes: 1 addition & 1 deletion .github/workflows/python-app-poetry.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Python application with Poetry

on:
push:
Expand Down
17 changes: 3 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,15 @@ FROM python:${PYTHON_VERSION} as python
LABEL authors="piwero"

ARG APP_HOME=/app

ENV PYTHONUNBUFFERED=1 \
# prevents python creating .pyc files
PYTHONDONTWRITEBYTECODE=1 \
\
# pip
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
\
# poetry
# https://python-poetry.org/docs/configuration/#using-environment-variables
POETRY_VERSION=1.5.1 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1
PIP_DEFAULT_TIMEOUT=100

ENV PATH="$POETRY_HOME/bin:$PATH"

# Install apt packages
RUN apt-get update && apt-get install --no-install-recommends -y \
Expand All @@ -31,15 +23,12 @@ 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/*

RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/${POETRY_VERSION}/install-poetry.py | python - --version ${POETRY_VERSION}

WORKDIR ${APP_HOME}

#copy poetry files
COPY poetry.lock pyproject.toml ./
COPY pyproject.toml ./

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi
RUN pip install .

# copy application code to WORKDIR
COPY . .
2 changes: 1 addition & 1 deletion kubernetes/app/django/django-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
spec:
containers:
- name: crud-auth-github
image: piwero/crud_auth_github:2.0
image: piwero/crud_auth_github:3.0
imagePullPolicy: Always
command:
- "sh"
Expand Down
65 changes: 34 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
[tool.poetry]
[project]
name = "crud-auth-github"
version = "2"
description = ""
authors = ["piwero <piwero@gmail.com>"]
authors = [{name="piwero"}]
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"asgiref>=3.7.2",
"Django>=4.0.0",
"django-allauth==0.54.0",
"django-crispy-forms>=1.14.0",
"dj-database-url>=2.0.0",
"gunicorn>=21.0.0",
"psycopg2-binary>=2.9.3",
"python-decouple>=3.6",
"sqlparse>=0.4.4",
"whitenoise>=6.2.0"
]


[tool.poetry.dependencies]
asgiref = "^3.7.2"
Django = "^4.0.0"
django-allauth = "^0.54.0"
django-crispy-forms = "^1.14.0"
dj-database-url = "^2.0.0"
gunicorn = "^21.0.0"
psycopg2-binary = "^2.9.3"
python = "^3.10"
python-decouple = "^3.6"
sqlparse = "^0.4.4"
whitenoise = "^6.2.0"

[tool.poetry.group.dev.dependencies]
black = "^23.3.0"
django-debug-toolbar = "^4.1.0"
django-extensions = "^3.2.3"
mypy = "^1.2.0"
ipdb = "^0.13.13"
isort = "^5.12.0"
pre-commit = "^3.2.2"
pytest = "^7.3.1"
pytest-cov = "^4.0.0"
pytest-django = "^4.5.2"
pytest-xdist = "^3.2.1"
ruff = "^0.0.291"
[project.optional-dependencies]
dev = [
"black>=23.3.0",
"django-debug-toolbar>=4.1.0",
"django-extensions>=3.2.3",
"mypy>=1.2.0",
"ipdb>=0.13.13",
"isort>=5.12.0",
"pre-commit>=3.2.2",
"pytest>=7.3.1",
"pytest-cov>=4.0.0",
"pytest-django>=4.5.2",
"pytest-xdist>=3.2.1",
"ruff>=0.0.291"
]
[tool.setuptools.packages]
find = {}

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "core.settings.test_settings"
Expand Down Expand Up @@ -67,5 +70,5 @@ exclude = [
line-length = 88

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["setuptools>=63.0"]
build-backend = "setuptools.build_meta"