Commit ·
0346048
1
Parent(s): c3a86a2
makefile, pre-commit config, .env.example
Browse filestired of typing the uvicorn invocation. also ignore venv/ properly so it stops showing up in git status.
- .env.example +11 -0
- .gitignore +3 -0
- .pre-commit-config.yaml +15 -0
- Makefile +45 -0
.env.example
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LLM agent (inference.py) — required
|
| 2 |
+
API_BASE_URL=https://api.openai.com/v1
|
| 3 |
+
MODEL_NAME=gpt-4o-mini
|
| 4 |
+
HF_TOKEN=sk-replace-me
|
| 5 |
+
|
| 6 |
+
# Environment URL the agent talks to (optional, defaults to localhost:7860)
|
| 7 |
+
ENV_URL=http://localhost:7860
|
| 8 |
+
|
| 9 |
+
# Logging (used by observability.py)
|
| 10 |
+
LOG_LEVEL=INFO
|
| 11 |
+
LOG_FORMAT=plain # plain | json
|
.gitignore
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
.venv
|
|
|
|
| 2 |
__pycache__/
|
|
|
|
|
|
|
|
|
| 1 |
.venv
|
| 2 |
+
venv
|
| 3 |
__pycache__/
|
| 4 |
+
.pytest_cache/
|
| 5 |
+
.ruff_cache/
|
.pre-commit-config.yaml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repos:
|
| 2 |
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
| 3 |
+
rev: v0.6.9
|
| 4 |
+
hooks:
|
| 5 |
+
- id: ruff
|
| 6 |
+
args: [--fix]
|
| 7 |
+
- id: ruff-format
|
| 8 |
+
|
| 9 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
| 10 |
+
rev: v5.0.0
|
| 11 |
+
hooks:
|
| 12 |
+
- id: trailing-whitespace
|
| 13 |
+
- id: end-of-file-fixer
|
| 14 |
+
- id: check-yaml
|
| 15 |
+
- id: check-added-large-files
|
Makefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
PY ?= python
|
| 2 |
+
VENV ?= venv
|
| 3 |
+
BIN := $(VENV)/bin
|
| 4 |
+
|
| 5 |
+
.PHONY: help venv install test lint format run docker clean
|
| 6 |
+
|
| 7 |
+
help:
|
| 8 |
+
@echo "Targets:"
|
| 9 |
+
@echo " venv - create local virtualenv at ./$(VENV)"
|
| 10 |
+
@echo " install - install runtime + dev dependencies"
|
| 11 |
+
@echo " test - run pytest suite"
|
| 12 |
+
@echo " lint - run ruff (lint only, no fixes)"
|
| 13 |
+
@echo " format - run ruff format"
|
| 14 |
+
@echo " run - start the FastAPI environment on :7860"
|
| 15 |
+
@echo " docker - build the docker image"
|
| 16 |
+
@echo " inspect - dump current env state as JSON"
|
| 17 |
+
@echo " clean - remove caches"
|
| 18 |
+
|
| 19 |
+
venv:
|
| 20 |
+
$(PY) -m venv $(VENV)
|
| 21 |
+
|
| 22 |
+
install:
|
| 23 |
+
$(BIN)/pip install -r requirements.txt
|
| 24 |
+
$(BIN)/pip install pytest ruff
|
| 25 |
+
|
| 26 |
+
test:
|
| 27 |
+
$(BIN)/python -m pytest tests/ -q
|
| 28 |
+
|
| 29 |
+
lint:
|
| 30 |
+
$(BIN)/ruff check .
|
| 31 |
+
|
| 32 |
+
format:
|
| 33 |
+
$(BIN)/ruff format .
|
| 34 |
+
|
| 35 |
+
run:
|
| 36 |
+
$(BIN)/uvicorn environment:app --host 0.0.0.0 --port 7860 --reload
|
| 37 |
+
|
| 38 |
+
docker:
|
| 39 |
+
docker build -t adaptive-traffic-controller .
|
| 40 |
+
|
| 41 |
+
inspect:
|
| 42 |
+
$(BIN)/python inspect_env.py
|
| 43 |
+
|
| 44 |
+
clean:
|
| 45 |
+
rm -rf .pytest_cache __pycache__ */__pycache__ .ruff_cache
|