Martijn Faassen: Morepath under the hood
Martijn Faassen gives the first keynote at Pygrunn, about Morepath under the hood
Python and web developer since 1998. I did Zope, and for a little while it was as popular as Python itself.
What is this about? Implementation details, concepts, creativity, software development.
Morepath is a web microframework. The planet Zope exploded and Morepath came out. It has a unique approach to routing and link generation with Traject. Easy and powerful generic code with Reg. Extensible and overridable with Dectate.
Zope 3 got traversal with components: adapt an object to an interface that knows how to publish to html, or to json. So the base object can be web agnostic again.
Pyramid simplified traversal, with __getitem__. So the object needs to be web aware again. Might not be an issue.
Routing: map a route to a view function. As developer you need to handle a 404 yourself, instead of letting the framework do this.
You can fight about this as frameworks. But morepath has it all. It is a synthesis.
I experimented with a nicer developer API than Zope was offering to get a view for traversal. So I created experimental packages like iface and crom. I threw them together in Reg. It was just a rewrite of the Zope Component Architecture with a simpler API.
Class dispatch: foo.bar() has self as first argument. Reg uses functools.singledispatch and builds multiple dispatch. But then I generalised it even more to predicate dispatch, as Pyramid had.
Don't be afraid to break stuff when you refactor things.
Dectate is a meta framework for code configuration. Old history involving Zope, Grok, martian, venusian, but now Dectate. With this you can extend or override configuration in your app, for example when you need to change something for one website.
Detours are good for learning.
Splitting things off into a library helps for focus, testing, documentation.
Morepath uses all these superpowers to form a micro framework.