Skip to main content

A lightweight, zero-setup Metaflow metadata service that persists to .metaflow/ — starts on demand, stops after idle

Project description

metaflow-local-service

CI PyPI License: Apache-2.0 Python 3.9+

Track your Metaflow runs locally without setting up a database.

The problem

When you want Metaflow's service metadata — run tracking, artifact indexing, heartbeats, tag mutation — you need a running metaflow-service backed by PostgreSQL. That's fine for production, but for local development, sandboxes, or CI you're forced to choose between local mode (no HTTP API, no resume across machines) and a heavyweight Postgres deployment. There's no middle ground.

Quick start

pip install metaflow-local-service

# Start the service and run your flow in one command
metaflow-local-service run python myflow.py run

The daemon starts automatically, sets METAFLOW_SERVICE_URL and METAFLOW_DEFAULT_METADATA=service for your flow, and shuts down after 5 minutes of idle time. Data is written to .metaflow/ in the current directory — the same format as local mode.

Install

pip install metaflow-local-service

Requires Python 3.9+ and Metaflow 2.12+.

Usage

Wrap a flow command

metaflow-local-service run python myflow.py run --max-workers 4

The daemon starts if it isn't already running, then runs your command with the service URL in the environment.

Manage the daemon manually

metaflow-local-service start               # start in background
metaflow-local-service status              # show PID, port, and URL
metaflow-local-service url                 # print just the URL, for scripting
metaflow-local-service stop                # send SIGTERM

Scripting

export METAFLOW_SERVICE_URL=$(metaflow-local-service url)
export METAFLOW_DEFAULT_METADATA=service
python myflow.py run

How it works

The daemon wraps Metaflow's own LocalMetadataProvider behind the standard service HTTP API (v2.5.0). Data is written directly to .metaflow/ on every request — no sync step, no separate database. On resume, task IDs are seeded from existing files on disk so new tasks never collide with previous ones.

See docs/architecture.md for the full layer diagram.

Configuration

Environment variable Default Description
METAFLOW_LOCAL_SERVICE_PORT 0 (random) Port to bind
METAFLOW_LOCAL_SERVICE_IDLE_TIMEOUT 300 Seconds of heartbeat silence before shutdown
METAFLOW_LOCAL_SERVICE_DEBUG "" Set to 1 to enable daemon logging

See docs/configuration.md for the full reference.

Development

git clone https://github.com/npow/metaflow-local-service.git
cd metaflow-local-service
pip install -e ".[dev]"
pytest

Structural tests (AST-based layer boundary enforcement) run without metaflow installed:

pytest -m structural

License

Apache 2.0

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

metaflow_local_service-0.2.0.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

metaflow_local_service-0.2.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for metaflow_local_service-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a6cbc221085b38ee2fc7dda4ff2bd3ec0e99ea3759ffc7e3fedc1404f7eedfea
MD5 ef4e0b1fa980fb97f7be1530f7fb78a7
BLAKE2b-256 6c5a01769b195b566497234c7cdb91d9a459ccbb588ebcfc5268392e7ef05bce

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on npow/metaflow-local-service

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

File details

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

File metadata

File hashes

Hashes for metaflow_local_service-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 078913af6f5231e11c5928e18bae1c29ab8c02c3c68b2bef55223de5b42eecec
MD5 20a589d789903f4196bf32579db52ad0
BLAKE2b-256 83554056db7f98cc6813fbd17fcaa97a39fc97b2c2574daa4c9d3f6f71a694c9

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on npow/metaflow-local-service

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