by dternyak · 8y ago · 0 comments
For those who want to get started with molten, I've put together a boilerplate for a more full fledged production application here: https://github.com/dternyak/molten-boilerplate
It demonstrates:
- OpenAPI (swagger)
- SQLAlchemy
- alembic
- py.test
- invoke (task management / CLI)
Feedback is super welcome on the boilerplate, which is partially inspired by https://github.com/Bogdanp/molten_cookiecutter
Bogdan has been incredibly friendly and helpful while I've been learning the ins and outs (and pestering him over email). I'm sure he'll be happy to answer any questions here as they come up.
Happy hacking!
Uses Swagger/OpenAPI that then uses convention (or fully defined) packages, and methods for REST. Runs on top of Flask, and does a lot of all of the validation all from the yaml file. Plumbing taken care for you, etc. so you can focus on business logic?
So it becomes a choice. A decision of writing mostly OpenAPI, or writing Python via an API that is defined by someone (or a small set of people).
I'd personally rather learn OpenAPI specs as you're going to live in that world anyways, as it gives you so much tooling.
It's not hard, and you could take that yaml file and generate code for other languages in case Python's performance specifically for that API (especially it if is a microservice), runs too slowly in the real world and need a faster runtime, etc.