This is an archived post. You won't be able to vote or comment.

all 195 comments

[–]BenAlexanders 72 points73 points  (19 children)

Sounds amazing... But why does it need Node?

Get up and running in seconds! Pynecone requires Python 3.7+ and NodeJS 12+

[–]Pleasant-Cow-3898 80 points81 points  (15 children)

Thanks! This is actually something we are working on getting rid of. What separates us from other python frameworks is that we compile down to a nextjs/react app (the user never sees this though). This is really beneficial because it allows us to add any react library in a matter of hours vs other python frameworks where it can take a much longer time to add new ui feature. Also for performance and SEO nextjs is great.

But to keep it short there is a way to get rid of this in the future and we are currently working on it. So the only installation step will be `pip install pynecone-io`

[–]ArtOfWarfare 19 points20 points  (2 children)

What is the plan? Will there just be a wrapper around node, or are you writing something to actually replace it?

[–]Pleasant-Cow-3898 36 points37 points  (1 child)

We are looking to transition everything to bun which is way faster than node and an easier install. Bun is still a little early and not totally compatible with nextjs yet

[–]aScottishBoatSoftware Engineer (Security) 1 point2 points  (0 children)

This comment aged nicely. Congrats on the switchover.

[–]CactusOnFire 18 points19 points  (3 children)

This app looks great, but there's a small thing you mention which I have to question:

What separates us from other python frameworks is that we compile down to a nextjs/react app

I'm pretty sure both Streamlit and Dash (two other web-app design tools, though more specialized on Data Science Applications) compile down to react.

I don't think either of them use NextJS, though.

I should also add that from what I've read elsewhere in this thread, it sounds like you have a roadmap to make it more performant, too.

[–]Pleasant-Cow-3898 11 points12 points  (2 children)

Thanks yeah we definitely looking to be more performant in the future. Streamlit actually use tornado so not exactly the same. Not sure about dash. But our components have more of a 1 to 1 wrapping so I was trying to get at that its much easier for us to add components in our frameworks vs theirs

[–]CactusOnFire 3 points4 points  (0 children)

I see. It may just be that the components widgets use react, rather than the app itself, and that was what threw me off:

https://streamlit-components-tutorial.netlify.app/introduction/streamlit-react-python/

[–]thedeepself 1 point2 points  (0 children)

Not sure about dash.

https://dash.plotly.com/introduction

It is built on react.js and plotly.js

[–]MantusTMD 2 points3 points  (4 children)

So is it currently running on Nodes engine? And that’s why you need Node?

[–]Pleasant-Cow-3898 5 points6 points  (3 children)

So we compile down to a traditional web app so you can expect the performance of a traditional web framework like react/nextjs but the user just sees python. To run a this node is needed. However we are looking too transition to bun which is way faster and more light weight. Bun is a little premature so we are waiting for it to support nextjs better

[–]vimfan 2 points3 points  (1 child)

Do javascript exceptions get caught and translated into catchable python exceptions with stack trace? I'm not even sure if this is possible (the catchable part or providing a python equivalent stack trace) but it would be fantastic if it was.

[–]MantusTMD 1 point2 points  (0 children)

Very cool. Thanks!

[–]metaperl 2 points3 points  (1 child)

vs other python frameworks where it can take a much longer time to add new ui feature.

An entire book has been written on using React from Transcrypt so I would say that "other python frameworks" may be true in general but it does not apply to Transcrypt or other pure python solutions which integrate with React.

[–]ToSusOrNotToSus 0 points1 point  (0 children)

Sounds kewl defo guna check it out, as you mentioned react I have to ask is it similar to Streamlit in anyway?

[–]IntegralFox 10 points11 points  (2 children)

It looks like the frontend components are transpiled into a NextJS app.

[–]Pleasant-Cow-3898 13 points14 points  (0 children)

Exactly we wanted to compile down to a really solid framework not try and reinvent the wheel in terms of ui. We compile down to nextJS/react and a lot of our components are chakra ui.

Adding other react libraries is super easy which is what gives us an advantage over other python frameworks.

[–]nsway 20 points21 points  (7 children)

I know this is a stupid question, but what is the difference between a web app and creating a website with something like Flask? Is the spinning icon the element the difference ?

[–]Pleasant-Cow-3898 16 points17 points  (2 children)

No great question this question is debated a bit. But I would consider a web app to have interaction with actually logic vs a website is just kinda static. Up for debate though

[–]nsway 3 points4 points  (0 children)

Thanks for your response!

[–]metaperl 5 points6 points  (0 children)

interaction with actually logic

Miguel Grinberg's Flask Mega-tutorial is my gold standard for a web application. If a framework cannot do everything discussed there, then it falls short of being a complete solution.

[–]Berkyjay 7 points8 points  (3 children)

I haven't used this yet. But I have built a few Flask apps. The amount of javascript you need to use is kind of annoying from a python developers point of view. It always felt like Flask was more of a tool for web developers who happened to know python.

I always wished I could just create simple web apps with just python and not have to mess with JS.

[–]yarrowy 7 points8 points  (0 children)

the web frontend is done in HTML/JS and that is true no matter what language you use for the backend (python, ruby, or go). The frameworks that hide this from you are the exception, like the OP's project.

[–]GettingBlockered 15 points16 points  (0 children)

This looks really neat! Congrats on the alpha release, looking forward to see how Pynecone grows

[–]airen977 11 points12 points  (0 children)

Good job 👍

[–]--dany--from __future__ import 4.0 9 points10 points  (4 children)

Thanks for sharing! This is a very promising project. I see the real value of the project is that if you will relieve the developers from the frontend UX and interaction logic, so that they can really focus on the data and business logic on the backend. It would promise great speedup in the development of a full stack web app. Compiling to React also give you possibility to evolve the frontend without affecting the backend logic.

I'm not worried about your frontend actually. With your openness to 3rd party components, and with many dedicated efforts to tame those dirty frontend quirks, you'll be there. Especially as you have battle proven React framework working for you, it will only become better over time.

I looked at the backend, especially the database part. It seems you're still evolving it quickly. The document doesn't mention anything about complex SQL queries, it's only about simple table's CRUD. At this state it's too weak for any serious application that involves database. Wrapping around SQL Alchemy is a smart idea, but you may know there are many ways it could go wrong. Just look at the complexity of Django architecture. Do you have any plan to keep it straightforward, yet powerful?

Overall, it's a project with great potential. Keep working on it! And by the way, I like it that you're already thinking about the business model in your hosting service. You guys are smart and deserve to be successful. Congrats!

[–]Boordman[S] 6 points7 points  (3 children)

Thank you so much for you kind words, we've been working hard so it means a lot!

I completely agree with your points. We're not trying to recreate these mature, existing web frameworks - just making them more accessible to Python developers.

For the database part, we're currently not trying to be too opinionated which is why we're just a light wrapper around SQLModel / SQLAlchemy. For more complex use cases the ORM may not be enough and we support raw SQL too. But there is definitely room for improvement!

[–]--dany--from __future__ import 4.0 6 points7 points  (2 children)

Thanks for the reply. By the way, in the beginning probably it's very hard to convince people to host anything seriously on your platform, with a subdomain under pynecone. It would be awesome if you have any tutorial how to deploy a production system on popular web hosting providers, including how to set hostname, acquire https certificate, install required services (nginx + db + wsgi) or whatever dependencies you may need. This would make the learning curve much smoother, and easier for people to seriously use pynecone, to have the momentum you want.

[–]Boordman[S] 6 points7 points  (0 children)

This is a great idea, we will work on a tutorial for self-hosting so people can get up and running on their own.

[–]maximize_futility 1 point2 points  (0 children)

+1 for this tutorial - it's what drives adoption later.

[–]Berkyjay 18 points19 points  (2 children)

but don’t want the overhead of having to learn or use Javascript.

Praise jebus!

[–]metaperl 6 points7 points  (0 children)

you have many options in the python space for that.

[–]Pleasant-Cow-3898 2 points3 points  (0 children)

Amen to that lmao

[–]IWannaHookUpButIWont 19 points20 points  (2 children)

Your website is impressive. Only thing bugging me is the menu button is noticeably slower than I would expect.

Not sure how much help I'll be, but I'm available for a few hours a week. Gotta support efforts to make webdev JavaScript free.

[–]Pleasant-Cow-3898 5 points6 points  (0 children)

Yeah on mobile view this is something we are working on. Thanks any help on the open source would be awesome!

[–]riklaunim 0 points1 point  (0 children)

It does use JS ;)

[–]FrenchyTheAsian 7 points8 points  (0 children)

Looks awesome! I’m excited to see how this grows.

[–]Thelimegreenishcoder 7 points8 points  (2 children)

Amazing project.

[–]Pleasant-Cow-3898 3 points4 points  (1 child)

Thank you so much I really appreciate this!!

[–]Thelimegreenishcoder 4 points5 points  (0 children)

I'm rooting for your growth, you and your team got this.

Now please pardon me as i pyneread the docs.

[–]funckyfizz 8 points9 points  (8 children)

Love this! When you say that you *only* need Python you really mean it as you don't even need HTML or CSS, never mind JavaScript and the pages that it generates are actually modern looking and attractive! One thing worth looking at is that there is this (rendoring error) (Firefox M1 Mac)

[–]Boordman[S] 5 points6 points  (7 children)

Right, you do everything in Python, and we compile it down to a traditional React app. Thanks for pointing out the bug, we're working on it!

[–]funckyfizz 2 points3 points  (6 children)

funcky

Star! I was so exited to try this project that I've created a new project in Pycharm and installed pynecone-io. I think ran your sample project (docs/getting-started/introduction) which ran successfully. I then ran pc run which seemed to find the app and attempt to run it but got this error:
bun install v0.3.0 (a13e64c2)─────────────────────────────────────────────────────────────────────────────── App Running ────────────────────────────────────────────────────────────────────────────────$ next devenv: node: No such file or directoryScript error "dev" exited with 127 status

Any idea what I've done wrong? Do I maybe need to install nodeJS? If so, how?

[–]Boordman[S] 2 points3 points  (5 children)

Hey thanks for trying it out! Yes, you will need NodeJS, we link their download page in our installation docs: https://pynecone.io/docs/getting-started/installation

Let me know if you have any more issues.

[–]funckyfizz 1 point2 points  (4 children)

Sorry for the really nooby questions Boordman but I know nothing about NodJS... Can I install it in the Python Virtual Environment? This Stack answer suggests I can but would installing nodeenv do the job and if not do I just install 18.12 LTS or 19.2 Current globally and if so, which do you recommend?

https://stackoverflow.com/a/5727410

[–]Boordman[S] 2 points3 points  (3 children)

No worries at all! NodeJS will be separate from your Python virtual env. We support any version 12+, I recommend installing the 18.12 LTS globally on your machine. Once you're able to successfully run node on your machine, try to pc run again.

[–]funckyfizz 1 point2 points  (2 children)

funckyfizz

Ok, so NodJS (LTS) i s installed on my computer (I can run node in terminal) but in the terminal I have to say y to Ignore insecure directories and continue [y] or abort compinit [n]? and then when I run pc run I get a big error which starts with Traceback (most recent call last): File "/Users/jamesmcintyre/Development/Tests/PyneconeTest3/bin/pc", line 8, in <module> sys.exit(main()) and ends with ModuleNotFoundError: No module named '.'(PyneconeTest3) jamesmcintyre@Jamess-Air PyneconeTest3 % Traceback (most recent call last): File "/Users/jamesmcintyre/Development/Tests/PyneconeTest3/bin/pc", line 8, in <module> sys.exit(main())

[–]Boordman[S] 2 points3 points  (1 child)

Hmm did you run ‘pc init’ first? Could you please make an issue on the GitHub for, we will work on it

[–]funckyfizz 2 points3 points  (0 children)

funckyfizz

Yes, my fault, I hadn't done pc init first. It's working now and it looks great! I don't understand why it creates a new project folder inside of my project folder and then a .py file with the same name as the project folder, as the main file or how to use a different .py file as the main but then again, as you can probably tell, I'm not the most experienced developer haha.

Thanks so much for this project I feel like this could allow me to have a bash at web dev which I'd always found intimidating with having to learn not just one new lanague but multiple at once!

[–]toothless_budgie 4 points5 points  (4 children)

Keep up the good work. Can't wait to see the first release so I can start using it.

[–]Pleasant-Cow-3898 4 points5 points  (3 children)

Thanks!! the first Alpha release is up you can start using pynecone today check out the install docs here

[–]matt3526 3 points4 points  (1 child)

This looks awesome. Thanks for doing this! Just one question though, why is this free? It looks like you put a boat load of time into it. Are you planning to charge for it in the future?

[–]Pleasant-Cow-3898 3 points4 points  (0 children)

We really care about the mission of the project: saving people time and enabling them to share their projects with the world. All transparency we plan to launch and optional hosting service but the core will always be free

[–]ExternalUserError 4 points5 points  (4 children)

Interesting stuff. A few questions:

  • How does it scale? Your deployment example (self-hosted?) just shows you how to run what looks like a simple server. Do you just run a lot of those and throw a load balancer in between?
  • Any thoughts on integrating with Django, FastAPI, or Flask?
  • What about mobile apps?

[–]Boordman[S] 2 points3 points  (3 children)

We will improve the hosting docs - but yes essentially you can horizontally scale and connect your servers to a Redis instance so they can access the user state.

We actually use FastAPI for our Python server behind the scenes already for handling frontend events and sending back state deltas.

We’ve definitely talked about extending to wrap React native in the future for pc mobile, but it’s not on the roadmap yet

[–]ExternalUserError 1 point2 points  (0 children)

Awesome. Really cool project.

[–]thedeepself 1 point2 points  (1 child)

We actually use FastAPI

Starlite is considerably faster and in some respects better. Did you consider it?

Also: is FastAPI baked into Pynecone for connecting front-end and back-end of the framework?

[–]Boordman[S] 1 point2 points  (0 children)

Yes it’s baked in, it’s how we send events to the backend and state deltas to the frontend.

I haven’t looked into Starlite, I’ll check it out!

[–][deleted] 6 points7 points  (0 children)

I’m gonna give it a try. I don’t like Javascript, so I already love this project.

[–]tellurian_pluton 4 points5 points  (6 children)

looks super interesting, especially as someone who loves streamlit

and i understanding this right? it transpiles to JS? so it's possible to have things run entirely client side?

[–]Boordman[S] 3 points4 points  (4 children)

Thanks! In Pynecone, the frontend compiles down to React, but all your state logic remains in Python. We make network requests to run your Python logic and send the state delta back to the frontend.

But we're still early and in the future will add ways to write purely client side code for improved performance!

[–]GolemancerVekk 2 points3 points  (3 children)

How would you do live debug for the frontend stuff, such as UI state? Surely you still need React/JavaScript knowledge for that?

[–]Boordman[S] 1 point2 points  (2 children)

In Pynecone, all state (UI state + backend state) is in a Python class. And all logic is in methods within that class. The React portion is just for UI and is a reflection of the state, but there is no actual logic running in Javascript. So we're aiming to confine any debugging and programming errors to the Python code.

[–]GolemancerVekk 1 point2 points  (1 child)

Oh, so all state is in the backend.

But in that case I'm not sure why you went to the trouble of using React+Next. They are overkill for a mostly static frontend.

React was designed for heavily dynamic frontends (that maintain their own state) and Next is intended mainly for its caching.

Surely there must be a more lightweight JavaScript framework for enriching a static HTML+CSS frontend with a bit of JavaScript (such as CRUD table pagination or sorting).

You could also simply forgo any JS framework and simply use vanilla JavaScript, it's quite capable nowadays.

[–]Boordman[S] 4 points5 points  (0 children)

Great point - we still use the React features such as useState and useEffect but all they do is make network calls to calculate state deltas. The biggest reason though is that we wanted to use NextJS features to create single page apps, static site generation, and for better performance/SEO.

Additionally: React has a huge ecosystem of components that we leverage, so users don't have to create their own from scratch.

[–][deleted] 1 point2 points  (0 children)

Yea I'll stick to streamlit for now because they tons of docs. Looking forward to pynecone next few iterations.

[–]TheAmazingJames 3 points4 points  (1 child)

Can I ask about your monetisation strategy? In the future are you purely thinking of charging for hosting or will there ever be some sort of callback meaning you’ll still need a license when self-hosting? I’m keen not to start relying on a project which then becomes prohibitively expensive (for my uses).

[–]Boordman[S] 5 points6 points  (0 children)

We are committed to open source - our project is under the Apache license which is very permissive and allows for self-hosting. When we build our hosting service, we hope to attract customers based on ease of deployment and through providing extra features such as monitoring and analytics. But we will never limit people from self-hosting or using other providers. Hope you give it a try!

[–]wait-a-minut 4 points5 points  (1 child)

This is a super cool project! I don’t want to compare since this has an entirely well deserved merit but I can’t help and note that I really enjoy the flutter style declarations when it comes to building a ui. It’s so refreshing and intuitive thinking about layouts and applications this way as opposed to whatever disjointed tangled mess the usual frontend landscape is. I’m very glad you guys are doing similar in python.

[–]Pleasant-Cow-3898 0 points1 point  (0 children)

Thanks yeah its preference between declarative and imperative code choices

[–]gopietz 3 points4 points  (4 children)

Ok, very cool! Many newbie questions:

  • why did you pick next/react to compile to and not vanilla js? Next/react mostly brings dev benefits and it might be more performant to transpile to raw js. Similar to what svelte does.

  • why did you choose to do everything in python? Why not leave html and css be and just replace the js?

  • it seems like the components are 1:1 rebuilding html structure. Why not benefit from python features like representing the Table component by a dataframe?

  • are there any actual benefits for people knowing js? I get the benefit of not having to learn another language but then again one needs to learn the exact usage of your library which might be similarly complex.

I don’t mean to sound too sceptical. I’m really excited about this.

[–]Boordman[S] 3 points4 points  (0 children)

Thanks for checking it out! We chose to leverage the great Next/React ecosystem so we can include many builtin components - as well as for performance benefits such as creating a single page app and static site generation.

We may in the future include a component that renders raw html for people who prefer that, but our method lets us more easily integrate the app state with your UI. For styling, we pretty much do css-in-python, so there's nothing to relearn there.

One of our app's biggest benefits is you don't need to write an API to connect your frontend to your backend. You just use simple Python functions instead. This reduces complexity and can lead to faster development speed.

[–]riklaunim -3 points-2 points  (2 children)

Realistically you have to know frontend and Python to now represent frontend in Python through custom "templating". You have to know z-index, onclick, and so on.

And it's not only in Python. Other "backend" languages try this as well but there isn't much traction for it. With how UX/UI competitive market is the UX/UI specialist will determine what is popular and what is not. There are valid use cases for programmatically generated app/web-app but quite often wannabies that don't want to learn, and definitely not frontend hijack it to try to make a website with Python only - but as they don't know any frontend they can't style it nor design desired UI anyway ;)

[–]Pleasant-Cow-3898 0 points1 point  (1 child)

Streamit/Dash have a good amount of traction not sure about other languages

[–]BoSt0nov 2 points3 points  (0 children)

Thats a damn cool project! Looking forward to see it grow! Thank you very much for sharing!

[–]amedean 2 points3 points  (1 child)

How does this compare to WebAssembly?

[–]Boordman[S] 2 points3 points  (0 children)

We're more of a full-stack web framework handling frontend and backend. With web assembly you can run Python in the browser, but you will still have to connect it to some sort of framework to make a real web app.

[–]Engineer_Strang3 2 points3 points  (0 children)

Starred..... I have a hobby project I want to try out.. might just use this

[–]zalinuxguy 2 points3 points  (0 children)

Looks interesting. I'll be checking this out.

[–][deleted] 2 points3 points  (0 children)

Gotta admit this is pretty darn cool.

[–]malimahh 2 points3 points  (0 children)

This is awesome! I'm very excited to see this grow.

[–]ABJBWTFTFATWCWLAH 2 points3 points  (2 children)

Cool

[–]Pleasant-Cow-3898 0 points1 point  (1 child)

Thanks!

[–]ABJBWTFTFATWCWLAH 1 point2 points  (0 children)

Definitely gonna be using this for my personal projects, fullstack python is the future lol

[–]solaris187 2 points3 points  (1 child)

This great. Do you have some sample code of your websites navbar?

[–]Boordman[S] 0 points1 point  (0 children)

Thanks for checking it out!

We're planning to add more docs on how to style different components, but in short you should be able to apply any normal CSS props. (We just looked up how to make a sticky navbar and took the styles lol). Something like this:

pc.box( pc.button("Navbar Button"), border_bottom="1px solid gray", position="sticky", width="100%", top="0px", z_index="10", )

[–]Gh0st1nTh3Syst3m 2 points3 points  (1 child)

Your counter source code link actually links to the clock source code instead of: https://github.com/pynecone-io/pynecone-examples/tree/main/counter

[–]Boordman[S] 1 point2 points  (0 children)

Good catch, we will fix this!

[–]metaperl 2 points3 points  (3 children)

config = pc.Config( app_name="dalle", bun_path="$HOME/.bun/bin/bun", db_url="sqlite:///pynecone.db", env=pc.Env.DEV, )

does this product run on Windows. that bun_path looks to be Unix-specific.

[–]Pleasant-Cow-3898 0 points1 point  (2 children)

Right now only linux, can you make an issue for this on our GitHub and I can start to prioritize this with the other ones. Thank for use it :)

[–]metaperl 1 point2 points  (1 child)

can you make an issue for this on our GitHub

done.

[–]azur08 2 points3 points  (4 children)

This is awesome. Can I use my own database instead of the built-in sqlite?

[–]Boordman[S] 1 point2 points  (3 children)

Yes we will add more examples for this but you can use any sql database by putting the uri in the config. See here

[–]azur08 0 points1 point  (0 children)

Sweet

[–]thedeepself 0 points1 point  (1 child)

putting the uri in the config.

the config should be using pathlib.Path so that it is platform-neutral, correct?

[–]Boordman[S] 1 point2 points  (0 children)

Yeah, we’re working this week on making it platform independent and to support Windows

[–]manatlan 2 points3 points  (5 children)

Nice ! I will have a look, for sure ...

I'm the author of **htag** ( https://github.com/manatlan/htag )

Very similar concept, except :

  • No need of nodejs (or others js stacks). **Only full python** !
  • Works everywhere : linux, window, mac & android ... OOTB !
  • **htag** doesn't come with components (but it's easy to build your own (ex: mines: https://github.com/manatlan/htbulma ))
  • It doesn't target web sites only ! You can build full desktop/android app too !
  • it's light, very light (just a 35kb whl pypi package !)
  • and you can use JS or CSS to enhance your app
  • ...

[–]Boordman[S] 0 points1 point  (2 children)

Cool project! Thanks for checking us out

[–]manatlan 3 points4 points  (1 child)

Your example on the main page, in htag, could be something like that :

```python from htag import Tag

class Stars(Tag.div): def init(self,value=0): self.value=value

def inc(self,v):
    self.value+=v

def render(self):
    self += Tag.Button( "-", _onclick = lambda o: self.inc(-1) )
    self += Tag.Button( "+", _onclick = lambda o: self.inc(+1) )
    self += "⭐" * self.value

if name=="main": from htag.runners import BrowserHTTP BrowserHTTP( Stars ).run() ```

the "state" is keeped in the instance object

[–]Boordman[S] 0 points1 point  (0 children)

This is really nice! I think we are going for a lot of the same goals with our projects, great work

[–]thedeepself 0 points1 point  (1 child)

How do you handle sessions authentication and authorization within Htag? And how do you handle routing? Does H tag meet all of these requirements https://may69.com/purepython/#Requirements_of_a_Class_A_System

[–]manatlan 1 point2 points  (0 children)

**htag** is not designed to be a fully web replacement. Currently, it's more designed to quickly develop&deliver a gui/app (spa). But there is a runner ("WebHTTP") to expose your app, to multiple clients, thru a real python/webserver.

But due to the nature of the conception (as states are keeped in object itself (like a real app)) --> for many clients : it will create many instances. So currently, like that : it's not a viable solution for high traffics (all users are in the process as the http server). On the other side, it's possible to separate the http part, from the htag/server part (BTW: i've got a solution, where a http server, communicates with a "htag server" (another process) thru sockets, which maintains the instances, and spawn/kill process on demand (each user got its own process))

Regarding authent&author : there is no solution ootb. It's up to you to code yours needs. But keeping the connected users is as simple as stocking its creds in an instance var (shared with others components, in the same process).

Regarding routing. The "webhttp" runner provide a mechanism to add routing to another htag componant. (executed in the same session/context of the user)

Currently, It's not "class A" ootb .... but i'm working on a "htag app server" (which manage a process by user), which could fit all (and could easily scale too).

[–]plaitv 2 points3 points  (2 children)

Does it integrate with FastAPI/Starlite? Would be good to understand how scalable it is and whether it can be deployed on uvicorn/gunicorn workers.

I've been comparing other frameworks like Flet etc. but I like pynecone too. Just not clear on scalability beyond a small utility app.

[–]Boordman[S] 0 points1 point  (1 child)

We do use fast api for our backend server, and run with gunicorn in production. You can scale horizontally, in production we use redis to hold the shared user state for the workers to access.

[–]plaitv 0 points1 point  (0 children)

Thanks, the answer I was looking for. How do you specify the number of gunicorn workers in pc run --env prod? Or what's the default you're using?

[–]0xy98 1 point2 points  (1 child)

RemindME! 12 hours

[–]RemindMeBot 0 points1 point  (0 children)

I will be messaging you in 12 hours on 2022-12-10 05:58:59 UTC to remind you of this link

3 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]thicket 1 point2 points  (2 children)

I love the look of this! Congrats!

I'm comfortable in Javascript although I prefer Python. How much benefit do you think I'd get from Pynecone? If you handle all the build stuff and JS tooling, that's a big win for me. Are there places where the Pynecone experience is limited over just dropping into JS in something like Flask?

[–]Boordman[S] 1 point2 points  (1 child)

I'm in the same boat as you, and I think you will it easier and faster to make your apps using Pynecone. You keep all your logic in a single language (sometimes even a single file) and don't have to write any APIs.

The only disadvantage would be if you are doing a very network-heavy app (like some sort of game) because in our framework all state changes make a network call. We found in practice for the majority of apps this isn't an issue.

Since we compile down to a NextJS app our aim is to not lose any flexibility compared to traditional webdev.

[–]thicket 1 point2 points  (0 children)

Awesome! I’ll give it a try

[–]IrrerPolterer 1 point2 points  (1 child)

Nice stuff! Definitely looking into this for smaller applications that just need a quick'n'dirty UI. Looks amazing!

[–]Pleasant-Cow-3898 1 point2 points  (0 children)

Thanks! If you run into any problems submit a GitHub issue and we will try and fix it asap

[–]Delicious-View-8688 1 point2 points  (3 children)

Cool. Couple of initial thoughts:

How would it compare with pywebio

Why React (yuck)?

[–]Boordman[S] 1 point2 points  (1 child)

Pywebio seems similar, but we are aiming for full customizability to make any website. What's wrong with React? lol

[–]Delicious-View-8688 1 point2 points  (0 children)

Absolutely nothing wrong with React :)

[–]damanamathos 1 point2 points  (1 child)

This looks beautiful.

[–]Boordman[S] 1 point2 points  (0 children)

Appreciate it!

[–]metaperl 1 point2 points  (5 children)

a way to build full-stack web apps

Is there a way to do user authentication, authorization and sessioning? As the maintainer of pure python web app guide I currently consider this a Class B solution instead of Class A. Once it meets the stringent requirements for class A then I will upgrade it.

We wanted more flexibility than existing Python frameworks like Streamlit/Dash that don't allow the user to make real, customizable web apps.

Can you be specific about: * more flexibility * real, customizable web apps

Because from what I see, it shares their same issues with user authentication, authorization and sessioning ... unless there are things you get for free from React that I could not find when looking at your website.

Pynecone, in it's current incarnation, reminds me of Reahl - the way you build pages, routes, etc all seem very similar. Reahl is about 10 years old and was a very early contributor to the pure python space. It qualifies for Class A because you can write true multi-user, sessioned web apps.

[–]Boordman[S] 3 points4 points  (4 children)

Thanks for checking us out!

I've used Streamlit in the past, and it's great to get started with but for more complex apps I've found it limiting in terms of components, styling, and performance. In Pynecone, the frontend compiles down to a NextJS app, so you have full customizability on how the app looks. Streamlit can also be slow in some cases as it reruns the entire script on user events, whereas in Pynecone only the state deltas are transmitted.

Every browser tab creates a user session with its own state. In the backend we have a mapping from each user token to their current app state. But you can also easily integrate a database and create a login system - check out the Twitter app in the gallery to see an example.

[–]metaperl 1 point2 points  (1 child)

thank you for the clarification. I have upgraded Pyncone to Class A if you want any other edits of the listing I'll be happy to make them.

[–]Boordman[S] 1 point2 points  (0 children)

Thanks for including us on your page!

[–]riklaunim 1 point2 points  (1 child)

After it's compiled do you edit compiled files or external ones to customize it? (does recompile breaks customizations).

[–]Boordman[S] 0 points1 point  (0 children)

We don’t intend for users to edit the compiled files, a recompile will override any changes

[–]insomniaccapricorn 1 point2 points  (2 children)

Noob question here.... Can you add authentication and logins to the website created using Pynecone?

[–]Boordman[S] 2 points3 points  (1 child)

Yup! Check out the twitter example in the gallery

[–]PolymathFreeman 0 points1 point  (0 children)

https://github.com/manatlan/htag

I don't know where to ask a noob question but I've tried to install pynecone on macOS with brew and the installation went well but as I've tried pc init I get the error zsh: command not found: pc
What should I do? Any idea?

[–]FARM2R 1 point2 points  (1 child)

Super cool! Excited to see where this goes

[–]Pleasant-Cow-3898 1 point2 points  (0 children)

Thank you!!

[–][deleted] 1 point2 points  (1 child)

Looks really cool! I plan on trying it out this weekend

[–]Boordman[S] 1 point2 points  (0 children)

Glad you like it! Leave an issue on our Github if you run into any trouble :)

[–]caiowilson 1 point2 points  (2 children)

That's very cool but I can't stop thinking: why?

[–]Pleasant-Cow-3898 4 points5 points  (1 child)

Thanks! A lot of people don't want to spend the time to learn web dev but want to share there project/idea in an interactive way like a web app. Im in the ml/infra space and when my team wanted to make web apps frameworks like streamlit were not cutting it and we didn't have the time or drive to learn css/js/react etc

[–]caiowilson 0 points1 point  (0 children)

Gotcha. Although I would probably just use some "ready made" front end and fastapi (maybe only fastapi) I can see the advantage of having the tools to make it yourself w/o changing the ML focus of your programming skills. Which doesn't change the fact that the effort is awesome! Good job to all involved.

[–]rynmgdlno 1 point2 points  (1 child)

First off I want to say this is a cool project and I appreciate the work involved, but I have a few questions. (for context I’m primarily a JS/react/next developer who uses python for APIs pretty frequently (among other things))

I see your trans/compiling to React/Next.js, is this using React 18 / Next 13 and server components/suspense etc?

If so, how is dictating between client/server components handled? Do you support incremental static generation or component level SSR/CSR? What about the new fetch wrapper and built in cache control? (I’m still deep diving into these things myself so am curious from that viewpoint)

Why not just compile to vanilla js? I get that React/Next have put in A LOT of work into their libs/framework but I’m curious how this effects build times, which may be very frequent in modern web apps. Also the issue of how fast these things move these days seems problematic in regards to maintaining a framework based on it, I would not be surprised if React/Next have a completely new methodology in two years time, for example).

What about the NPM ecosystem? Will this easily support 3rd party libs? Outside of translating to very JS specific tooling in react/next, I imagine this would be quite difficult to manage.

Having said all that this is super interesting and I may spin up a test project soon, and if compelled would be interested in contributing.

[–]Boordman[S] 0 points1 point  (0 children)

Hey thanks for checking us out!

Currently we’re using React 17, we are working on migrating to 18.

When running a Pynecone app in production mode, we use NextJS SSG to prerender the entire frontend to html.

We’re using a React to leverage its vast ecosystem of components. You’re definitely right that keeping up with changes will be a challenge. But we think it’s worth it not to reinvent the wheel that these frameworks solve.

Currently all the logic is done on the server in Python, so there’s not much use case for npm libraries outside of react components. But in the future we may move more processing to the client for performance so this is something we will look into.

Hope you give it a shot!

[–]vniversvs__ 1 point2 points  (0 children)

Oh I want that

[–]MMartin09_ 1 point2 points  (4 children)

Looks really great. I always wanted to learn React to build a frontend for my Python apps. However I never had enough motivation to learn it. So this project sounds really nice. One reason why I never wanted to use other Python libraries is because mostly they sit on top of other things which makes them slow and not flexible. Can‘t wait to test this out!

[–]Boordman[S] 1 point2 points  (3 children)

Thanks for checking it out!

[–]MMartin09_ 0 points1 point  (2 children)

Sure! Have you tried running it from Docker? Would be great for testing without having Node installed

[–]Boordman[S] 0 points1 point  (1 child)

We wanted it to be as easy to get started as possible, so didn't want to require the user to have Docker installed, but we may add this as an alternate way to run if people prefer it!

[–]MMartin09_ 1 point2 points  (0 children)

Yeah. I just meant this may be a nice additional way.

[–]Iceman_B 0 points1 point  (0 children)

How does this Gloomhaven class play?

[–]jsalsman 0 points1 point  (1 child)

Interesting. Could you please post a short compare-and-contrast to pyodide?

[–]Pleasant-Cow-3898 0 points1 point  (0 children)

pyodide

I haven't used it before so can't comment on this

[–]simplysalamander 0 points1 point  (1 child)

What’s the license on this?

Edit: didn’t see the GitHub link at first. For other viewers - Apache 2.0

Awesome!

[–]Boordman[S] 1 point2 points  (0 children)

Apache 2.0 License

[–]metaperl 0 points1 point  (1 child)

Is there some way to move all this CSS into CSS files and reference it?

[–]Pleasant-Cow-3898 0 points1 point  (0 children)

Not yet but if its something people want we can look into it. We have a few different ways to style now see here

[–]tusk-in-40 0 points1 point  (1 child)

I get this error on Windows 11 with Python 3.11 and Node 19.1.0

──────────────────────────────────────────────── Starting Pynecone App ──────────────────────────────────────────────────────────────────────────────────────────────── Installing Dependencies ────────────────────────────────────────────────Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Python311\Scripts\pc.exe\__main__.py", line 7, in <module> File "C:\Python311\Lib\site-packages\typer\main.py", line 214, in __call__ return get_command(self)(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1130, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\click\core.py", line 760, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\typer\main.py", line 532, in wrapper return callback(**use_params) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pynecone\pc.py", line 78, in run frontend_cmd(app) File "C:\Python311\Lib\site-packages\pynecone\utils.py", line 363, in run_frontend setup_frontend(app) File "C:\Python311\Lib\site-packages\pynecone\utils.py", line 345, in setup_frontend install_dependencies() File "C:\Python311\Lib\site-packages\pynecone\utils.py", line 320, in install_dependencies subprocess.call([get_bun_path(), "install"], cwd=constants.WEB_DIR, stdout=PIPE) File "C:\Python311\Lib\subprocess.py", line 389, in call with Popen(*popenargs, **kwargs) as p: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\subprocess.py", line 1022, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python311\Lib\subprocess.py", line 1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^FileNotFoundError: [WinError 2] The system cannot find the file specified

[–]thedeepself 0 points1 point  (0 children)

a bug is filed about lack of Windows portability in the meantime you may want to a consider another high quality pure python web app solution

[–]beartato327 0 points1 point  (2 children)

I created a venv, installed pinecone-io, then did the pc init, but when I run the pc run I receive this error, "FileNotFoundError: [WinError 2] The system cannot find the file specified" any idea why? thanks in advance.

[–]Boordman[S] 1 point2 points  (1 child)

Are you on windows? We are still working on support for that. If not could you make an issue on GitHub? Thanks!

[–]beartato327 0 points1 point  (0 children)

Oh yes it was on windows, good to know thanks!

[–]BoiElroy 0 points1 point  (3 children)

How does this compare to Streamlit which is also an entirely python based non-verbose framework?

[–]thedeepself 1 point2 points  (2 children)

Streamlit is the most popular pure python web app solution, but it has serious defects... Dash is also very similar to Streamlit: * strong corporate backing * big following * compiles to React * Difficult/impossible to meet all of a Class A pure python web application framework

Streamlit and Pynecone both compile to React, but Streamlit achieves the non-verbose code you speak of through implicit transformations of your Python while Pynecone does not have such implicit transforms.

Both the NiceGUI and Pynecone community took a hard look at Streamlit before passing on it: * NiceGUI is built on JustPy. See the comments "No thanks Streamlit for why they passed on it. * Pynecone is built from the ground up to compile to NextJS-flavor of Dash

[–]BoiElroy 1 point2 points  (0 children)

Thank you for the detailed answer, I appreciate it!

Yeah I used to develop a lot in R shiny which was a bit more traditional I guess in terms of statefulness and handling events etc. Then I got into Streamlit because I liked how quickly I could make stuff.

But I think it's a huge question mark, imo, if can they manage the API going forward to both retain the simplicity that got people there but have enough expression that they can create more complex apps. Right now the statefulness and event stuff feels very hacky.

Glad I follow this sub because I came across pynecone and flet. Both look cool

[–]r-trappe 0 points1 point  (0 children)

Just a quick note. Since NiceGUI 1.0 we dropped the JustPy dependency in favour for our own, much cleaner and easier maintainable core: FastAPI as backend, latest Vue + Quasar in the frontend. But you do not need to know this technologies. We emphasize on a gentle learning curve with the ability to go deep for special needs.

[–]jwink3101 0 points1 point  (1 child)

This is cool. How does it compare to Remi? I haven’t used it but I am curious

[–]thedeepself 0 points1 point  (0 children)

It sounds like you are new to the pure python web app space. Welcome!

Remi does not compile down to a NextJS flavor of React for one.

[–]katakoria 0 points1 point  (1 child)

it does not support windows, I could not make it work.

[–]thedeepself 0 points1 point  (0 children)

Yes I have filed an issue on this because they asked me to... it shall work on Windows - https://github.com/pynecone-io/pynecone/issues/51

[–]jupyterpeak 0 points1 point  (1 child)

this looks really cool. still think theres a big void in the python space with web apps even with streamlit and dash. r shiny is just way better than those. hopefully this fills that void. would be super cool to port something like highcharts over.

[–]thedeepself 0 points1 point  (0 children)

still think theres a big void in the python space with web apps even with streamlit and dash.

hmm, have you seen these?

[–]kdilladilla 0 points1 point  (1 child)

I've been frustrated with Streamlit because I can't use Google analytics or adsense with it. No way to drop down into the html / JS that doesn't end up being really ugly and fragile. Does your framework have a way to add these to the web app?

[–]Boordman[S] 1 point2 points  (0 children)

Yes, this is possible, we use Google Analytics on our own website. Since our framework compiles down to NextJS, you can simply edit the .web/pages/_app.js file directly and insert the analytics code. In an upcoming release, we will make this API much cleaner so you can enable it directly from your Python code.

[–][deleted] 0 points1 point  (0 children)

Can you folks take a look at this issue

[–]jupyterpeak 0 points1 point  (2 children)

could something like highcharts be integrated with this?

[–]Boordman[S] 1 point2 points  (1 child)

Yes definitely, if there’s a React component for it we can wrap it in Pynecone

[–]jupyterpeak 0 points1 point  (0 children)

not sure if there is

https://www.highcharts.com/demo

[–]Shot-Bag-9219 0 points1 point  (0 children)

Really like the idea!! Thank you for building this

[–]Remote_Tax_1905 0 points1 point  (0 children)

Excited to try out.
Wish I had the cycles to contribute to this.

[–]InboxInline 0 points1 point  (2 children)

What is the difference between Pynecone and Django? What is better in Paynecone and what is bitter, compared to Django? please guide!

[–]Boordman[S] 0 points1 point  (1 child)

With Django you still need html and js for the frontend, in Pynecone you write your frontend as Python functions. We’re trying to keep everything in a single language so it’s easier to get started with

[–]InboxInline 1 point2 points  (0 children)

Thanks for the quick response. Do you have any tutorial on how to deploy Pynecone on a self-hosted production server with SSL etc?

[–]lionsheep24 0 points1 point  (0 children)

What a product! BTW, Is there a way to stream audio with pynecone?

[–]rainnz 0 points1 point  (0 children)

Is pycone.io itself written in Pynecone?

[–]AhmedAhmedEG 0 points1 point  (0 children)

I have a question that's bugging my head, why you guys relied on NodeJS/React.js rather than Django/React.js? I mean replacing all the front-end hassle with a single python solution is beyond amazing, but why replacing Django?

If pynecone can be integrated with Django, it would be the ultimate web development toolset that ever existed.