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.2.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.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: barmaid-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 61e45b40b2c6657b5e3558a7284d92759899f059521f810bc2fadc85bcbf7e3d
MD5 f062798999095ca1fe86a8849aab0e32
BLAKE2b-256 370a924a1a159540b01ea14be672ec14421a13306cce5e5ce63faaab4aeca043

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for barmaid-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04e8090a9a7d287d3f46da36c22f821f044ac6fbb84ad3b2b9db3a2b64b994b7
MD5 6a2e15beddc4156f7e306eb63af9986f
BLAKE2b-256 0519e373fb87f12a29072a795c11147910850a1a7ffa3b3574d2c4aff067faab

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