Cleanup/code quality #1

Merged
froxxxy merged 9 commits from cleanup/code-quality into main 2026-07-18 17:26:22 +02:00

9 Commits

Author SHA1 Message Date
Frank Schwenk fd024d31e9 docs: update README and add ARCHITECTURE
CI / lint-and-test (pull_request) Successful in 2m3s
Dev setup (venv, ruff, pytest), config table entries, architecture
overview, and cleanup completion report.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:12:26 +02:00
Frank Schwenk c29186a227 test: add characterization tests for core modules
33 tests covering env/io helpers, config parsers, pipeline meta I/O,
worker inbox logic, and FastAPI smoke routes. No gmic/rembg subprocesses.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:12:09 +02:00
Frank Schwenk 1cf4ea0f07 refactor: named preprocess timeout and single meta read
Add PREPROCESS_TIMEOUT config (default 120s). Expose read_meta() and use
one read per job in list_jobs() instead of read_status + read_manifest.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:11:29 +02:00
Frank Schwenk 86989c1a4c chore: deduplicate compose environment blocks
Use YAML anchor x-app-env for the shared worker/web environment vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:11:28 +02:00
Frank Schwenk 5a3118f590 refactor: share env-bool parsing and logging setup
env_utils.env_bool replaces duplicated truthy parsing in config and
rembg_cli. logging_config.configure_logging unifies entry-point setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:11:28 +02:00
Frank Schwenk b63a796907 refactor: extract atomic JSON helpers to io_utils
Centralize read_json/write_json_atomic used by pipeline meta I/O and
worker processed.json bookkeeping. Preserves corrupt-file warning in
load_processed().

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:11:26 +02:00
Frank Schwenk 0963297815 style: apply ruff format and extend gitignore
Ruff auto-fixes import order and line wrapping. Gitignore covers
build artifacts and coverage output from future test runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:10:33 +02:00
Frank Schwenk e9f494ed9d chore: add pyproject.toml with ruff and pytest config
Pin Python 3.11 for parity with the Docker image. Dev deps live in
requirements-dev.txt for local lint/test without rembg/onnxruntime.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:10:31 +02:00
Frank Schwenk 90094cf8f8 docs: add cleanup plan from phase-0 analysis
Phase 0 inventory: ~7 Python modules, no tests/CI/lint, pipeline.py
concentration. Roadmap for incremental cleanup without behavior changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-18 17:09:53 +02:00