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
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.3
with:
version: "0.4.24"
version: "0.13.7"
enable-cache: true

- name: pre-commit cache key
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV

- uses: actions/cache@v4
- uses: actions/cache@v6
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
Expand All @@ -45,10 +45,10 @@ jobs:
needs: [ lint ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v3
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v10.3.3
with:
version: "0.4.24"
version: "0.13.7"
enable-cache: true

- name: Set up Python
Expand All @@ -74,7 +74,7 @@ jobs:
needs: [ lint, unit_test ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Build docker image
run: |
docker pull $IMAGE_NAME
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Extract Tag Name
id: extract_tag
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"

- name: Build docker image with tag
run: |
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -16,9 +16,9 @@ repos:
exclude: ^.*.md$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.0
rev: v0.17.4
hooks:
- id: ruff
- id: ruff-check
args: [--fix]
- id: ruff-format

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM python:3.12-alpine3.20
FROM python:3.13-alpine3.24

ENV PYTHONUNBUFFERED=yes \
PYTHONDONTWRITEBYTECODE=yes \
UV_LINK_MODE=copy

WORKDIR /src

RUN --mount=from=ghcr.io/astral-sh/uv:0.4.24,source=/uv,target=/bin/uv \
RUN --mount=from=ghcr.io/astral-sh/uv:0.13.7,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
Expand Down
4 changes: 3 additions & 1 deletion dev-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
db:
image: postgres:14.1-alpine
image: postgres:14-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
Expand All @@ -20,6 +20,8 @@ services:
- db
- cache
build: .
environment:
- DJANGO_DEBUG=1
env_file: ./.env
ports:
- "8000:8000"
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
db:
image: postgres:14.1-alpine
image: postgres:14-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust
volumes:
Expand All @@ -17,7 +17,7 @@ services:
- cache
image: unitystation/central-command:latest
environment:
- DEBUG=0
- DJANGO_DEBUG=0
env_file: ./.env
expose:
- 8000
Expand Down
4 changes: 3 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# used for salting
SECRET_KEY=MYSECRET
# django debug mode which prints python traceback in response and more
DEBUG=1
DJANGO_DEBUG=1
# defaults to * when DJANGO_DEBUG is on, localhost only when off
DJANGO_ALLOWED_HOSTS=

EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
Expand Down
30 changes: 16 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[project]
name = "central-command"
version = "0.1.0"
requires-python = "==3.12.*"
requires-python = "==3.13.*"

dependencies = [
"Django~=5.2.0",
"django-post-office~=3.10.0",
"djangorestframework~=3.16.0",
"django-rest-knox~=5.0.0",
"drf-spectacular~=0.29.0",
"django-post-office~=3.12",
"djangorestframework~=3.18",
"django-rest-knox~=5.1",
"drf-spectacular~=0.30.0",
"gunicorn~=23.0.0",
"psycopg2-binary~=2.9.10",
"psycopg2-binary~=2.9.13",
"python-dotenv~=1.0",
"whitenoise~=6.11.0",
"whitenoise~=6.12",
"pymemcache>=4.0,<5.0",
]

Expand All @@ -23,14 +23,14 @@ build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
packages = ["src/central_command"]

[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"aiosmtpd~=1.4.5",
"pre-commit~=4.4",
"ruff~=0.14.0",
"mypy>=1.18.0",
"django-stubs[compatible-mypy]==5.2.7",
"djangorestframework-stubs[compatible-mypy]==3.16.5",
"pre-commit~=4.7",
"ruff~=0.17.0",
"mypy>=1.18.0,<2",
"django-stubs[compatible-mypy]~=5.2.7",
"djangorestframework-stubs[compatible-mypy]>=3.16.5",
]

[tool.ruff]
Expand All @@ -42,6 +42,8 @@ ignore = [
# doesn't like Optional
# https://github.com/charliermarsh/ruff/issues/4858
"UP007",
# same as UP007, split into its own code in newer ruff
"UP045",
# explicit raise from might be a bit too verbose, disable for now
"B904",
# asserts are useful in both tests and type checker persuasion
Expand Down
3 changes: 1 addition & 2 deletions src/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ class Account(AbstractUser):
unique=False,
validators=[MinLengthValidator(3), UnicodeUsernameValidator()],
help_text=(
"Public username is used to identify your account publicly and shows in "
"OOC. This can be changed at any time"
"Public username is used to identify your account publicly and shows in OOC. This can be changed at any time"
),
)

Expand Down
13 changes: 11 additions & 2 deletions src/central_command/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
SECRET_KEY = os.environ.get("SECRET_KEY", "foo")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = bool(os.environ.get("DJANGO_DEBUG", default="1"))
DEBUG = os.environ.get("DJANGO_DEBUG", "0").strip().lower() in {"1", "true", "yes", "on"}

ALLOWED_HOSTS = ["*"] if DEBUG else ["localhost", "127.0.0.1"]
_allowed_hosts = os.environ.get("DJANGO_ALLOWED_HOSTS", "")
ALLOWED_HOSTS = [host.strip() for host in _allowed_hosts.split(",") if host.strip()] or (
["*"] if DEBUG else ["localhost", "127.0.0.1"]
)

_csrf_origins = os.environ.get("CSRF_TRUSTED_ORIGINS", "")
CSRF_TRUSTED_ORIGINS = [origin.strip() for origin in _csrf_origins.split(",") if origin.strip()]
Expand Down Expand Up @@ -131,6 +134,12 @@
"level": "WARNING",
"propagate": False,
},
# template variable lookup failures are logged at DEBUG with full tracebacks (very noisy)
"django.template": {
"handlers": ["console"],
"level": "INFO",
"propagate": False,
},
"accounts": {
"handlers": ["console"],
"level": "DEBUG",
Expand Down
3 changes: 1 addition & 2 deletions src/persistence/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ class Character(models.Model):

fork_compatibility = models.CharField(
max_length=25,
help_text='What fork is this character compatible with? This is a simple string, like "Unitystation" or '
'"tg".',
help_text='What fork is this character compatible with? This is a simple string, like "Unitystation" or "tg".',
default="Unitystation",
)

Expand Down
52 changes: 0 additions & 52 deletions sweep.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion test-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"

services:
db:
image: postgres
image: postgres:14-alpine
environment:
POSTGRES_HOST_AUTH_METHOD: trust

Expand Down
Loading
Loading