Show HN: Python CLI for Compiling Jupyter Notebooks into FastAPI Apps (docs.neutrinolabs.dev)
I recently built Neutrino Notebooks, an open source python library for compiling Jupyter notebooks into FastAPI apps.
I work with notebooks a ton and typically find myself refactoring notebook code into a backend or some other python script. So, I made this to streamline that process.
In short, it lets you:
- Expose cells as HTTP or websockets endpoints with comment declaratives like `@HTTP` and `@WS`
- Periodically run cells as scheduled tasks for simple data pipelines with `@SCHEDULE`
- Automatic routing based on filename and directory structure, sort of similar to NextJs.
- Ignore sandbox files by naming them ‘_sandbox’
You can compile your notebooks, which creates a /build folder with a dockerized FastAPI app for local testing or deployment.
GitHub repo: https://github.com/neutrino-ai/neutrino-notebooks
Excited for feedback from the HN community
4 comments
[ 3.4 ms ] story [ 57.9 ms ] threadWould this be something that can be moved to production as well?
Have you considered combining this idea with LLMs and templated prompts?
I'd also encourage you to focus your efforts on creating a smooth experience for "deploying" the resultant application to arbitrary platforms e.g. Fly.io, Render, Google Cloud Run, etc. (I would suggest Cloudflare Workers as well, but as far as I know that's not a platform that supports Python. So maybe it's also worth thinking about how to adopt the same idea to TypeScript.)
I wrote an example on how you can use it to create a simple pipeline to scrape wikipedia's daily featured article, chunk it, and store it in a vector DB using the scheduled cells, then use the HTTP cells to expose an endpoint calling GPT with RAG using the vector DB (https://docs.neutrinolabs.dev/example-up-to-date-chatbot). Any specific use cases you had in mind?
And I agree, the deployment point is super important, its in the works!