chore: run the app from a venv and read configuration from a dotenv #95

Merged
domverse merged 1 commits from chore/local-run-and-env-file into main 2026-08-17 23:44:55 +02:00
Owner

Running the application depended on the work-item helper's launcher, which falls back to a dependency-free system interpreter when conda is a shell function. The app now installs into an ordinary virtualenv.

That exposed two packaging faults: Pillow/numpy/scipy were declared test-only although the application imports them at runtime, and pip install -e . failed because setuptools could not choose between the top-level directories. Both fixed; the OpenAI client moved to a vision extra.

Config.from_env now reads .env (or PHOTO_PIPELINE_ENV_FILE) before the environment — parsed, never executed, and always losing to an already-exported variable. The archived CLI's variable names are mapped, so an existing photo_analyzer.env configures the app unchanged.

Tests: tests/unit/test_env_file.py (5), full suite 950 passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SH4M1PHPwJsM9btcg8hzCs

Running the application depended on the work-item helper's launcher, which falls back to a dependency-free system interpreter when conda is a shell function. The app now installs into an ordinary virtualenv. That exposed two packaging faults: Pillow/numpy/scipy were declared test-only although the application imports them at runtime, and `pip install -e .` failed because setuptools could not choose between the top-level directories. Both fixed; the OpenAI client moved to a `vision` extra. `Config.from_env` now reads `.env` (or `PHOTO_PIPELINE_ENV_FILE`) before the environment — parsed, never executed, and always losing to an already-exported variable. The archived CLI's variable names are mapped, so an existing `photo_analyzer.env` configures the app unchanged. Tests: `tests/unit/test_env_file.py` (5), full suite 950 passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SH4M1PHPwJsM9btcg8hzCs
domverse added 1 commit 2026-08-17 23:43:58 +02:00
Running the application depended on work_item/scripts/python, which is the
work-item helper's launcher: it probes for conda with `command -v`, cannot see a
lazily-defined shell function, and falls back to a bare system interpreter with
none of the dependencies installed. The application now installs into an ordinary
virtualenv instead.

That exposed two packaging faults. Pillow, numpy, and scipy were declared
test-only although the application imports them at runtime — thumbnails decode
through Pillow and the perceptual hash is a DCT over decoded pixels — and an
editable install failed outright because setuptools could not choose between
photo_pipeline, migrations, and work_item. Both are fixed here, and the OpenAI
client moves to a `vision` extra so a review-only install does not pull an API
client it never calls.

Config.from_env now reads `.env`, or the file named by PHOTO_PIPELINE_ENV_FILE,
before it looks at the environment. The file is parsed, never executed: KEY=value
lines, comments, optional quotes, no interpolation and no export. Anything already
exported wins, so the file is standing configuration and the shell stays the
override for one run. The archived CLI's names are mapped as aliases
(LLM_API_KEY/GEMINI_API_KEY, LLM_BASE_URL, LIBRARY), so an existing
photo_analyzer.env configures the application unchanged.

.env, *.env, .venv/, and *.egg-info/ are ignored: the real configuration file
holds a live provider key and must never be committed.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SH4M1PHPwJsM9btcg8hzCs
domverse merged commit ded83178bd into main 2026-08-17 23:44:55 +02:00
Sign in to join this conversation.