Better HN
topnewbestaskshowjobs
Log inSign up

willchen

252 karma · joined Mar 24, 2015 (11y ago) · 78 submissions

Submissions

31.

Comparison of Mesop with Streamlit and Gradio(google.github.io ↗)

3 points · by willchen · 2y ago · 1 comment

comment 2y ago · link · parent

Any particular parts that you feel are inadequate with web components? Web components aren't a panacea but they have definitely come a long way in the past decade.

comment 2y ago · link · parent

Thanks, yeah describing Mesop API as essentially a UI over RPC is a good analogy and is basically what's happening under the hood [1].

I guess one funny thing is that I actually identify as a FE developer more than a Python developer :) I've been doing FE for much longer than Python and agree that there's warts on both sides (and no language/ecosystem is perfect). For me, a lot of the FE fatigue comes from all the inherent challenges with developing client-side applications (e.g. the necessity of bundling/minifying for optimizing performance, transpiling for legacy browsers) so I don't say this to throw stones at the other side but simply to point out my own fatigue having dealt with this complexity for years.

Right now Mesop is definitely more focused on the demo use cases, but we're also trying to push the limits of the kinds of apps you can build in Python so it doesn't have to be something you throwaway when you want to deploy a scalable app.

[1] https://google.github.io/mesop/internal/architecture/#life-o...

comment 2y ago · link · parent

We posted on Show HN https://news.ycombinator.com/item?id=40567327 ~a month ago and got a ton of great feedback.

Since then, we've made a lot of updates to Mesop, including adding support for web components which allows you to write custom JS and wrap existing JS libraries.

We've also fully re-designed our home page at https://google.github.io/mesop - with many more code examples and demo, which hopefully shows how Mesop is different than some of the other Python UI frameworks out there.

As always, appreciate any feedback about the project. Thanks!

35.

Is Mesop and Web Components the cure to Front-end fatigue?(google.github.io ↗)

12 points · by willchen · 2y ago · 12 comments

comment 2y ago · link · parent

Thanks! I've used Google's internal version of Bazel but it wasn't until this project where I had to spend a lot of effort getting Bazel working in a new project, which is honestly a lot of work and not very straightforward :(

What helped me the most was looking at other projects using Bazel with similar tech stacks and then assembling it together, e.g. :

- https://github.com/angular/components - https://github.com/tensorflow/tensorboard

Alex Eagle of https://www.aspect.build/ has a lot of great resources on using Bazel - both on YouTube and the aspect website.

comment 2y ago · link · parent

Thanks! Yeah, a lot of innovation happening in this space.

comment 2y ago · link · parent

Good point, we'll try to rephrase this to be clearer. Thanks for the feedback!

comment 2y ago · link · parent

Thanks! Agree, we wanted to provide a high-degree of customizability with a CSS-like API https://google.github.io/mesop/components/style/ so you can create delightful demos.

comment 2y ago · link · parent

Thanks, I've filed an issue: https://github.com/google/mesop/issues/359

comment 2y ago · link · parent

There's similar things in other languages like https://www.gpui.rs/ and https://github.com/linebender/xilem.

Mesop also drew inspiration from frameworks like LiveView (for Elixir/Phoenix) https://hexdocs.pm/phoenix_live_view/welcome.html which have demonstrated the viability of building server-driven web UIs for a number of years now.

comment 2y ago · link · parent

Thanks for the question! Streamlit is definitely more mature and I think it's a great tool for many use cases.

Where I think Mesop shines is that you get a lot of flexibility, just by writing your UI in Python. For example, Mesop has an out-of-the-box [chat component](https://google.github.io/mesop/demo/), but if you need to customize it, you can actually just copy the [chat.py file](https://github.com/google/mesop/blob/main/mesop/labs/chat.py) and customize it however you want.

In comparison, Streamlit is great to get started with, but once you're trying to do some complex customizations, you'll often need to write your own React/TypeScript component.

I think the other thing is that Mesop has a [different philosophy for building UIs](https://google.github.io/mesop/blog/2024/05/13/why-mesop/) (e.g. based on functions) which results in a distinctly different developer experience. This is, of course, subjective, but I think the Mesop approach scales well as your app grows (e.g. thousands of lines), which even internal tools and demos oftentimes do.

comment 2y ago · link · parent

You can customize the UI quite extensively using our Style API https://google.github.io/mesop/components/style/

If you like tailwind, I think you will like this as it's essentially like writing inline styles, but with a Pythonic, strongly-typed API.

comment 2y ago · link · parent

Accessibility is important and the good thing is Mesop is built on Angular Material components (https://material.angular.io/components/) which has invested in supporting a11y. Mesop components are likely missing aria-* attributes, but it's pretty easy for us to add them (essentially plumbing them from Python into the Angular components), so please file an issue on our GitHub repo to let us know what we're missing, thanks!

comment 2y ago · link · parent

This is definitely something we've discussed and I think Python -> WASM is an exciting innovation. Right now, there's some challenges with how large of a WASM binary a typical Python app will compile to (e.g. bundling the std lib) and the initialization time [1].

I think supporting Python -> WASM could be one of the options we support, but there's probably always a need to support Python on the server, simply due to the ecosystem (e.g. dependencies) that's around it.

[1] https://pyodide.org/en/stable/project/roadmap.html#reducing-...

comment 2y ago · link · parent

Yeah, I think the "simple things easy and hard things possible" is a good way of framing this. I've written a blog post about the design philosophy of Mesop and how it differentiates with existing frameworks: https://google.github.io/mesop/blog/2024/05/13/why-mesop/

Re: flet - flet intentionally takes a more imperative approach whereas Mesop embraces a declarative UI approach (as popularized by React, et al). I think the declarative UI approach scales better as apps get more complex, but I think the best way to see the difference is to look at some of the examples and see which approach you like more.

Re: nicegui - at the high level, there's definitely some similarities with the component-centric UI model. The data binding/state management works quite a bit differently and Mesop's approach provides stronger type-safety and, IMO, is more Pythonic, but that said, there's a lot of good options in this space and I think it's neat to look at all the innovation that's happening here, and ultimately, some of this is based on aesthetics and how you like to code your UIs.

comment 2y ago · link · parent

Might want to check out: https://flet.dev/docs/cookbook/packaging-desktop-app/

I haven't used it personally (this is separate from mesop), but it looks like a way to program desktop guis (among other platforms ( in Python

comment 2y ago · link · parent

OK thanks. I've filed an issue here: https://github.com/google/mesop/issues/345 if you could share with us a repro (the Mesop code you're running) on the issue, that would be helpful in debugging this.

If you take a look at the "table" example on the demo gallery: https://google.github.io/mesop/demo/ it shows how to use Pandas w/ Mesop, so I'm not sure what's going on.

comment 2y ago · link · parent

All the python code, including requests are executed on the server

Take a look at https://google.github.io/mesop/internal/architecture/ for an explainer on how the client-server interaction works and let me know if you have any questions!

comment 2y ago · link · parent

Could you share the error you're getting locally?

Re: calling backend, yeah you can use requests or anything else (e.g API client libs, talk to DB directly). The beauty is that you're just writing regular python code

comment 2y ago · link · parent

Yeah, you can definitely deploy it to share with others. Check out our deployment guide (https://google.github.io/mesop/guides/deployment/) which shows you how to deploy Mesop apps to Google Cloud Run, but you should be able to deploy it on pretty much any service that takes a container.

For example, the demo gallery (https://google.github.io/mesop/demo/) itself is a Mesop app which is hosted on Cloud Run

52.

Show HN: Mesop – Open-source Python UI framework(google.github.io ↗)

130 points · by willchen · 2y ago · 54 comments

comment 8y ago · link · parent

I think the problem with bundling chromium is that it wouldn't be evergreen, which means it doesn't have the latest security fixes, etc .

comment 8y ago · link · parent

I think the +1 button was a really nice feature and something they should've done a while ago, but it's hard to draw the line.

If everyone contributes their pet UI feature (e.g. custom theme, use XYZ monospace font), then there will be dozens of features that only 0.01% of users use, but it increases the overall complexity of the product and maintenance burden.

comment 9y ago · link · parent

A bit confusing that there's blue, underlined text that look a lot like links.

Perhaps this was posted too early and should actually link to more in-depth docs?

comment 9y ago · link · parent

Looks very exciting! I've used firebase for some small weekend projects and it's been very productive for me.

I'm curious, what's the react native support like for Firestore / firebase in general?

comment 9y ago · link · parent

Citation?

58.

Prettier now supports Typescript(github.com ↗)

2 points · by willchen · 9y ago · discuss

59.

Expo for React Native SDK v17.0.0 is now available(blog.expo.io ↗)

2 points · by willchen · 9y ago · discuss

comment 9y ago · link · parent

Very interesting DB service. If I'm reading the docs right it sounds like you can't do JOINs across documents?

https://docs.microsoft.com/en-us/azure/documentdb/documentdb...

123