Skip to main content

Python client for the Timing macOS app SQLite database

Project description

timingapp-python

Python client for the Timing macOS app SQLite database.

Provides read-only access to Timing's SQLite database (~/Library/Application Support/info.eurocomp.Timing2/SQLite.db) via SQLAlchemy 2.x ORM.

Credit: This is a Python port of timingapp-ruby by @marcoroth. The Ruby gem provides the same read-only database access via ActiveRecord; this library reimplements it idiomatically in Python using SQLAlchemy 2.x.

Note: This library was mostly generated by Claude Sonnet 4.6.

Requirements

  • Python 3.12+
  • SQLAlchemy 2.0+
  • macOS with Timing app installed (for real usage)

Installation

pip install timingapp

Usage

from timingapp import open_database, AppActivity, Project, TaskActivity
from sqlalchemy import select

# Open the default Timing database (read-only)
db = open_database()

with db.session() as sess:
    # Query all projects
    projects = sess.scalars(select(Project)).all()
    for p in projects:
        print(p.title)

    # Get archived projects
    archived = sess.scalars(Project.archived()).all()

    # Get running task activities
    running = sess.scalars(TaskActivity.running()).all()

    # Get deleted app activities
    deleted = sess.scalars(AppActivity.deleted()).all()

    # Access relationships
    activity = sess.get(AppActivity, 1)
    if activity:
        print(activity.application.name)
        print(activity.project.title)
        print(activity.startDate)  # UTC datetime

Models

Model Table Notes
AppActivity AppActivity Scopes: deleted()
AppActivityWithStrings AppActivityWithStrings SQLite VIEW
Application Application
Device Device PK: localID
Event Event
EventSource EventSource Scopes: templates(), favorites()
EventSourceTaskActivity EventSourceTaskActivity Scopes: deleted()
Filter Filter Scopes: samples(), self-referential
Integration Integration
IntegrationLogResult integration_log_result
IntegrationProject IntegrationProject
Path Path
Project Project Scopes: archived(), self-referential
TaskActivity TaskActivity Scopes: running(), deleted()
Title Title

Export Script

The timing-export CLI script exports app activity for a given day as newline-delimited JSON (one JSON object per line) to stdout.

# Export today's activity
timing-export

# Export a specific date
timing-export 2026-03-15

Each line is a JSON object with the following fields:

Field Type Description
startDate ISO 8601 string or null Activity start time (UTC)
endDate ISO 8601 string or null Activity end time (UTC)
appName string or null Application name
windowTitle string or null Window/document title
path string or null File path of the active document
device string or null Device display name

Example output:

{"startDate": "2026-03-15T09:00:00+00:00", "endDate": "2026-03-15T09:12:34+00:00", "appName": "Code", "windowTitle": "README.md — timingapp-python", "path": "/Users/steven/tmp/timing/timingapp-python/README.md", "device": "My Mac"}
{"startDate": "2026-03-15T09:12:35+00:00", "endDate": "2026-03-15T09:45:00+00:00", "appName": "Safari", "windowTitle": "SQLAlchemy 2.0 Documentation", "path": null, "device": "My Mac"}

Development

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest

# Type check
uv run mypy src/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timingapp-0.2.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timingapp-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file timingapp-0.2.0.tar.gz.

File metadata

  • Download URL: timingapp-0.2.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timingapp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3eeb478c24ffd6125cc24941d11d3c6eb6976d6e026cb9cb6b02a8a528ed18c1
MD5 ad18eeb1deb7066155dc5f55188b1704
BLAKE2b-256 8850d709cc539299f39fe887815175226b39c75308dc39f519f225e3f7cacca6

See more details on using hashes here.

Provenance

The following attestation bundles were made for timingapp-0.2.0.tar.gz:

Publisher: publish.yml on SConaway/timingapp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file timingapp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: timingapp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timingapp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a475dd0e81b41a68b9542cd870c23bddac61ae08a1a199a91a1980de611cf669
MD5 d99d5af0d4978d0a95e7528cb5d75421
BLAKE2b-256 c355fa684801671fd444256ba7f198b7805924dafe9c2285ef55998f867cd5b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for timingapp-0.2.0-py3-none-any.whl:

Publisher: publish.yml on SConaway/timingapp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page