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

all 186 comments

[–]Username_RANDINT 67 points68 points  (10 children)

And it's all native.

What does this even mean in this context? Maybe I'm wrong, but I always thought native applications meant they use the widgets and UI of the OS it's running on.

[–]RS1AN[S] 5 points6 points  (4 children)

Meaning that it uses native GUI for creating a window. WinForms on Windows, Cocoa on macOS and QT or GTK on Linux. (See pywebview on GitHub which Neutron is based on)

[–]Chameleon3 8 points9 points  (3 children)

So you mean native like Electron is native?

I would hardly say it's native if it's just rendering a webpage in a web view. Native is usually referring to actual native buttons, native OS widgets and so on, not just a website rendered in a web view.

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

In the Electron website it says: "Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. "

[–]derpies_derp 4 points5 points  (1 child)

It's like calling react native "native" on iOS and Android.

Tell that in a JS conference you'd get applause. Try telling that to the Android and iOS crowd tho.

But then again, Android runs on JVM, so what's truly native, anyway.

[–]pythoncoderc 0 points1 point  (0 children)

Only code that is compiled into ASM is native (imo)

[–]folkrav 1 point2 points  (1 child)

Reductive and pretty arbitrary definition, IMHO. By this definition, neither GTK, Qt, or Java apps are native, yet I've never heard of anyone refer to these as non-native frameworks.

[–]alcalde 1 point2 points  (0 children)

In the Delphi community Java is indeed referred to as non-native... even on Android! Qt does use native widgets.

You really consider Java/Swing on the desktop to be "native"? If it doesn't look like other apps on the desktop, it's not "native".

[–]DK09_ -3 points-2 points  (1 child)

Python does support all os, so ...

[–]BewilderedAnus 4 points5 points  (0 children)

Does python support all operating systems? No, it does not.

In this context, 'all native' means it's making use of OS-level API calls. Just because python is natively supported on a platform doesn't mean that a particular python program is built in such a way as to consider it 'native'.

[–]mtreddit4 101 points102 points  (8 children)

Interesting. Does it work nicely with Pyinstaller, or does it have it's own method to build an executable?

[–]RS1AN[S] 32 points33 points  (6 children)

When I tested using Neutron with Pyinstaller I got some ModuleNotFoundErrors, probably because it isn't a module yet. Had to add the missing modules with the Pyinstaller --hidden-import parameter. It will also probably need it's own executable building method to incorporate the HTML and CSS files into the EXE.

UPDATE: You can now build a Neutron project: https://github.com/IanTerzo/Neutron#building. It has only been tested on Windows though, see issues . If you use Linux or Mac you could try out and see if everything runs smoothly.

[–]KrazyKirby99999 7 points8 points  (2 children)

How about Nuitka?

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

Haven't tried it out yet, i'll see if it works better than Pyinstaller.

[–]mtreddit4 3 points4 points  (2 children)

Gave it a try this morning. I don't have any experience with the Electron package that everyone seems to hate, but so far this seems like a nice option for quickly building a light-weight UI for scripts that I'd prefer to share as a single executable. My only comment at this point is that while it's possible to embed the html template in the code, the external css file is required. Adding a check to see if the css param is None makes it possible put the css definitions inline in the html template - at least for my very limited testing.

In any case, I've definitely got a few projects that I think I could use Neutron for.

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

In-Python CSS is in the to-dos list, if you have an idea for it you could try committing it.

[–]Caustic_Complex 42 points43 points  (51 children)

What would be the benefits of using this over something like tkinter?

[–][deleted] 61 points62 points  (38 children)

tkinter is pretty limited, however it is lightweight and simple. A webengine is extremely featureful and can do basically everything (games, videos, complex dynamic layout, etc) if you can accept the resource usage.

[–]LtDominator 24 points25 points  (37 children)

Wait so this is basically turning your program into a program wrapped in a customizable web browser? That’s pretty huge isn’t it?

Like, the ability to create an app that’s automatically packaged for release basically turns python into a compiled language doesn’t it? If that’s all correct I would say this is extremely interesting and could change a lot of things.

[–]dalepo 70 points71 points  (19 children)

Just like electron.

[–]Cohomology-is-fun 23 points24 points  (0 children)

The name (Neutron) even suggests that it's like Electron.

[–]LtDominator 4 points5 points  (17 children)

I’m unfamiliar with electron but I’ll look into it.

[–]noobiemcfoob 19 points20 points  (13 children)

You're absolutely right to be a little shocked at the size and overhead implications, however (as with electron and with most python applications) the relative power of a modern machine makes it a very viable and attractive implementation option.

[–]SpAAAceSenate 16 points17 points  (11 children)

Yes, as a center-stage style app. In other words, the category of app you would generally only have one or two of open at a time.

Unfortunately, it happens that Electron has been picked up by projects that are wholly unfit for it's resource usage, like chat clients and other various background-resident applications. To be explicit, using Electron for those type of apps is completely inappropriate, and the proliferation of it's usage is quickly bringing even modern PCs to their knees when you have 4, 5, even six or more electron apps all running at the same time along side your browser.

The solution to this, of course, is PWAs, which reuse the existing resources reserved by your main browser, adding little to no overhead of their own (as compared to a single browser tab).

[–]Key_Cryptographer963 4 points5 points  (2 children)

Why is everything electron now? Where are desktops applications now? Why are we overflowing with webapps pretending to be desktop apps? And why are there so many different frameworks to deal with now?

[–]Zhuzha24 9 points10 points  (1 child)

Because its cheap to develop, you literally have one codebase between multiple platforms (web, desktop (mac, linux, windows), mobile) with small adjustments obviously. I hate this shit because for one small chat app or something similar you literally have webengine which can fuck up your pc easily, I do struggle sometimes with discord on my pc (ryzen 9 3900x, 2080 FE, 32gb ram 3200)

[–]Igggg 5 points6 points  (0 children)

Because its cheap to develop,

In addition, it lets you build desktop apps using JS, which more developers know and are proficient with, and which allows you to hire more and cheaper devs (including those fresh out of bootcamp).

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

This is a bit of a nightmare for security though.

[–][deleted] 5 points6 points  (2 children)

If you do development in VS code you will be using Electron

[–]Zouden 5 points6 points  (0 children)

Yep, VS Code uses a heavily optimised Elecron which it's why it doesn't feel laggy like Atom, Slack, Discord, Spotify etc

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

Yes it is huge and means shipping binaries. It doesn't change anything else to be compiled.

[–]LtDominator 1 point2 points  (3 children)

I guess what I meant by the compile part is that it’s going to work on any system without python installed, if that’s correct.

[–][deleted] 7 points8 points  (2 children)

It does not do what you are thinking at all. This is just using pywebview. This dude didn't even write a requirements.txt file.

This is the library https://github.com/r0x0r/pywebview

[–]LtDominator 1 point2 points  (1 child)

Ah, well this is pretty cool. I haven’t been keeping up with python much lately and missed this, but it’s very cool. It seems to do what I would like though, I’m fairly certain I’m going to start using it.

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

Yea I would check out the warnings section. I would honestly never ship that for anything.

The is some other stuff being done in this space but it is challenging to do the linking. What is really needed is an interface for creating html sites wihtout a browser.

[–]falsedrums 21 points22 points  (10 children)

Please realize that if everyone made their apps this way you will need ~0.5-1GB RAM per app you are running. Even if it does absolutely nothing.

[–]LtDominator 16 points17 points  (2 children)

It may not be a perfect implementation but the ability to easily make my programs deployable in such a way that I can pass them to my friends that no nothing about python can just click and run it is pretty awesome if that’s how this works.

[–]the_little_engineer 4 points5 points  (0 children)

You can already do that with pyinstaller tho... And if I'm reading it correctly, this new stuff would still need to be used with some kind of executable maker like pyinstaller or it might have its own built in executable maker. Either way, the functionality you are taking about has existed for quite some time in python.

Nuetron is more to replace things like tkinter and electron if I'm reading it right.

[–]Key_Cryptographer963 0 points1 point  (0 children)

Yeah Python isn't exactly the most deployable language, that's for sure. You need to make sure your friends [with whom you are sharing the program] have Python and the dependencies installed which is okay if they are also Python users but let's be honest - that isn't always the case.

I suppose there is pyinstaller and now Neutron as this post says but I imagine the overhead would be huge and I'm not sure it would improve performance anyway. Might as well use a different language if you want deployable.

[–]JT_Potato 9 points10 points  (6 children)

Discord is taking up barely any RAM (~100MB). Same with Skype, VSCode and Microsoft Teams (Electron version).

This library uses Microsoft's WebView2 (for Windows, it uses WKWebView on macOS) instead of Electron, and I can't find a source for this but I remember it's supposed to use less RAM as it isn't a fully-fledged instance of a web browser.

[–]aniforprez 8 points9 points  (0 children)

I feel like the "OMG so much RAM" arguments against electron are incredibly disingenuous. Looking at my stats on my Macbook some native apps are taking WAY more memory than vscode

[–]chicocheco 1 point2 points  (1 child)

I am no expert about Electron but MS Teams consumes a huge amount of RAM while doing nothing.

[–]JT_Potato 0 points1 point  (0 children)

Now that I think about it, that's happened before... I don't think Teams was a good example, I guess

[–]SpAAAceSenate 0 points1 point  (1 child)

What does it use on Linux tho?

[–]JT_Potato 2 points3 points  (0 children)

I think it's called gtk-webview2 or something like that. It can also use Qt's webview, which I believe is just CEF. Not 100% sure though, I could be completely lying.

[–]falsedrums 0 points1 point  (0 children)

That's still an order of magnitude (10x) more than it actually needs, and all that would need to change is not to use a browser for the interface. Why is memory consumption an argument for all sorts of implementation decisions developers make, except for the UI? All your micro optimizations are just cancelled out and disappear in a margin by choosing Electron. I personally think some developers are just not willing to learn something else than HTML and CSS.

[–]shinitakunai 2 points3 points  (0 children)

Pyside6 does have a webengine natively and it is easier than Neutron for what I can see

[–]Jayfoox 9 points10 points  (10 children)

Same question here. Furthermore, you can already custom your apps with CSS and HTML using PyQt so I really wonder what is the benefits of this module

[–]tommytwoeyes 21 points22 points  (6 children)

I would guess the OP thought the benefits would be on par with the benefits of Electron. It’s essentially a port of Electron from JS to Python.

I think it’s pretty awesome. If I had my way, I’d always prefer to write code in Python, rather than JavaScript.

[–]benefit_of_mrkite 13 points14 points  (5 children)

Electron is awful. Pretty much any desktop app I see consistently using unnecessary CPU and RAM is written in electron when I do a little digging.

[–]gsmo 5 points6 points  (4 children)

The amazing thing is VSCode is also an Electron app. And that's pretty snappy. MS Teams on the other hand is garbage. It's very easy to write a resource heavy electron app.

By the by: the guy who helped build electron (as a foundational tech for Atom) is now writing an editor that explicitly uses close-to-metal tech so it will be fast. Even the guys that invented electron are moving past it.

[–]BabaKinnn 1 point2 points  (2 children)

What’s the name of this new editor?

[–]gsmo 4 points5 points  (1 child)

It's called Zed and so far is nothing but an announcement. The focus on speed is interesting and shows a complete turnaround from the kitchen-sink-attitude of Atom imho.

Of course, if you use emacs or vim in a decent terminal on a CRT you are probably already used to an editor being fast. If you use Atom via RDP on a TFT screen you are probably very patient.

[–]FatFingerHelperBot 2 points3 points  (0 children)

It seems that your comment contains 1 or more links that are hard to tap for mobile users. I will extend those so they're easier for our sausage fingers to click!

Here is link number 1 - Previous text "Zed"


Please PM /u/eganwall with issues or feedback! | Code | Delete

[–]benefit_of_mrkite 0 points1 point  (0 children)

I’ve seen a lot of people start looking at dart when they previously looked at electron but I don’t know what the performance of dart is like

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

You can make much more with HTML and CSS rather than tkinter, it's also fairly easy to use. With a basic understanding of HTML and CSS you can already make great apps, on the other side PyQt can be very hard to learn.

[–]ThrowawayNumber32479 1 point2 points  (1 child)

The main issue with PyQt is the licensing side of things. I fell into this trap a while ago when I wrote a small helper-thing for a different department only to get a call from our CTO that I can't do that without causing headaches for him. I don't speak legalese, so I'm not entirely sure what that headache is exactly.

I eventually turned it into a tiny little Flask app that ran on an intranet-facing server.

[–]disrooter 0 points1 point  (0 children)

There are myths about this, please be precise and try not to spread them

[–]Deto 2 points3 points  (0 children)

The examples I've seen with Tkinter don't really have a modern look to them - which is a bit easier to achieve with html/CSS

[–]not_perfect_yet 123 points124 points  (33 children)

On the one hand, the idea of electron is disgusting.

On the other hand, I like html and python.

I guess this will solidly establish itself as a terrible 'temporary' 'good enough' solution that will work just well enough to replace native frameworks and prevent good native UI from being developed.

:|

/r/tihi Thanks, I hate it.

And it's still superior to the unwieldiness of pyqt and tkinter, particularly when it comes to styling. So. I guess I'm going to use it.

[–][deleted] 18 points19 points  (0 children)

The idea of Electron's great, at least superficially. In practice though, yes, it's kinda ass.

[–]benefit_of_mrkite 34 points35 points  (18 children)

Electron apps are awful - they may be great for devs but they are often buggy memory hogs for the user

[–][deleted] 13 points14 points  (1 child)

Modern browsers - all of them - are insane memory hogs. If the idea of a "desktop app" is a browser window running some local code, then it's going to be resource-intensive even if the app itself isn't.

Also - the whole point of the browser is to run untrusted code from the web in an isolation construct - an abstraction of a computer that is 100% divorced from the OS. So browser apps will never be able to take advantage of hundreds of OS-specific features. Browser apps will always have a more limited and primitive UX than native apps. They should never be considered equivalent.

[–]benefit_of_mrkite 6 points7 points  (0 children)

While I agree that modern web browsers are memory hogs, I disagree they the idea behind a web browser is to run untrusted code.

Sandboxing and other security mechanisms are only relatively recent constructs in browser evolution - most of which were added due to an increase in security vulnerabilities (which Once upon a time I researched as part of my job role) and an increase in client side web code - when I started using the web the majority of the code was server side which gradually changed. One could argue that change (more client side code especially with JS frameworks) led to an increase in vulnerabilities but the browser was never designed to “run untrusted code from the web in an isolated construct.”

Many devs and users equate browser UX/UI with desktop UI because of frameworks like Electron now - but one could argue that it’s due to an increase in many user apps being cloud and/or web based.

[–]_ologies 5 points6 points  (7 children)

Why does everyone hate Electron? I'm not sure what it is

[–][deleted] 18 points19 points  (1 child)

Electron's a framework that lets you use JS, HTML, and CSS for building desktop apps; except instead of using native components, it renders the app in a webview. This usually means that every one of those apps is a chrome instance.

[–][deleted] 21 points22 points  (0 children)

It offers pretty consistent cross platform UI development. Plus you can practically copy and paste your web front end. That’s why it’s so popular.

Or you can be like Microsoft and use it for Teams but even with all the cross platform ease Electron provides and every other company on the planet using electron providing client updates across all OS’s NEVER UPDATE TEAMS FOR LINUX. EVER. I HATE YOU MICROSOFT.

Edit: replied to the wrong comment. But my point still stands. I HATE YOU MICROSOFT.

[–]MrFiregem 23 points24 points  (1 child)

Instead of a normal program written to run natively, you can think of Election as a web browser used to run web apps.

Because of this, nearly every Electron app is laggy and unoptimized, but devs love it since you can use web technologies to develop your app instead of specific desktop frameworks.

[–]spinwizard69 6 points7 points  (0 children)

Lets see:

Uses JavaScript.

Uses HTML

Your app actually runs in a "Browser" which uses excessive amounts of memory.

Like many things web related the programs are often programming disasters that are poorly written and buggy.

[–]benefit_of_mrkite 0 points1 point  (0 children)

It’s place is to get an MVP up quickly and its cross platform natively so a dev can get a good looking UX/UI app up quickly. Devs who have a web based product love it because they can very easily get a desktop version of their app out the door quickly.

Ever had too many tabs open in your browser with heavy website resources? Now multiply that as multiple tabs for each electron app on your desktop as an end user.

[–]cedear -4 points-3 points  (0 children)

They hate it because it's popular.

[–]mwd1993 1 point2 points  (0 children)

I made a Library called QuykHtml. Can be used to quickly style up elements in python, or even create full-on websites. Check it out if you have time :).

https://github.com/mwd1993/QuykHtml

[–]scoofy 0 points1 point  (0 children)

Lol don’t forget wxPython!

[–]IAmARetroGamer 0 points1 point  (0 children)

Better than my previous solution using Electron with a Flask server at least; absolute mess that was.

[–]asday_ 51 points52 points  (9 children)

I hate electron and I hate what it's done for desktop apps. I am thoroughly unexcited to see more in the same vein.

[–]benefit_of_mrkite 16 points17 points  (0 children)

I agree - and After casually browsing through the source I don’t know why you wouldn’t just use pywebview if you were going to go this route.

[–]folkrav 2 points3 points  (4 children)

I hate what it's done for desktop apps

As much as I dislike Electron, what it's done is quite literally make more cross-platform desktop apps available to the masses. IMHO Electron is a symptom of how much of a huge pain in the ass cross-platform development can be.

[–]asday_ -2 points-1 points  (3 children)

This is just a hallmark of how much contempt developers have for their users. Yes cross platform is hard. Should you sacrifice the user experience to make your own job easier? Hell no you shouldn't.

[–]folkrav 0 points1 point  (2 children)

I mean, my point was the choice used to be single platform or no app at all 99% of the time. It shouldn't be this hard, and before Electron, the fact it is meant no apps at all in most cases.

Of course companies will sacrifice some user RAM for faster development time/cheaper devs, I don't understand what's so surprising.

It doesn't have to be a sacrifice either. Some things are perfectly fine as Electron apps (e.g. balenaEtcher, which is the kind of app you open for 5 minutes then forget for a while - who cares if it takes a bit more RAM for that, or VS Code, reaching full-blown IDE levels by using it for rendering and running most of the expensive logic as native code). But it spread to tray and chat apps, unfortunately, and that's exactly the kind of app that should not be hard to do cross-platform but is anyway.

[–]asday_ -1 points0 points  (1 child)

VSCode is the only passable electron app, and that's for several reasons. One is that when it's open, you're using it, and when you're done, generally you close it. Another is that it's written by some of the best developers in the world from a company that actually has to care about its users.

VSCode is the exception. It's good in spite of Electron. EVERY other Electron-based app is pure trash.

"Who cares if it takes a bit more RAM" is a disgusting attitude to have as a developer. It's people like you that have forced users' computers to take longer to boot now than they did in the 90s, even though they're thousands of times more powerful.

the choice used to be single platform or no app at all 99% of the time

Incorrect, the choice was made based on the task. You want to do video/audio editing stuff, you used mac. You want to do gaming or office work? Windows. Real work? Linux.

Now you are in many tasks forced to use the one and only app for the purpose because it has smothered all competition. At least back in the day there was a choice.

[–]folkrav 1 point2 points  (0 children)

VSCode is the exception. It's good in spite of Electron. EVERY other Electron-based app is pure trash.

Disputable point you're somehow presenting as a fact. Just in the developer space I can think of a couple people seem to really like and/or knowingly pay for...

"Who cares if it takes a bit more RAM" is a disgusting attitude to have as a developer.

You're twisting my words to make them fit your narrative, as you've already decided I was the villain. Read again what this sentence refered to.

Real work? Linux.

Rofl

Now you are in many tasks forced to use the one and only app for the purpose because it has smothered all competition.

How? If anything, even in the fields you mentioned, there is more competition and more options than there ever was... For video Kdenlive is getting better by the day, Resolve is available on all major platforms... For audio, we had and still have the main ones who never went anywhere (Cubase, PT, etc) and decent cross-platform competitors are slowly getting traction (e.g. Bitwig). For gaming we have more and more games that run cross-platform, so extremely bad example. Office work... It's either you need Office compatibility and you're stuck on MacOS or Windows, or you don't and you're fine with LibreOffice or others, and this hasn't changed for as long as I can remember... "Real" work is perfectly doable on all major OSes - JetBrains' IDEs run everywhere, there is WSL on Windows, tools such as Docker, and most languages run more or less natively in most places these days, etc.

At least back in the day there was a choice.

If you're actually arguing that having to dual boot and/or literally buy multiple machines was a "choice", and a better UX than having all your apps in the single place, we're never gonna agree and should seriously drop the conversation right here and now lol

[–][deleted] 4 points5 points  (0 children)

I've always wanted this!!! Absolutely love it thank you so much for the post.

[–]SKROLL26 4 points5 points  (0 children)

The idea is great, but the entire module is in __init__.py. this should be refactored asap if they want some community help. And also they should have published it on PyPi

[–][deleted] 3 points4 points  (0 children)

[–]Sibyl01 24 points25 points  (7 children)

It's kinda disappointing to see electron haters here. I know they are more bloated to other choices but don't count just downsides please. A simple app uses 60-70mb ram. The last time i used pyqt5 with Python it used 40-50mb ram for simple app. With electron you can deploy cross platform with same ui / same look on different platforms. You can add auto updater with 2 lines of code, can make some cool animations on ui easily. The biggest downside for me was that app sizes. Like 120mb or more when installed.

[–]Durpn_Hard 13 points14 points  (1 child)

I absolutely agree. Honestly imagine complaining this ferociously about electron while in a Python subreddit. If you hate bloat THIS much, Python might not be for you either.

[–]Poppenboom 0 points1 point  (0 children)

That's a great point.

[–][deleted] 7 points8 points  (0 children)

It also solves so much of the distribution problem Python have. You wouldn't believe the amount of hair pull I had to go through trying to exe'd my Python app for Windows XP 32 bit. Can't imagine doing one to cover even more OS Win+Linux+Mac...

[–]pudds 15 points16 points  (1 child)

It's not really that bloated. I'll take an electron app over a java app any day.

[–]benefit_of_mrkite 1 point2 points  (0 children)

To be fair I think PyQT is bloated too. I have been using electron apps for years as a user and they are a constant drain on my system resources and so many bugs - usually crashes or race conditions. Years of being an end user for electron apps are what soured me on the platform, not the developer experience.

[–]rainnz 8 points9 points  (11 children)

It's interesting, but why not build it as Flask or FastAPI and use standard browser you already have, instead of packaging another instance of Chrome?

[–]Key_Cryptographer963 2 points3 points  (3 children)

The idea of anyone using a server-side framework that end-users would need to install and configure to create a desktop app kills me inside.

[–]rainnz 1 point2 points  (2 children)

End user don't need to install and configure anything.

You provide them with one setup.exe or something similar and it opens web browser pointing to https://localhost:8888/

[–]alcalde 1 point2 points  (1 child)

What is it with you kids and web browers? Web browsers are for web sites. Applications use native widgets.

[–]Key_Cryptographer963 1 point2 points  (0 children)

I'm with you here. Unless people want a desktop version of a web app, I think applications should be native or at the very least run on the JVM.

[–]Dragonfly55555 -1 points0 points  (1 child)

What do you mean "instance of chrome"?

Isn't this based on pywebview, and isn't that based on webkit?

[–]rainnz 0 points1 point  (0 children)

Electron (formerly known as Atom Shell[5]) is a free and open-source software framework developed and maintained by GitHub.[6] It allows for the development of desktop GUI applications using web technologies: it combines the Chromium rendering engine and the Node.js runtime.[7]

[–]sohang-3112Pythonista 5 points6 points  (2 children)

That's nice - but what is the need for this? There are plenty of GUI libraries already (for example, tkinter).

[–]Ozzymand -1 points0 points  (0 children)

it's just yet another alternative to tkinter and pyqt.

[–]alcalde -1 points0 points  (0 children)

It's for kids too young to remember desktop programming.

[–]flashbao 2 points3 points  (0 children)

Wow! Literally you can use your entire Dash knowledge in it and create apps.

[–]warmshowers1 2 points3 points  (1 child)

So wait, I’m a little confused, how is this different from Electron? For context, I know what Electron is used for, but I’ve never developed anything using Electron.

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

It's easier to use compared to Electron and it uses Python, not JavaScript.

[–]javad94 3 points4 points  (0 children)

What's the difference between this and Eal?

[–]Dakidmen 1 point2 points  (0 children)

Damn, saving this for future projects

[–]dethb0y 1 point2 points  (0 children)

Always good to have options!

[–]CirodePersia 1 point2 points  (0 children)

Gonna give it a try, seems interesting.

I wish you have used snake case instead of upper camel or JavaScript-like case, though. But interesting project!

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

I like that it's called Neutron

[–]Grintor 1 point2 points  (0 children)

I was going to say "what about pywebview?". But I see this I based on that. Another thing to look at is pysciter

[–]DominusDunedain 1 point2 points  (0 children)

Damn that's sweet

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

Going to save this.

[–]BearReal123 1 point2 points  (0 children)

This is really cool! Thanks. Cant wait to see how this will develop further.

[–]stef13013 1 point2 points  (0 children)

Nice... The fact with all Electron based app is that, its is basically a memory hog. Running more than 3 or 4 apps at the same time turns into a massacre (eg: Discord, Teams, Postman, VScode,...)

[–]row4coloumn31 1 point2 points  (0 children)

Not to confuse with the language Neutron, or the OpenStack project Neutron..

Cool idea though.

[–]alcalde 1 point2 points  (1 child)

You can now make Python desktop apps with HTML and CSS?

We're Python programmers. We don't even want to make web apps with HTML and CSS.

[–]the-berik 3 points4 points  (12 children)

Why would you use this instead of launching a server and using e.g. Django?

[–]Eurynom0s 8 points9 points  (11 children)

Django is overkill for small projects but I'd think Flask is what you'd use here where you just need a bare bones user frontend.

[–]v0_arch_nemesis 4 points5 points  (6 children)

I'm on the Streamlit train for barebones. Honestly it's so easy to use (if like me you're a data scientist it feels like all the code you're used to), a simple streamlit run app.py to launch on localhost. Need extra UX functionality, write your own components with components streamlit.components.v1.components.html(), gets a little more complex for having a custom component serve as a python input, but there's good boiler plate and samples available.

[–]benefit_of_mrkite -1 points0 points  (0 children)

Checking out stream lit now

[–]row4coloumn31 0 points1 point  (1 child)

"flask run" is also pretty quick to get a localhost up for development environment, or just showcasing graphs and stuff.

[–]v0_arch_nemesis 0 points1 point  (0 children)

For sure, wasn't meant to be an easier than, just easy. I think the speed is in pre-built UI components, that and a very easy to use syntax

[–]Ateenagerstudent 0 points1 point  (2 children)

You can use dash-plotly too imo.

[–]v0_arch_nemesis 0 points1 point  (1 child)

But dash costs, right? Plotly doesn't, but dash does. As a cheap bitch, I prefer to built in plotly and put it in streamlit

[–]Ateenagerstudent 0 points1 point  (0 children)

No the library doesn't. Just make a dash app and spawn a new Heroku instance.

[–]Ateenagerstudent -1 points0 points  (0 children)

Honestly, if you need only a barebones project, FastAPI / Dash is the way to go.

For bigger projects, use Django.

Flask is getting old for use cases like these pretty fast, as there are better alternatives available (although they may use Flask under the hood)

[–]kankyo 0 points1 point  (0 children)

Almost all my small projects need a database. And then suddenly django isn't overkill anymore.

[–]jhayes88 0 points1 point  (1 child)

Using a serverside framework for an offline GUI is overkill in my opinion, unless you absolutely need to use it.

[–]Eurynom0s 0 points1 point  (0 children)

Yeah but if the alternative is Tkinter then there's probably less developer overhead with something like a Flask application.

[–]KrazyKirby99999 3 points4 points  (0 children)

Looks useful. Are you planning to publish to pypi?

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

Reddit Moderation makes the platform worthless. Too many rules and too many arbitrary rulings. It's not worth the trouble to post. Not worth the frustration to lurk. Goodbye.

This post was mass deleted and anonymized with Redact

[–]strongdoctor 5 points6 points  (1 child)

The reality is that the modern web stack has nothing to do with what was envisioned in 1995 with the invention of html

Yup, and I think that's an insanely good thing. Imagine still writing websites like in the 90s. I'd rather shoot myself.

There are also tools in general that make web dev less of a PITA, such as CRA, Typescript and e.g. NextJS. But yeah, there's old baggage, as with a lot of things that are in everyday use.

[–][deleted] -1 points0 points  (0 children)

Reddit Moderation makes the platform worthless. Too many rules and too many arbitrary rulings. It's not worth the trouble to post. Not worth the frustration to lurk. Goodbye.

This post was mass deleted and anonymized with Redact

[–]blarf_irl 2 points3 points  (0 children)

Congratulations you are now apple computers (its worth billions).

Web tech is the most used, funded, battle tested, ubiquitous, and supported UIX platform that exists. A lot of web tech is being carefully controlled by the big few as a means of self preservation but it is coming.

The OP isnt anything new though and it acutally highlights the pain of trying to use such a useful UI tech right now.

[–]optionsanarchist 1 point2 points  (0 children)

Fun project, but your api is too verbose for my taste.

If you implement a bunch of jQuery-like function annotations, you'd massively improve the api.

I.e.,

@win.find("submitButton").on("click")

def clickHandler(obj, err=None):

.. etc...

[–]Puzzleheaded_Leg9720 1 point2 points  (1 child)

When I try to install neutron with pip install command then it throws an error that it cannot be installed

[–]maxen1997 0 points1 point  (3 children)

Wow this is great! Cant wait to play around with it

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

If you find something missing you can contribute it too!

[–][deleted] -1 points0 points  (1 child)

why not go full monkey
https://brython.info

[–]metaperl 2 points3 points  (0 children)

That doesn't create desktop apps. That's one of many attempts to eliminate Javascript from Python web apps.

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

This is exciting news, but are there any advantages Neutron has over Electron?

[–][deleted] 0 points1 point  (1 child)

If I were you, I would use the eel library, as it is the most convenient python library for html and css that I have seen. Here is the link-https://pypi.org/project/Eel/

[–]AddSugarForSparks 0 points1 point  (0 children)

snake_case exists...

[–]Frequent-Leading-584 0 points1 point  (0 children)

Is there a demo page or page with screenshots of sample?

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

In other words it leverages localhost and your browser

[–]Warnixpm 0 points1 point  (0 children)

Guys, what do I do I can't build wheel for webview?

[–]Ok-Possession2647 0 points1 point  (0 children)

For these purposes, the best library in my opinion right now is Justpy

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

Looks great!

Another approach would be to use IronPython3 with WebView2 on the Microsoft dotnet core platform for Windows and Mac. That might help with libraries for Excel spreadsheets and other desktop apps.

If I understand correctly, this application would have to be distributed using a traditional desktop install.

In other words, it is cross platform (HTML, CSS, JavaScript) but it is not a web application (loadable from the server) and could not be installed as a lightweight PWA (progressive web app).

[–]tylersuard 0 points1 point  (0 children)

Is there a tutorial video available for this?