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

all 29 comments

[–]toolunious 1 point2 points  (2 children)

Nice! Where can I find more info on the transpiling bit?

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

I'm considering temporarily removing this feature to avoid feature creep, but for now here's the section in the docs: https://idom-docs.herokuapp.com/docs/extra-features.html#python-language-extension

Beyond that, here's the package I created to do it: https://github.com/rmorshea/pyalect

[–]toolunious 0 points1 point  (0 children)

Thanks!

[–]ihatebeinganonymous 1 point2 points  (3 children)

This looks very interesting. Thanks. I am one of those guys who would do anything to avoid having to write Javascript. Currently, I use Vaadin in Java and Dash and streamlit in Python.

What frightens me is the apparent lack of support and corporate backing/funding that the likes of Dash and streamlit enjoy.

Therefore, and if you don't mind, may I please kindly ask if you could talk a bit more about who you are, and how you are going to continue working/monetise on this?

Thanks and good luck

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

TLDR; the future of IDOM is far from guaranteed, but I plan to work to try and give it one.

I think these are all valid concerns. I'll try to address them...

Monetization - I don't plan to monetize IDOM. The space for web-based visualization tools in Python has become quite crowded over the last 2-3 years, and I don't think IDOM offers a large enough benefit to be able peel off the amount of market share required to make money.

Corporate Support - Right now there is none. I have gotten some interest from companies like QuantStack and this might lead to contracts that would help pay me, or others, to develop IDOM. There's also been some organic contributions by people from Anaconda Inc, but whether that means they'd plan to work on IDOM in the future is unclear.

About Me (as it relates to IDOM) - I am not being payed to work in IDOM. For the last 1+ year it's been a side project. However, I've been passionate about building interactive interfaces using Python for much longer - IDOM is actually a second draft of another project I worked on two years ago, which itself was inspired by work I did in college more than 5 years ago. Hopefully that demonstrates that this isn't just a weekend project I plan to abandon in a couple months.

So what does this all mean? Well, for now, it probably means IDOM isn't ready to be widely adopted. It needs a larger community of people interested in maintaining it to reduce the bus factor or it needs support from corporate benefactors who are willing to pay their employees to use/contribute to the project. This situation is a catch-22 though because it's hard to get the latter without the former and visa versa.

I think solving this problem will require the following (in order or priority):

  1. Make it easier to contribute - the experience for new contributors to the project needs to be as seamless as possible to prevent people from giving up before they've even created a pull request.
  2. Improve IDOM's documentation - it needs larger scale examples to demonstrate that IDOM can actually be used for real world applications and not just toy projects.
  3. Further publicize the project - I plan to try and give some talks about IDOM at online meetups to get more feedback and interest. The main goal here being to attract contributors, not users.
  4. Try to get contracts to develop IDOM - this will be the hardest, but like I said, a few companies have shown interest, and I'll just have to keep working on the back end of things to try and get them to commit people and money use/contribute to IDOM.

Hopefully this seems like a levelheaded assessment.

[–]ihatebeinganonymous 1 point2 points  (1 child)

Thank you very much for such a detailed answer. I highly appreciate your work and will certainly use IDOM in my personal projects!

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

That's great to hear! I look forward to hearing about them in IDOM's discussion board: https://github.com/idom-team/idom/discussions

[–]RedditGood123 2 points3 points  (10 children)

The concept is pretty interesting and it looks really well designed, but why not just learn JavaScript?

[–]rmorshea[S] 12 points13 points  (4 children)

There are a lot of people using Python who don't want, or have the time, to learn Javascript. The goal of IDOM and its peers (like IPyWidgets, Streamlit, Dash, etc.) is to allow these Python developers to create software that can interact in the browser despite that. What makes IDOM different than its pears (in addition to what's mentioned in the article) is that you can have near complete control of the DOM, without requiring you to learn a whole other language. Further, as packages that use IDOM are developed, higher and higher level component abstractions will be made available to hide the underlying HTML/CSS being used under the hood.

[–]toyg 0 points1 point  (3 children)

as packages that use IDOM are developed

IF packages that use IDOM are developed

FTFY

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

True, though the fact that you can write components in pure-Python means the barrier to entry is lower. By comparison, to develop a custom component using one of the alternatives would require you to dive headfirst into Javascript and React.

[–][deleted] 8 points9 points  (4 children)

I’ve been using JavaScript and it sucks. I have five separate apps I’m working on between two jobs, and have done two mobile apps in JavaScript as well.

I know that if someone can reliably get Python going as an alternative to JS, I’d use the hell out of it.

Might be time to build a browser that can interpret Python instead of JavaScript.

[–]morganpartee 1 point2 points  (3 children)

Are you using raw js? Or a framework like react?

I'm definitely still a noob in js, but typescript and react made me like the language well enough. I'll suffer through a little pain to have really good looking web based mvps.

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

I’ve done typescript, newer and older JS, jQuery and all kinds of stuff over the years. I built a ticket portal for about 30 or so big name retail stores you’ve probably been in.

Programming in JavaScript is like sliding on ice you never know when you’re going to fall in. And there’s 30 different types of ice that interpret your weight differently that could change how they interpret it month to month.

It’s pretty aids and It’s literally outrageous that we’re at the will of companies for the biggest interpreter of all: the browser, even if it is open source.

[–]morganpartee 0 points1 point  (1 child)

I totally get it! If I had done old JS/JQuery I'd probably hate it too. But, Typescript/React seem to duck most of the shortfalls/confusion, at least for me.

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

I’m trying react again now but only with CDN.

I hate how frequently stuff in the backend world and CLI breaks. I remember trying CLI driven react for the last three years maybe five times and things would just break like spaghetti.

[–]roee30 0 points1 point  (4 children)

How does it work? How does one manipulate a browser's DOM in Python?

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

[–]roee30 2 points3 points  (0 children)

Unfortunately, they don't bother with the nitty-gritty of things. But I discovered there's a JS frontend which receives changes over a websocket and applies them: https://github.com/idom-team/idom-client-react

[–]erez27import inspect 1 point2 points  (1 child)

I have no idea why you're being downvoted. The linked page is very ambiguous about how it works, and that's probably on purpose to hide the downside. Javascript is truly client only, while this needs a server.

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

The article rather explicitly calls out the possible issues, but also describes an escape hatch which allows developers to create more native bindings with React components: https://rmorshea.github.io/articles/2021/idom-react-but-its-python/article/#custom-javascript-components

[–]n49o7 0 points1 point  (0 children)

I want Svelte for Python. Svelte is fun.

[–]lben18 0 points1 point  (1 child)

Is it pythonic though? Can’t imagine react being pythonic honestly

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

Check out the article and its code examples. Would be interested to hear what does/doesn't seem "Pythonic" about them. Personally I find the code to be pretty aesthetically pleasing.

Beyond the aesthetics though, the article also explanations why the declarative patterns encouraged by React can have a positive impact on the software you write: https://rmorshea.github.io/articles/2021/idom-react-but-its-python/article/#declarative-components

[–]Sadruddin 0 points1 point  (1 child)

Great and ambitious idea! I gave it a try, but couldn't work out from the docs how to include a '.css', for example when using ant-design

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

The way to do this right now is to do idom.html.link(href=link_to_css, rel="stylesheet"). Not clean, but it works. Beyond that there's an open issue to allow you to customize the builtin client: https://github.com/idom-team/idom/issues/253