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.1.0.tar.gz (24.6 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.1.0-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metaflow_local_service-0.1.0.tar.gz
  • Upload date:
  • Size: 24.6 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.1.0.tar.gz
Algorithm Hash digest
SHA256 edf8512601eb62551589d14d55a7675f16d60506c78225f5d310bf5bf15ed7a0
MD5 933cf68b1c8bb0f391d86fc6902a6471
BLAKE2b-256 1cf9a0d5343a37cfd3d15a68b4b7cafd4a7e9d1fd77a64e6f5f5482e24585d12

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaflow_local_service-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for metaflow_local_service-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9c30f4be8de7fb81026f23c2ba997d17729ad75ba82838bbc66dd9826891b4
MD5 9ee921dcebbb8c685b3e57f19ac47af8
BLAKE2b-256 c57feaf609cfcba25988f97441369482f7b622c2101c776fc2dbbab20b33153b

See more details on using hashes here.

Provenance

The following attestation bundles were made for metaflow_local_service-0.1.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