Skip to main content

Convert Alembic migration history to Mermaid diagrams

Project description

Barmaid Logo

Barmaid 🍸

Visualize your Alembic migrations with style.

FeaturesInstallationUsageLicense


Barmaid is a lightweight, zero-dependency CLI tool that instantly converts your Alembic migration history into clear, meaningful Mermaid flowcharts.

Database migrations can get messy. Branches, merges, and head entanglements are hard to track in your head. Barmaid helps you see the state of your database schema evolution at a glance.

✨ Features

  • 🚀 Zero Dependencies: Built with pure Python standard library. No bloat, no conflicts.
  • 🌳 Complex Topography: Flawlessly handles branches, merges, and multiple heads.
  • 🕵️‍♀️ Health Checks: Automatically detects and visually highlights orphaned revisions (missing parents).
  • 🎨 Highly Customizable:
    • Switch orientations (Top-Down, Left-to-Right, etc.).
    • Output to file or stdout.
  • 📦 Drop-in Ready: Works with any standard Alembic folder structure automatically.

📦 Installation

Install directly from source:

pip install .

Note: Barmaid requires Python 3.10 or higher.

🚀 Usage

Navigate to your project directory and let Barmaid do the rest. It will automatically hunt for your versions directory.

# Generate diagram and print to stdout
barmaid

Common Commands

Save to a file:

barmaid -o schema_evolution.mmd

Change orientation (Left-to-Right):

# Great for long, linear histories
barmaid -d LR

Specify a custom versions directory:

barmaid ./src/alembic/versions

CLI Options

Option Description Default
path Path to versions directory Auto-detected
-o, --output Save output to a file stdout
-d, --direction Graph direction (TD, LR, BT, RL) TD
--no-orphans Hide missing parent nodes True (shown)
-v, --version Show version information -

📊 Visualizing the Output

Barmaid outputs standard Mermaid syntax. You can view the diagrams in:

  1. GitHub / GitLab: Paste the output into any Markdown file (like a PR description or Wiki).
  2. Mermaid Live Editor: Copy-paste for an instant interactive preview.
  3. VS Code: Use the Mermaid Preview extension.

Example Output

graph TD
    a1b2c3d4["init_schema<br/>Create user table"]
    e5f6g7h8["add_email_column<br/>Add email to users"]
    i9j0k1l2["create_posts<br/>Add posts table"]
    
    a1b2c3d4 --> e5f6g7h8
    e5f6g7h8 --> i9j0k1l2
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px

🤝 Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.

📄 License

This project is licensed under the MIT License.

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

barmaid-0.0.1.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

barmaid-0.0.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file barmaid-0.0.1.tar.gz.

File metadata

  • Download URL: barmaid-0.0.1.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for barmaid-0.0.1.tar.gz
Algorithm Hash digest
SHA256 91c6c18fe5a996bb51bb855e7a975b5954c0a821301397061adcc7236e90dfbc
MD5 3a3d437df584f1ca976a56f63d23f65e
BLAKE2b-256 6c323f2ef87a0742b4a606f4edcba4bb0186c45e519de28721fedef1173f3c07

See more details on using hashes here.

File details

Details for the file barmaid-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: barmaid-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.2

File hashes

Hashes for barmaid-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9f37cf0ee1481b4013ce459c58d203fc1d10a14e2b80dc139da4b57bd90393c
MD5 4d500a19b5aaf81886c8f6f13f09ac6e
BLAKE2b-256 723ee52cacc738424cfe73fee08b394d03fb68270618db71a68448141c8c6322

See more details on using hashes here.

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