Anvil: Full Stack Web with Nothing but Python
Meredydd Luff (~meredydd) |
Building a modern web app requires so much: HTML, CSS, JS, Python, SQL, React, Bootstrap, Webpack, Flask... What if we could build a better abstraction?
Our answer is Anvil: a full-stack Python framework where everything is a Python object, from your UI components to your database rows. In this talk, I'll walk you through how and why we constructed this new approach to the web.
We'll start with a question: Why is web programming hard? It's because your data takes so many forms: database rows, Python objects, JSON on REST, JS objects, HTML DOM, and finally pixels. Most of a web developer's job is translating between these awkwardly different representations. Frameworks like Django help, but now you have a stack of leaky abstractions: web frameworks, ORMs, JS frameworks, CSS frameworks, build tools... These frameworks help you go faster, but they double the amount you need to know!
So I'll show our stab at an answer: A framework where everything is a Python object, requests to the server are function calls, and Python is a browser-side language. I'll talk about running Python in the browser. I'll talk about full-stack autocompletion. There will even be live coding.
Join me for a rollicking tour of a new way to approach the web!
Outline and timing projections:
Why is web development hard? (5 minutes)[HTML_REMOVED] The web is an extremely developer-hostile platform. You spend all your time moving your data through incompatible representations: Database rows to server-side objects to JSON/REST to client-side objects to HTML DOM to pixels...it's a lot of work. So we use frameworks to automate this work, but they just make the complexity problem worse! I'll dig deep into a couple of examples, compare the results to the Zen of Python - and show how it falls short.
Anvil's design, by comparison (2 minutes)[HTML_REMOVED] How do we make something better? By making everything a Python object (including UI elements), and writing Python everywhere (including in the web browser). This means that everything in our app is one representation -- which means we can skip the hassle and complication of translating it so many times along the way.
Live-coding demo (10 minutes)[HTML_REMOVED] I'll show you how the Anvil framework works, by writing some code in it. In the process, I'll build a full-stack, database-backed web app, from scratch and entirely in Python.
How does Anvil work inside?[HTML_REMOVED] I'll pull back the curtain and talk about some of the implementation:
Building a Python autocompleter for an online editor. (5 minutes)[HTML_REMOVED][HTML_REMOVED]
Design principles for an accessible web: A call to arms (3 mins)[HTML_REMOVED] What does it mean for a platform to be "accessible"? Spoiler: It doesn't mean "no code", and it doesn't mean "a toy for beginners" either.
No web development experience required - all you need is Python!
I have previously spoken at PyCon US, PyBay, Python Web Conf (invited) and keynoted PyCon SK (also invited), as well as giving a few lightning talks. My 2021 PyCon US presentation was the highest rated talk of the conference.
I hold a PhD in usable programming systems from the University of Cambridge, and I have contributed to projects ranging from the Skulpt compiler to the Linux kernel to the MQA audio codec.
Skulpt (Python-to-JS compiler): https://skulpt.org