27 ms·
Launch HN: Pynecone (YC W23) – Web Apps in Pure Python
Hi! We’re Nikhil and Alek, founders of Pynecone (https://pynecone.io https://pynecone.io), an open source framework to build web apps in pure Python. This can be anything from a small data science/internal app to a large multi-page web app. Once your app is built, you can deploy your app with a single command to our hosting service (coming soon!), or self-host with your preferred provider.
Our Github is: https://github.com/pynecone-io/pynecone https://github.com/pynecone-io/pynecone
Python is one of the most popular programming languages in the world. Webdev is one of the most popular applications of programming. So why can’t we make full-stack web apps using just Python?
We worked in the AI/infra space and saw that even skilled engineers who wanted to make web apps but didn’t know traditional frontend tools like Javascript or React found it overwhelming and time consuming to learn. On the other hand, no code and low code solutions that save time in the development process lack the flexibility and robustness of traditional web development. These tools are great for prototyping, but they can be limiting as your app becomes more complex. We wanted to build a framework that is easy to get started with, yet flexible and powerful enough so you don’t outgrow it. Our main website is fully built with Pynecone and deployed on our hosting service.
In Pynecone, the frontend compiles down to a React/NextJS app, so from the end-user’s perspective it looks like any other website. We have 60+ built-in components ranging from forms to graphing. Components are defined as Python functions. They can be nested within each other for flexible layouts, and you can use keyword args to style them with full CSS. We also provide a way to easily wrap any existing React component. Our goal is to leverage the existing webdev ecosystem and make it accessible to Python devs.
The app state is just a class. State updates are functions in the class. And the UI is a reflection of the state. When the user opens the app, they are given a unique token and a new instance of the state. We store user state on the backend, and use Websockets to send events and state updates. When a user performs an action, such as clicking a button, an event is sent to the server with the client token and the function to handle the event. On the server side, we retrieve the user's state, execute the function to update the state, then send the updated state back to the frontend for rendering. Since Pynecone is 100% Python, you can easily integrate all your existing Python libraries into your app. In the future, we hope to leverage WebAssembly to offload many operations to the client.
Once your app is built, the next big challenge is deploying it. We’re building a single-line deploy, so you can type pc deploy and get a URL of your live app in minutes. Since we specialize in hosting a single type of app, we aim to provide a zero configuration deployment process. We are still working on releasing the hosting service, but you can sign up for its waitlist on our homepage. Alternatively, you can choose to host your app with your preferred cloud provider.
Things users have built with Pynecone so far include internal apps ranging from CRM to ML tools, UIs for LLM apps, landing pages, and personal websites. If you use Python, we would love to hear your thoughts and feedback in the comments!
- newaccount2023 4y agothe world is flooded with js coders, toolkits, drag-and-drool site builders this is a neat demo but why do I need to get python in the client when it is even easier to get js in the server? webdev is basically a solved problem at this point
- mattgreenrocks 4y agoLooks really promising. Have you consider some sort of framework construct to more clearly denote where code runs? Might help readability and make it easier to understand perf implications of code vs the model you have now.
- pplante 4y agoAt first I was very skeptical, but after looking further at the examples I feel like you pretty much nailed the developer experience. I have not used this yet but I will definitely check it out. Is there a roadmap? I see the GitHub project board is pretty focused on v0.1.20. I am curious what are your plans for client side code via wasm? I feel like that is a critical missing piece for me.
- picklelo 4y agoThanks! We're using GH Projects for everything, we will update the board with a more long-term roadmap. Python support for wasm isn't where we need it yet, but we definitely want to integrate it when it's ready.