Skip to main content

Yaffo - Photo Organizer

A Flask-based photo organization tool that uses EXIF metadata, face recognition, and duplicate detection to automatically organize and index photos.

Features

  • Photo Organization: Automatically organize and index photos by date using EXIF metadata
  • Face Detection & Recognition: Detect, group, and tag faces by person using InsightFace (SCRFD detection + ArcFace embeddings, on ONNX Runtime)
  • Duplicate Detection: Find duplicate photos using perceptual hashing
  • EXIF Metadata: Extract and display photo metadata
  • Location Support: Geocoding, reverse-geocoding, and time-correlation geotagging from neighboring photos
  • Auto-Labeling: Offline zero-shot classification (CLIP) tags photos against a user vocabulary
  • Automations: Scheduled and event-driven background behaviors (system-built and AI-generated)
  • AI Page Builder: Build custom pages from AI-generated, sandboxed widgets over your own photo data

Prerequisites

Quick Start

1. Clone and Setup

git clone <repository-url>
cd yaffo

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -e .

2. Install Git Hooks

./hooks/install.sh

This installs pre-commit hooks that prevent accidental commit of API keys and secrets.

3. Configure the Data Directory

YAFFO_DATA_DIR is the root for the app's own state — the SQLite databases (yaffo.db, yaffo-queue.db), generated thumbnails, logs, and temp/trash. It defaults to the OS user-data dir (e.g. ~/Library/Application Support/yaffo on macOS); set it to override:

export YAFFO_DATA_DIR=/path/to/data

Your actual photo (media) directories are configured separately, in the app's Settings page — they aren't a fixed subfolder. The file sync / watcher scans the configured media dirs and indexes what it finds.

4. Run the Application

# Start the Flask web app
flask run

# In a separate terminal, start the background task host (spawn worker pool)
python -m yaffo.taskq.host

# Or launch the whole local stack (Flask + task host + watcher) at once
inv app-local

The app will be available at http://127.0.0.1:5000

Installed App Launcher

For an installed PyPI/pipx copy, use the app launcher instead of the Flask development server:

pipx install yaffo
yaffo setup

yaffo setup can install a per-user desktop/app shortcut, runs database migrations, downloads runtime assets up front, and asks whether to launch the app. Runtime startup still checks migrations and assets, so yaffo remains safe to run directly.

yaffo install-shortcut

The shortcut launches the installed Python entry point directly, so it does not depend on your shell PATH. A yaffo-gui entry point is also installed for platforms that distinguish console and GUI launchers.

Before uninstalling the package, clean up app-managed files:

yaffo uninstall
pipx uninstall yaffo

The uninstall command removes the shortcut, downloaded assets, and logs, then asks before deleting Yaffo user data such as the SQLite databases and config.

Project Structure

yaffo/
├── yaffo/                    # Main application
│   ├── app.py               # Flask app factory
│   ├── common.py            # Configuration and paths
│   ├── db/                  # Database models and repositories
│   ├── routes/              # API endpoints
│   ├── templates/           # Jinja2 templates
│   ├── static/              # CSS, JavaScript
│   ├── utils/               # Utility functions
│   ├── background_tasks/    # Background task definitions
│   ├── taskq/               # SQLite-backed task queue + spawn worker host
│   ├── site_agents/         # AI page builder: agent, model clients, tools, schemas
│   └── scripts/             # CLI tools + db/ (init_db, dev migrations)
├── tests/                   # Python unit tests
├── yaffo_ui_tests/          # Playwright UI tests
├── hooks/                   # Git hooks
├── docs/                    # Design references (taskq, automations, page builder, video)
└── resources/               # UI resources bundled with the app

Development

Running Tests

# Python unit tests
pytest

# UI tests (requires app running)
cd yaffo_ui_tests
npm install
npm test

# UI tests in isolated environment
npm run test:isolated

Database

The app uses SQLite. The database file is stored at {YAFFO_DATA_DIR}/yaffo.db.

To reset the database:

rm /path/to/data/yaffo.db
flask run  # Will recreate on startup

Background Tasks

Background tasks (photo indexing, face detection, etc.) run on a small purpose-built queue (yaffo/taskq): a SQLite-durable queue plus a host process that supervises a pool of spawn-started worker children, so CPU-bound native ML inference (InsightFace/ONNX Runtime) runs in parallel, isolated, and crash-contained. See docs/development/task-queue.md.

# Start the task host with 4 workers, recycling each after 200 tasks
python -m yaffo.taskq.host --workers 4 --recycle 200

# Or via invoke
inv start-tasks --workers=4

Tests drive tasks synchronously by setting task_queue.immediate = True.

UI Testing

The project includes an AI-augmented UI testing framework. See yaffo_ui_tests/README.md for details.

cd yaffo_ui_tests

# Install dependencies
npm install
npx playwright install

# Run tests against running app
npm test

# Run tests in isolated environment (recommended)
npm run test:isolated

Environment Variables

Variable Description Default
YAFFO_DATA_DIR Root for app state (DBs, thumbnails, logs, temp) OS user-data dir (e.g. ~/Library/Application Support/yaffo); inv sets ~/Pictures for dev
FLASK_APP Flask application module yaffo.app:create_app
FLASK_ENV Flask environment development
ANTHROPIC_API_KEY Anthropic API key for the AI Page Builder and AI-generated automations. Optional override — the key is normally stored in the OS keychain (set via Settings); the env var wins when present (headless/CI). (unset; keychain used)

Git Hooks

The project includes pre-commit hooks to prevent accidental commit of secrets:

# Install hooks (run once after cloning)
./hooks/install.sh

The pre-commit hook scans for:

  • Anthropic API keys (sk-ant-...)
  • OpenAI API keys (sk-...)
  • Generic API key patterns

Licenses

Metadata

Release files for yaffo 0.0.24

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaffo 0.0.24
File Size Uploaded
yaffo-0.0.24.tar.gz 2.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaffo 0.0.24
File Interpreter ABI Platform
yaffo-0.0.24-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 MB

Release files / yaffo-0.0.24.tar.gz

Download URL yaffo-0.0.24.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
74cc89d8a1465fd55f76e5f25ed00c0c59367e313acacdca61ee52ecfc435a77
BLAKE2b-256 checksum
How to use checksums
e571d9baa2ed94afd29d7e6c28be31f71ab1d39e403f2568ce948246ba518e2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release files / yaffo-0.0.24-py3-none-any.whl

Download URL yaffo-0.0.24-py3-none-any.whl
Size 2.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
32789c469f2c11cde2351eeec4d956cec975b96ef75afc294e76e7a7815b8227
BLAKE2b-256 checksum
How to use checksums
c647a445627b09305e91306f5f21b5f9b32d5c7b939c1e3e27722f2d3019f685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 21, 2026.

Transparency log

Release history Release notifications | RSS feed

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

This release

0.0.24 This release

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.19

2 release files

0.0.17

2 release files

0.0.15

2 release files

0.0.13

2 release files

0.0.11

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page