letteka c4d2516ea5
CI / black (push) Failing after 9m17s
CI / ruff (push) Successful in 11m43s
CI / mypy (push) Successful in 10m48s
CI / pytest (push) Failing after 12m7s
Dependency update / dependency-update (push) Successful in 9m30s
chore: dependency updates 2026-05-25 (#31)
## Dependency update summary

Generated: 2026-05-25 09:01 UTC

### Vulnerability scan

No vulnerabilities found.

### Outdated packages

The following packages were updated:

Was: version = "26.5.0"
Updated: version = "26.5.1"
Was: version = "2026.4.22"
Updated: version = "2026.5.20"
Was: version = "8.4.0"
Updated: version = "8.4.1"
Was: version = "3.5.0"
Updated: version = "3.5.1"
Was: version = "3.15"
Updated: version = "3.16"
Was: python-versions = ">=3.8"
Updated: python-versions = ">=3.9"
Was: version = "2.4.5"
Updated: version = "2.4.6"
Was: version = "3.4.11"
Updated: version = "3.4.12"
Was: version = "2.0.49"
Updated: version = "2.0.50"
---------

Co-authored-by: Gitea CI <ci@gitea.com>
Reviewed-on: #31
2026-05-25 15:09:15 -07:00
2026-03-26 16:18:48 -07:00
2026-05-24 14:54:38 -07:00
2026-05-24 14:54:38 -07:00
2026-05-16 09:33:40 -07:00
2026-03-18 13:53:37 -07:00
2026-05-16 17:06:49 -07:00
2026-05-16 16:45:18 -07:00
2026-03-16 16:14:36 -07:00

BirdCam: A Flask-Based Camera Monitoring System

A lightweight, Python-based system for monitoring and managing Raspberry Pi cameras using Flask, SQLAlchemy, and modern Python best practices.

🚀 Overview

BirdCam is a simple yet robust application designed to monitor camera status and log events in real time. Built with Flask and SQLAlchemy, it provides:

  • Real-time camera status tracking (running state).
  • Event logging for camera actions (start, stop) with IP addresses and timestamps.
  • A clean, maintainable architecture using modern Python 3.12 features and type hints.

It's ideal for hobbyists, developers, or IoT projects where you need to track camera activity from a central dashboard or script.

🔧 Key Features

  • Real-time camera status (e.g., whether a camera is running or not).
  • Event logging with full metadata (action, IP address, timestamp).
  • Automatic creation of status records if missing.
  • Type-safe, well-documented code with full type hints.
  • Modern Python practices:
    • Uses Python 3.12 with __future__.annotations.
    • Leverages dataclasses-like patterns with Mapped and mapped_column.
    • Includes comprehensive linting via Black, Ruff, and Mypy.
  • Automated test coverage with pytest and pytest-cov.

📦 Dependencies

Package Version Purpose
Flask ^3.0 Web framework for serving the app
Flask-SQLAlchemy ^3.1.1 ORM for database interactions
Pillow ^12.1.1 Image processing (for camera previews)
Gunicorn ^25.1.0 Production WSGI server
Pytest ^9.0.3 Testing framework
Pytest-Cov ^7.1.0 Test coverage reporting
Black / Ruff ^26.0 / ^0.4 Code formatting and linting
Mypy ^1.10 Static type checking

All dependencies are pinned for stability and compatibility.

🛠️ Setup & Installation

  1. Clone the repository:

    git clone https://gitea.letteka.com/letteka/birdcam.git
    cd birdcam
    
  2. Install dependencies:

    pip install -e .
    
  3. Run the app:

    gunicorn -w 1 -b 0.0.0.0:5000 app:app
    

    Or use Flasks built-in dev server:

    flask run
    

📝 How It Works

Camera Status

  • The CameraStatus model tracks a single cameras running state.
  • On startup, it ensures a status record exists (ID = 1).
  • The get() and set_running() methods allow safe access and updates.

Camera Events

  • Every time a camera action occurs (start or stop), an event is logged.
  • Events include:
    • Action type (start / stop)
    • Client IP address
    • Timestamp with timezone support
  • The recent() method allows retrieval of the latest events (e.g., for logging or dashboard display).

🧪 Testing

The project includes full test coverage using pytest with coverage reporting:

pytest --cov=src --cov-report=term-missing

Tests are located in the tests/ directory and cover:

  • Status retrieval and updates.
  • Event logging and retrieval.
  • Edge cases (e.g., missing status records).

📝 Development Workflow

Code is formatted with Black and linted with Ruff.
Static type checking is enforced using Mypy.
All code uses consistent naming and formatting.
All public APIs are documented with docstrings.

⚙️ Future Improvements

  • Add support for multiple cameras.
  • Integrate with a web dashboard (e.g., using Vue.js or Streamlit).
  • Add camera preview functionality via HTTP endpoints.
  • Support for MQTT or other event-driven systems.
  • Add user authentication or role-based access.

📚 License

This project is open-source and available under the MIT License.

🙌 Contributing

Contributions are welcome! Please open an issue or submit a pull request with clear descriptions and tests. 📬 Contact: Andrew Kettel andrew.kettel@gmail.com

S
Description
No description provided
Readme 1.8 MiB
Languages
Python 55.8%
HTML 29.2%
Shell 15%