Open Source · 7 min read

bt-flow: Deploying ML Models to Production in One Line

Python · FastAPI · MLOps · Open Source

I want to tell an MLOps story that every data scientist knows deep down but nobody says out loud. You train a model, you write hundreds of lines of validation code, you compare metrics for hours, you squeeze that last 0.01 of accuracy. Then you need to take the model to production. And suddenly a month passes. API design, dependency hell, serialization problems, Docker, deployment. Weeks go by handling matters that have absolutely nothing to do with the model itself.

This is exactly the problem bt-flow was designed to solve. Think about this one-line magic: bt_flow.serve(model). That's it. A trained scikit-learn model becomes a production-ready FastAPI service in one line. Automatic endpoints, feature validation, type checking, Swagger documentation, health checks — all handled.

The main motivation behind bt-flow was my own pain. In my research projects at university I trained dozens of models, but demo-ing any of them properly to friends or academics always became a saga. Writing a REST API shouldn't become a research project. If a model works, serving it should be just as easy.

Technical details: bt-flow reads scikit-learn models' metadata (input shapes, feature names, output types) and dynamically builds Pydantic models. This means it provides type safety to users at the API level. There's no need to write any manual validation code.

The project is live on PyPI, MIT licensed. If you're a data scientist or ML engineer, I invite you to try it. If you run into bugs, opening an issue on GitHub would make me happy :)

External link

View on PyPI

https://pypi.org/project/bt-flow/