Skip to content

Commit 58362f0

Browse files
authored
Merge pull request #1 from testdrivenio/update-2026
Update 2026
2 parents 0c7b732 + eb01a81 commit 58362f0

38 files changed

Lines changed: 2308 additions & 922 deletions

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
venv
1+
.venv
22
.dockerignore
33
Dockerfile
44
.git
55
.gitignore
66
.pytest_cache
7-
.github
7+
.github

.flake8

Lines changed: 0 additions & 7 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to heroku.
1+
name: CI
22
on:
33
push:
44
branches:
@@ -7,42 +7,28 @@ jobs:
77
tests:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-python@v5
10+
- uses: actions/checkout@v6
11+
- name: Install uv
12+
uses: astral-sh/setup-uv@v8.1.0
1213
with:
13-
python-version: '3.12'
14+
python-version: '3.13'
15+
enable-cache: true
1416
- name: Install dependencies
15-
run: pip install -r requirements.txt
16-
- name: Install dev dependencies
17-
run: pip install -r requirements-dev.txt
17+
run: uv sync --locked
1818
- name: Run tests
19-
run: pytest
19+
run: uv run pytest
2020
code-quality:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v4
24-
- uses: actions/setup-python@v5
23+
- uses: actions/checkout@v6
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v8.1.0
2526
with:
26-
python-version: '3.12'
27+
python-version: '3.13'
28+
enable-cache: true
2729
- name: Install dependencies
28-
run: pip install -r requirements.txt
29-
- name: Install dev dependencies
30-
run: pip install -r requirements-dev.txt
31-
- name: Run black
32-
run: black . --check
33-
- name: Run isort
34-
run: isort . --check-only --profile black
35-
- name: Run flake8
36-
run: flake8 .
37-
deploy:
38-
runs-on: ubuntu-latest
39-
needs: [tests, code-quality]
40-
steps:
41-
- name: Checkout
42-
uses: actions/checkout@v4
43-
- name: Deploy to Heroku
44-
uses: akhileshns/heroku-deploy@v3.12.12
45-
with:
46-
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
47-
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
48-
heroku_email: ${{ secrets.HEROKU_EMAIL }}
30+
run: uv sync --locked
31+
- name: Run Ruff linter
32+
run: uv run ruff check .
33+
- name: Run Ruff formatter
34+
run: uv run ruff format --check .

.gitignore

Lines changed: 80 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
*.py[cod]
3+
*.py[codz]
44
*$py.class
55

66
# C extensions
@@ -27,8 +27,8 @@ share/python-wheels/
2727
MANIFEST
2828

2929
# PyInstaller
30-
# Usually these files are written by a python script from a template
31-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3232
*.manifest
3333
*.spec
3434

@@ -46,7 +46,8 @@ htmlcov/
4646
nosetests.xml
4747
coverage.xml
4848
*.cover
49-
*.py,cover
49+
*.py.cover
50+
*.lcov
5051
.hypothesis/
5152
.pytest_cache/
5253
cover/
@@ -92,37 +93,65 @@ ipython_config.py
9293
# However, in case of collaboration, if having platform-specific dependencies or dependencies
9394
# having no cross-platform support, pipenv may install dependencies that don't work, or not
9495
# install all needed dependencies.
95-
#Pipfile.lock
96+
# Pipfile.lock
97+
98+
# UV
99+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# uv.lock
96103

97104
# poetry
98105
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99106
# This is especially recommended for binary packages to ensure reproducibility, and is more
100107
# commonly ignored for libraries.
101108
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102-
#poetry.lock
109+
# poetry.lock
110+
# poetry.toml
103111

104112
# pdm
105113
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106-
#pdm.lock
107-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108-
# in version control.
109-
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110-
.pdm.toml
114+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116+
# pdm.lock
117+
# pdm.toml
111118
.pdm-python
112119
.pdm-build/
113120

121+
# pixi
122+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123+
# pixi.lock
124+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125+
# in the .venv directory. It is recommended not to include this directory in version control.
126+
.pixi/*
127+
!.pixi/config.toml
128+
114129
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115130
__pypackages__/
116131

117132
# Celery stuff
118-
celerybeat-schedule
133+
celerybeat-schedule*
119134
celerybeat.pid
120135

136+
# Redis
137+
*.rdb
138+
*.aof
139+
*.pid
140+
141+
# RabbitMQ
142+
mnesia/
143+
rabbitmq/
144+
rabbitmq-data/
145+
146+
# ActiveMQ
147+
activemq-data/
148+
121149
# SageMath parsed files
122150
*.sage.py
123151

124152
# Environments
125153
.env
154+
.envrc
126155
.venv
127156
env/
128157
venv/
@@ -155,8 +184,42 @@ dmypy.json
155184
cython_debug/
156185

157186
# PyCharm
158-
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159-
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160-
# and can be added to the global gitignore or merged into this file. For a more nuclear
161-
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
162-
.idea/
187+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189+
# and can be added to the global gitignore or merged into this file. For a more nuclear
190+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
191+
# .idea/
192+
193+
# Abstra
194+
# Abstra is an AI-powered process automation framework.
195+
# Ignore directories containing user credentials, local state, and settings.
196+
# Learn more at https://abstra.io/docs
197+
.abstra/
198+
199+
# Visual Studio Code
200+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
201+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
203+
# you could uncomment the following to ignore the entire vscode folder
204+
# .vscode/
205+
# Temporary file for partial code execution
206+
tempCodeRunnerFile.py
207+
208+
# Ruff stuff:
209+
.ruff_cache/
210+
211+
# PyPI configuration file
212+
.pypirc
213+
214+
# Marimo
215+
marimo/_static/
216+
marimo/_lsp/
217+
__marimo__/
218+
219+
# Streamlit
220+
.streamlit/secrets.toml
221+
222+
.idea
223+
224+
staticfiles/
225+

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

Dockerfile

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,31 @@
33
###########
44

55
# pull official base image
6-
FROM python:3.12-slim-bookworm as builder
6+
FROM python:3.13-slim-bookworm AS builder
77

8-
# install system dependencies
9-
RUN apt-get update \
10-
&& apt-get -y install g++ \
11-
&& apt-get clean
8+
# install uv
9+
COPY --from=ghcr.io/astral-sh/uv:0.11.19 /uv /uvx /bin/
1210

1311
# set work directory
1412
WORKDIR /usr/src/app
1513

1614
# set environment variables
17-
ENV PYTHONDONTWRITEBYTECODE 1
18-
ENV PYTHONUNBUFFERED 1
15+
ENV PYTHONDONTWRITEBYTECODE=1
16+
ENV PYTHONUNBUFFERED=1
17+
ENV UV_COMPILE_BYTECODE=1
18+
ENV UV_LINK_MODE=copy
1919

20-
# install python dependencies
21-
RUN pip install --upgrade pip
22-
COPY ./requirements.txt .
23-
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
20+
# install python dependencies into a virtual environment (.venv)
21+
COPY pyproject.toml uv.lock ./
22+
RUN uv sync --locked --no-dev --no-install-project
2423

2524

2625
#########
2726
# FINAL #
2827
#########
2928

3029
# pull official base image
31-
FROM python:3.12-slim-bookworm
30+
FROM python:3.13-slim-bookworm
3231

3332
# upgrade system packages
3433
RUN apt-get update && apt-get upgrade -y && apt-get clean
@@ -47,18 +46,16 @@ RUN mkdir $APP_HOME
4746
WORKDIR $APP_HOME
4847

4948
# set environment variables
50-
ENV PYTHONDONTWRITEBYTECODE 1
51-
ENV PYTHONUNBUFFERED 1
52-
ENV ENVIRONMENT prod
53-
ENV TESTING 0
54-
ENV PYTHONPATH $APP_HOME
49+
ENV PYTHONDONTWRITEBYTECODE=1
50+
ENV PYTHONUNBUFFERED=1
51+
ENV ENVIRONMENT=prod
52+
ENV TESTING=0
53+
ENV PYTHONPATH=$APP_HOME
54+
# activate the virtual environment by adding it to the PATH
55+
ENV PATH="/usr/src/app/.venv/bin:$PATH"
5556

56-
# install dependencies
57-
COPY --from=builder /usr/src/app/wheels /wheels
58-
COPY --from=builder /usr/src/app/requirements.txt .
59-
60-
RUN pip install --upgrade pip
61-
RUN pip install --no-cache /wheels/*
57+
# copy the pre-built virtual environment from the builder
58+
COPY --from=builder /usr/src/app/.venv /usr/src/app/.venv
6259

6360
# copy project
6461
COPY . $APP_HOME
@@ -72,5 +69,5 @@ RUN chown -R app:app $HOME
7269
# change to the app user
7370
USER app
7471

75-
# serve the application
76-
CMD gunicorn core.wsgi:application --bind 0.0.0.0:$PORT
72+
# perform the migrations, create a superuser, and serve the application
73+
CMD ./start_app.sh

0 commit comments

Comments
 (0)