Skip to content
Merged
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
173 changes: 173 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
.git
.github
**/.venv
**/__pycache__
**/*.py[cod]
**/.mypy_cache
**/.ruff_cache
.pre-commit-config.yaml
Taskfile.yml
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

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

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

20 changes: 17 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,27 @@ version: 2
updates:

# Enable version updates for Python
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"

# Enable version updates for Docker
- package-ecosystem: "docker"
directory: "/" # Location of package manifests
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore"
include: "scope"
47 changes: 47 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Python

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
steps:
- uses: actions/checkout@v7.0.1
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
persist-credentials: false
- name: Install uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v9.0.0
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install Task
uses: arduino/setup-task@v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v6.1.0
with:
path: .mypy_cache
key: ${{ runner.os }}-${{ matrix.python-version }}-mypy-${{ hashFiles('**/uv.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-mypy-
- name: Install dependencies
run: task install
- name: Lint
run: task lint
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.0
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v2.3.0
hooks:
- id: mypy
additional_dependencies: [flask]
pass_filenames: false
args: [.]
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
FROM python:3.12.0b2-slim-buster
FROM python:3.13.14-slim-bookworm
LABEL maintainer="ronmarti18@gmail.com"

RUN pip install poetry
COPY --from=ghcr.io/astral-sh/uv:0.10.11 /uv /uvx /bin/

ENV PYTHONUNBUFFERED=1
ENV PYTHONUNBUFFERED=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy \
UV_PROJECT_ENVIRONMENT=/usr/local

RUN useradd --create-home --user-group app

RUN mkdir /code
WORKDIR /code
COPY . /code/

RUN poetry config virtualenvs.create false
RUN poetry install
COPY pyproject.toml uv.lock /code/
RUN uv sync --frozen --no-dev --no-install-project

COPY --chown=app:app . /code/

USER app
20 changes: 0 additions & 20 deletions Makefile

This file was deleted.

15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ Go to https://chart.ron.sh/ to see this in action.
## Build and run

```bash
docker-compose build
docker-compose up # or "docker-compose up -d" to run in detached mode
docker compose build
docker compose up # or "docker compose up -d" to run in detached mode
```

Open http://127.0.0.1:5000/ in browser

## Development

Dependencies are managed with [uv](https://docs.astral.sh/uv/) and tasks are run with
[Task](https://taskfile.dev/).

```bash
task install
task format
task lint
```

## Author

[Ronie Martinez](mailto:ronmarti18@gmail.com)
Expand Down
28 changes: 28 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '3'

tasks:
install:
desc: Sync the virtual environment from uv.lock
cmds:
- uv sync

format:
desc: Apply lint fixes and format the code
cmds:
- uv run ruff check --fix .
- uv run ruff format .

lint:
desc: Check lint rules, formatting and types
cmds:
- uv run ruff check .
- uv run ruff format --check .
- uv run mypy .

tag:
desc: Create a signed git tag from the project version
cmds:
- |
VERSION=`uv version --short`; \
git tag -s -a $VERSION -m "Release $VERSION"; \
echo "Tagged $VERSION";
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3.8"

services:
web:
build: .
Expand Down
Loading