TranslateProject/sources/talk/20200731 Why we open sourced our Python platform.md

7.1 KiB

Why we open sourced our Python platform

Open source development philosophy makes Anvil's entire solution more useful and trustworthy. neon sign with head outline and open source why spelled out

The team at Anvil recently open sourced the Anvil App Server, a runtime engine for hosting web apps built entirely in Python.

The community reaction has been overwhelmingly positive, and we, at Anvil, have already incorporated lots of that feedback into our next release. But one of the questions we keep getting asked is, "Why did you choose to open source such a core part of your product?"

Why we created Anvil

Anvil is a tool that makes it as simple as possible to build a web app. We do that by enabling you to build the whole application in one language—Python.

Before Anvil, if you wanted to build a web app, you'd have to write code using a bunch of technologies like HTML, Javascript, CSS, Python, SQL, React, Redux, Bootstrap, Sass, Webpack, etc. That's a lot to learn. And that's just for a simple app; trust me, it can get way more complicated.

A complex framework of development tools needed for a simple web app

Yes, really. All of these, for a simple web app.

But even then, you're not done! You need to know all about Git and cloud hosting providers, how to secure the (most-likely) Linux operating system, how to tune the database, and then you're on call to keep it running. Forever.

So, instead, we built Anvil, an online IDE where you can build your UI with a drag-and-drop designer and write all your logic in Python, then Anvil takes care of the rest. We replace that whole teetering stack with "just write Python."

Simple web hosting is important, but not enough

Anvil can also host your apps for you. And why not? There is so much complexity in deploying a web app, so running our own cloud hosting service was the only way to provide the simplicity we need. Build an app in the Anvil editor, click a button, and it's live on the Internet.

But we kept hearing from people who said, "That's great, but…"

  • "I need to run this on an offshore platform without reliable internet access."
  • "I want to package my app into an IoT device I sell."
  • "If I'm putting my eggs in this basket, how can I be sure I can still run my app in ten years?"

These are all good points! A cloud service isn't the right solution for everyone. If we want to serve these users, there's got to be some way for them to get their apps out of Anvil and run them locally, under their own complete control.

Open source is an escape hatch, not an ejector seat

At conferences, we sometimes get asked, "Can I export this as a Flask+JS app?" Sure, it would be possible to export an Anvil project into its respective Python and JavaScript—we could generate a server package, compile the client-side Python to Javascript, and spit out a classic web app. But it would have serious drawbacks, because: code generation is an ejector seat.

Code generation is an ejector seat from a structured platform

(Image licensed as public domain)

Generated code is better than nothing; at least you can edit it! But the moment you've edited that code, you've lost all the benefits of the system that generated it. If you're using Anvil because of its drag-and-drop editor and Python in the browser, why should you have to use vim and Javascript in order to host your app locally?

We believe in escape hatches, not ejector seats. So we did it the right way—we open-sourced Anvil's runtime engine, which is the same code that serves your app in our hosted service. It's a standalone app; you can edit your code with a text editor and run it locally. But you can also git push it right back into our online IDE. It's not an ejector seat; there's no explosive transition. It's an escape hatch; you can climb out, do what you need to do, and climb right back in.

If it's open, is it reliable?

A seeming contradiction in open source is that its free availability is its strength, but also sometimes creates a perception of instability. After all, if you're not charging for it, how are you keeping this platform up and healthy for the long term?

We're doing what we always have—providing a development tool that makes it drastically simpler to build web applications, though the apps you build using Anvil are 100% yours. We provide hosting for Anvil apps and we offer the entire development and hosting platform onsite for enterprise customers. This enables us to offer a free plan so that everyone can use Anvil for hobby or educational purposes, or to start building something and see where it goes.

More to gain, little to lose

Open sourcing our runtime engine isn't a detractor from our business—it makes our online IDE more useful and more trustworthy, today and in the future. We've open-sourced the Anvil App Server for the people who need it, and to provide the ultimate insurance policy. It's the right move for our users—now they can build with confidence, knowing that the open source code is right there if they need it.

If our development philosophy resonates with you, why not try Anvil yourself?  

-----

This post is an adaptation of Why We Open Sourced the Anvil App Server and is reused with permission.


via: https://opensource.com/article/20/7/why-open-source

作者:Meredydd Luff 选题:lujun9972 译者:译者ID 校对:校对者ID

本文由 LCTT 原创编译,Linux中国 荣誉推出