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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ logs/
found_solutions/*.json
processed_solutions/*

.cache
cases/*/
!cases/case_catalog.md

Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
exclude: ^legacy/

repos:
- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.7.2
Expand Down
8 changes: 0 additions & 8 deletions .vscode/settings.json

This file was deleted.

7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim-bookworm
FROM python:3.12-slim-bookworm AS base

ENV PYTHONUNBUFFERED=1 \
UV_COMPILE_BYTECODE=1 \
Expand Down Expand Up @@ -34,12 +34,9 @@ WORKDIR /app
COPY pyproject.toml uv.lock README.md ./
COPY src ./src

RUN mkdir -p cases found_solutions

RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --locked

EXPOSE 8000

# Bind to 0.0.0.0 so the API is reachable from outside the container.
CMD ["uv", "run", "--no-sync", "uvicorn", "src.api.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
CMD ["fastapi", "run", "src/scheduling/api/app.py", "--host", "0.0.0.0", "--port", "8000"]
44 changes: 26 additions & 18 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
APP_NAME := "staff-scheduling-api"
IMAGE_NAME := "staff-scheduling-api"
PORT := "8000"

# Shared Docker args for dev commands
DOCKER_DEV_ARGS := "-p " + PORT + ":8000 --env-file .env -v $PWD:/app -v staff-scheduling-venv:/app/.venv -v staff-scheduling-uv-cache:/root/.cache/uv"
DOCKER_DEV_ARGS := "--env-file .env -v $PWD/src:/app/src" + " -p " + PORT + ":8000"

_default:
just --list

sync:
uv sync
uv sync --all-extras

test:
uv run pytest
lint *args:
uv run ruff check . {{args}}

lint:
uv run ruff check .
format *args:
uv run ruff format . {{args}}

format:
uv run ruff format .
typecheck *args:
uv run pyright . {{args}}

typecheck:
uv run pyright .
test *args:
uv run pytest {{args}}

check: lint typecheck test

build:
docker build -t {{IMAGE_NAME}} .

# App CLI wrapper:
cli *args:
run:
docker run --rm -it \
{{DOCKER_DEV_ARGS}} \
{{IMAGE_NAME}} \
uv run staff-scheduling {{args}}
uv run \
fastapi dev \
src/scheduling/api/app.py \
--host 0.0.0.0 --port 8000

dev:
debug:
docker run --rm -it \
{{DOCKER_DEV_ARGS}} \
-p 5678:5678 \
{{IMAGE_NAME}} \
uv run uvicorn src.api.main:app --host 0.0.0.0 --port 8000 --reload
uv run \
python -m debugpy \
--listen 0.0.0.0:5678 \
--wait-for-client \
-m fastapi dev \
src/scheduling/api/app.py \
--host 0.0.0.0 --port 8000

docker-shell:
docker run --rm -it \
{{DOCKER_DEV_ARGS}} \
{{IMAGE_NAME}} \
bash

status:
curl http://localhost:{{PORT}}/status
health:
curl http://localhost:{{PORT}}/health
3 changes: 3 additions & 0 deletions legacy/cases/68/11_2024/free_shifts_and_vacation_days.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"employees": []
}
47 changes: 47 additions & 0 deletions legacy/cases/68/11_2024/shift_information.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[
{
"break_duration": 0.0,
"end_time": "2000-01-01T14:00:00",
"shift_duration": 360.0,
"shift_id": "1406",
"shift_name": "Z60",
"start_time": "2000-01-01T08:00:00",
"working_minutes": 360.0
},
{
"break_duration": 30.0,
"end_time": "2000-01-01T16:10:00",
"shift_duration": 490.0,
"shift_id": "2906",
"shift_name": "T75_",
"start_time": "2000-01-01T08:00:00",
"working_minutes": 460.0
},
{
"break_duration": 30.0,
"end_time": "2000-01-01T14:10:00",
"shift_duration": 490.0,
"shift_id": "2939",
"shift_name": "F2_",
"start_time": "2000-01-01T06:00:00",
"working_minutes": 460.0
},
{
"break_duration": 30.0,
"end_time": "2000-01-01T21:00:00",
"shift_duration": 490.0,
"shift_id": "2947",
"shift_name": "S2_",
"start_time": "2000-01-01T12:50:00",
"working_minutes": 460.0
},
{
"break_duration": 45.0,
"end_time": "2000-01-02T06:30:00",
"shift_duration": 610.0,
"shift_id": "2953",
"shift_name": "N2_",
"start_time": "2000-01-01T20:20:00",
"working_minutes": 565.0
}
]
Loading
Loading