[HN Gopher] Python and Qt simplified
       ___________________________________________________________________
        
       Python and Qt simplified
        
       Author : BerislavLopac
       Score  : 165 points
       Date   : 2022-03-27 10:17 UTC (12 hours ago)
        
 (HTM) web link (build-system.fman.io)
 (TXT) w3m dump (build-system.fman.io)
        
       | BlueTemplar wrote:
       | And for those who would need Python and Qt "complexified" :
       | 
       | https://www.pyqtgraph.org/
       | 
       | > PyQtGraph is a pure-python graphics and GUI library built on
       | PyQt / PySide and numpy. It is intended for use in mathematics /
       | scientific / engineering applications. Despite being written
       | entirely in python, the library is very fast due to its heavy
       | leverage of NumPy for number crunching and Qt's GraphicsView
       | framework for fast display. PyQtGraph is distributed under the
       | MIT open-source license.
       | 
       | [...]
       | 
       | > Packaging for Distribution Applications written with pyqtgraph
       | may be packaged as Windows exe files using py2exe or OSX dmg
       | files using py2app.
        
       | dukeofdoom wrote:
       | Can this be used to install a pygame game?
       | 
       | I've used Inno Setup for installing software on Windows before.
       | It's free and works great. I've never tried installing python
       | with it. But I did find a tutorial how to do it.
       | 
       | https://www.geeksforgeeks.org/convert-python-code-to-a-softw...
        
       | jollybean wrote:
       | Anyone care to comment on 'Why Python'?
       | 
       | Javascript is quite commonly established as a good UI language
       | these days, and I assume that anyone who can write Py can write
       | Js.
       | 
       | Is there something particularly useful about Py, i.e. perhaps
       | researchers who know Py may not want to bother to switch? Or that
       | it integrates better with some things? Or that it's used widely
       | at a company and investing in a second language is a big deal?
        
         | uranusjr wrote:
         | My guess is it's because PyQt. AFAIK there's not a JS binding
         | (or any other language really) for Qt that's nearly as
         | established and steady. If you're going with Qt, Python is the
         | most reasonable choice (other than native C++ of course).
        
         | bscphil wrote:
         | What libraries should I rely on to create cross-platform native
         | (or native-approximating) UIs in JS?
        
         | digisign wrote:
         | Historically it was a much more productive choice, than just
         | about anything. Today it's merely an arguably more productive
         | one. In any case it remains a good choice, and one of the most
         | popular languages.
         | 
         | Despite years of FUD from the likes of Microsoft and others,
         | "investing in a second language" is not a big deal at all and
         | just short of required for projects of any complexity.
        
         | pacifika wrote:
         | A preference for developing in Python.
        
       | spdegabrielle wrote:
       | This should not be this hard or expensive. Racket can do this out
       | of the box. I'm _sure_ there are better ways to do this in
       | Python.
        
         | nopenopenopeno wrote:
         | I used this project once and it was a huge distraction. It also
         | ended up making us have to pin the whole project to python
         | version 3.6 when 3.9 was out because it wasn't sufficiently
         | maintained itself.
         | 
         | It was much more sustainable and maintainable to just write our
         | own build scripts for each platform with template tags and
         | automate from there.
        
         | brnt wrote:
         | I'm a satisfied user of cx_Freeze in combination with Qt, but I
         | only build Windows installers, so YMMV.
        
           | scarygliders wrote:
           | I used to use cx_freeze but started having problems with it
           | which I can't remember offhand.
           | 
           | I switched to PyInstaller - see my comment at
           | https://news.ycombinator.com/item?id=30820723
        
       | lrem wrote:
       | I already have a Qt app I would like to package now
       | (https://github.com/lrem/FastCull). Would fbs be something to
       | look into, or should I investigate some alternative at this
       | point?
        
         | mherrmann wrote:
         | I created a Windows installer of FastCull for you.
         | 
         | Screenshots:
         | 
         | Installer: https://imgur.com/a/2zQEwMS
         | 
         | Application (on the right): https://imgur.com/AYhholl
         | 
         | Download link for the installer:
         | 
         | https://fbs.sh/mherrmann/FastCull/FastCullSetup.exe
         | 
         | My code changes are in https://github.com/mherrmann/FastCull/.
         | You need fbs Pro because you are using PySide6.
        
       | Thales wrote:
       | Free fbs doesn't work with recent versions of python (>3.6) [0].
       | You need to pay or migrate. This can lead to security issues
       | because recent packages don't always work with older python
       | versions.
       | 
       | [0] https://build-system.fman.io/manual/#requirements
        
         | j1elo wrote:
         | I think the correct link would, as of right now, be to the
         | Requirements section:
         | 
         | https://build-system.fman.io/manual/#requirements
        
         | brnt wrote:
         | This. Python 3.6 is out of support now, 3.11 is about to be
         | released. It's not really usable anymore.
        
           | dr_zoidberg wrote:
           | Not just on this project, but I've seen a few more not moving
           | past 3.8 for support and I don't quite get why that's been
           | happening. Did something happen on 3.9 or later that didn't
           | caught my eye?
        
             | gadrev wrote:
             | Maybe it's because Ubuntu LTS, currently 20.04, is on 3.8.
        
             | eyegor wrote:
             | Somewhere around there is when python changed the
             | collections.abc stdlib naming convention from a warning to
             | a fatal error. This means that code could work fine in 3.8
             | ish and refuse to run on 3.9+.
        
               | I_complete_me wrote:
               | That probably explains why when I try to use subuser
               | commands (python3.10 installed on the system) it
               | complains "AttributeError: module 'collections' has no
               | attribute 'Mapping'"
        
               | nurbl wrote:
               | A bit of a pain. But to be fair, this import was
               | deprecated since python 3.3, released almost 10 years
               | ago.
        
             | thijsvandien wrote:
             | One reason could be that 3.8 is the last version to support
             | Windows 7, which (despite EOL) is still widely used.
        
       | spicybright wrote:
       | Ha, I used pyinstall and QT for the first time during a one off
       | project. Smoothest GUI development I've ever done coming from
       | knowing nothing about the stack. Esp. pyinstall. Had to do
       | literally nothing for win/mac/unix builds.
       | 
       | To be fair though, it was a relatively simple app, but I feel
       | that's the typical use case if you're already proficient in
       | python and just want to add some buttons.
       | 
       | I don't hear about using this stack much, so I'm glad it's
       | getting improvements + more attention!
        
         | m3nu wrote:
         | At Vorta (https://github.com/borgbase/vorta/) we're also happy
         | users of the PyQt + PyInstaller stack. Not really needed for
         | Linux, but great for macOS. It's even possible to use Sparkle
         | via PyObjc for automatic updates. Be sure to build "appdir"
         | packages to get a proper macOS package that can be notarized
         | with Apple.
        
         | quirino wrote:
         | I wrote a small Python program for a group of non-tech people,
         | and all throughout development I was dreading how much time I
         | was going to have to spend helping everyone through the
         | installation process. But Pyinstaller made it as simple as
         | "download and run". Super quick to set up and no one had issues
         | at all.
        
         | maleldil wrote:
         | Pyinstaller can be a nightmare depending on what dependencies
         | you have. I believe it doesn't copy data files by default, so
         | you have to either write a spec file for the library or include
         | those files yourself in your program spec.
         | 
         | After everything is set up, though, things usually work
         | smoothly.
        
           | spicybright wrote:
           | I don't remember having to do much of that except picking
           | what files I wanted (was a few folders in this case). It
           | makes sense thought. You typically don't want to bundle what
           | you don't need to, so making you set that config isn't the
           | worst thing.
        
       | Kelteseth wrote:
       | Weird that this project does not use Qt Installer Framework that
       | already works cross-platform.
        
         | eql5 wrote:
         | Sure, but this project probably predates the Qt Installer.
        
         | paulryanrogers wrote:
         | QIF didn't work for me. Updates weren't detected and it didn't
         | have support for Windows registry. I also got the impression
         | it's in maintenance mode and not widely used.
        
       | hereforonep wrote:
       | Reading articles like this is why you understand why webapps have
       | unfortunately won
        
         | knighthack wrote:
         | This is really a symptom of the packaging scenario in Python,
         | more than anything else. Web-apps have a lot of advantage in
         | that regard, but desktop apps have their place, and I hold
         | hopes that Python will come forward with better packaging tools
         | in the long run.
        
           | BiteCode_dev wrote:
           | I can package python apps fine, but creating a great UI with
           | pyqt is much harder than with tailwind + vuejs, despite the
           | fact I'm better at python than JS.
        
             | digisign wrote:
             | Not at all. A great UI fits in with the system it is
             | deployed on, it is not a unique snowflake.
        
         | boondaburrah wrote:
         | I'm not sure what particularly you mean about this article
         | since it seems a lot easier than webdev to me. Javascript
         | devops and Webpack in particular drive me up the wall. Qt is
         | usually click-button-receive-EXE (when using an IDE, otherwise
         | qmake is pretty painless) and this seems like the equivalent in
         | just "fbs freeze"?
        
         | jasfi wrote:
         | Flutter is cross-platform, including the web. I'm working on an
         | SDK that allows for back-end powered UIs that uses Flutter on
         | the front-end: https://nexusdev.tools/
        
         | varajelle wrote:
         | Because there is no need to package/deploy web apps?
        
         | dang wrote:
         | " _Please don 't post shallow dismissals, especially of other
         | people's work. A good critical comment teaches us something._"
         | 
         | https://news.ycombinator.com/newsguidelines.html
        
         | danielvaughn wrote:
         | Not sure why you're being downvoted - you have a point. I'm a
         | web dev, and once tried dipping my toes into building a native
         | GUI. I didn't last long.
        
           | beamatronic wrote:
           | I was a native GUI developer who once tried dipping my toes
           | into building web apps. I didn't last long.
        
             | rat9988 wrote:
             | You aren't a native gui developer anymore. So I guess you
             | made his point?
        
               | keb_ wrote:
               | How did they prove their point? Isn't it completely
               | possible that they left native GUI development for other
               | reasons? Maybe they became a woodworker. Please post in
               | good faith.
        
               | rat9988 wrote:
               | Humor is not HN community's selling point I guess.
        
         | galangalalgol wrote:
         | I get your point, but I wonder if the development being easier
         | is a symptom of it being dominant rather than the cause. Web
         | apps have a lot of other benefits that might have been the
         | cause. I'm not a web dev, I mostly work embedded or HPC and my
         | dev environment is either vscode or vim depending on my mood. I
         | use plenty of cli native apps, but vscode and matlab are the
         | only native GUIs I use. Is web development mostly done on web
         | apps? Trying to develop in gitlab has always been painful to me
         | for non trivial changes. It seems like anything that doesn't
         | have huge files to move about like photo,audio or video editing
         | could be a webapp.
        
       | Lucasoato wrote:
       | Do you know if there are free open source alternatives to fbs and
       | qt?
       | 
       | I mean free both as beer and freedom.
        
         | _fizz_buzz_ wrote:
         | I am using kivy for a small project. Works pretty well for me.
         | 
         | https://kivy.org/
        
         | scarygliders wrote:
         | If you install PySide/PySide2/PySide6, you don't need to
         | install Qt as well.
         | 
         | Included with PySide[2|6] is QtDesigner, hidden in the
         | distribution but available for use, and all the compiled Qt
         | libraries.
         | 
         | The application created from that can be released closed source
         | as using Qt under LGPL.
         | 
         | As for packaging;
         | 
         | Use PyInstaller, which creates a dist directory. Included in
         | that dist directory will be everything needed to run your
         | Python/Qt application.
         | 
         | Use Inno Setup/Inno Script Studio
         | (https://jrsoftware.org/isinfo.php) to package that dist folder
         | into an installer.
         | 
         | The end result will be a self contained installer which acts
         | just like any other Windows software with an installer.
         | 
         | I use all the above to create and distribute Captain's Log
         | (https://captainslog.scarygliders.net)
        
         | spacechild1 wrote:
         | Qt is available as LGPL.
        
           | galangalalgol wrote:
           | For the end user but for a commercial developer you have to
           | pay I believe.
        
             | jcelerier wrote:
             | absolutely not, LGPL is LGPL no matter who you are. Such a
             | restriction would make it incompatible with the LGPL (or
             | even any free software license).
        
               | galangalalgol wrote:
               | After reading their licensing that is now obvious. There
               | is a group at my megacorp that ises it heavily from
               | windows and they pay for tons of licenses. I'm not sure
               | why. Unless they are static linking some of the gpl v3
               | modules and don't want to release code, I don't know why
               | anyone would select the commercial qt license.
        
               | jcelerier wrote:
               | There's historically been a metric ton of FUD around this
        
       | vanous wrote:
       | > fbs's source code is available on GitHub. You can use it for
       | free in open source projects licensed under the GPL.
       | 
       | > The free version of fbs has several limitations. Upgrade to Pro
       | to unlock its full potential. Upon purchase, you'll receive a
       | hosted package that you can install just like fbs. No messing
       | around with license keys. Just pip install and you are done.
       | 
       | So it is more like open core. This is fine, just not clear from
       | the front "features" page listing.
        
         | ognarb wrote:
         | I'm getting annoyed at project saying that they are open source
         | and then it turns out they are actually open core. I'm fine
         | with dual licensing but not with false marketing.
        
           | rat9988 wrote:
           | Unless the core is not a product that can work by itself. I'd
           | say it's still open source. Paid closed source extensions
           | don't make it less open source.
        
             | simonh wrote:
             | They make it less open source than if the extensions were
             | open source, or if the functionality was just part of the
             | core system.
        
           | mherrmann wrote:
           | It's a historical artifact in this case. There was no
           | commercial offering. But then I got requests for particular
           | features and ongoing maintenance / support. This then became
           | the additional parts you can buy.
        
             | enriquto wrote:
             | If that is the case, then the word "limitations" is very
             | misleading, almost dishonest marketing. It would be more
             | honest if the regular offering was presented as a complete
             | product, with optional commercial "extensions", whose
             | documentation is separate.
        
               | mherrmann wrote:
               | It lies in the eye of the beholder what you consider a
               | limitation. I invite you to look at the home page and
               | compare what's available for free and what isn't and draw
               | your conclusion then.
        
               | icegreentea2 wrote:
               | Hey, I support your decisions, but I do think that
               | finding the list of limitations is annoying. Scrolling
               | through your manual looking for "Pro" markers is a little
               | error prone I feel - maybe if you could surface the pro-
               | ness of them into the table of contents of the manual at
               | least?
        
               | vanous wrote:
               | >It lies in the eye of the beholder what you consider a
               | limitation. I invite you to look at the home page and
               | compare what's available for free and what isn't and draw
               | your conclusion then.
               | 
               | I tried to look, but you want me to evaluate your project
               | by going through the manual and search for the "Pro" tag
               | (as per your documentation [*]) while here you tell us
               | "look at the home page".
               | 
               | Your project is great and your work is much
               | appreciated,thank you for that. What I am seeking is
               | clarity of the offering, because if I choose FBS for my
               | floss project, I do not plan to pay 50EUR for a hidden
               | cost.
               | 
               | [*]
               | 
               | > Support for the latest versions of Python, PyQt6,
               | PySide6 and PyInstaller.
               | 
               | > All features marked Pro in the Manual.
        
               | naoqj wrote:
               | Dude the latest version of python that the free version
               | supports is 3.6, which is out of support (including
               | security patches). The free tier of your application is
               | simply unusable.
        
           | indymike wrote:
           | > I'm fine with dual licensing but not with false marketing.
           | 
           | I love getting source code, but there are places where you
           | really are looking for Free Software, not merely open source.
           | Open core model products are really frustrating because maybe
           | your use case isn't one where the value is high enough to be
           | worth paying for "pro". I run into this often when someone
           | asks about doing charity work. I do really like it though
           | when an open core company is clear about it.
        
         | BiteCode_dev wrote:
         | Open core is open source, just a layer on top of it. All the
         | freedoms of FOSS are guaranteed for the software in the repo
         | you are looking at.
         | 
         | The fact they make money by providing even more doesn't make it
         | less open source.
        
       | mherrmann wrote:
       | Author here, thank you for sharing. Will be happy to answer any
       | questions.
        
         | maleldil wrote:
         | I haven't used fbs, but fman is great. Thank you for your work.
        
           | mherrmann wrote:
           | Thank you for the kind words! I'm happy you like it.
        
         | akselmo wrote:
         | Any plans for Appimage/flatpak build support for linux?
        
           | mherrmann wrote:
           | Haven't gotten around to it since 2018 and don't think this
           | will change soon. Always happy to receive contributions
           | though.
           | 
           | https://github.com/mherrmann/fbs/issues/49
        
         | [deleted]
        
         | jll29 wrote:
         | Congrats on the Tony Hoare prize, that's very impressive,
         | Michael.
        
         | pacifika wrote:
         | Would you consider a refund policy or dry run trial with pro
         | home?
         | 
         | The free version doesn't support modern Python versions so to
         | see if it works.
        
           | mherrmann wrote:
           | All but the cheapest edition come with a 31 day money back
           | guarantee. It's written on the purchase page.
        
         | bscphil wrote:
         | The top comment in the thread says
         | 
         | > Free fbs doesn't work with recent versions of python (>3.6)
         | 
         | Is this true? What are the plans (if any) to update the GPL
         | version of the project?
        
       | spectrallus wrote:
       | I have owned this sowftware for about a year and can say the
       | author did a good job. It's worth it.
       | 
       | With that said, this may not necessarily be fault of the authors,
       | but the tutorial and documentation really doesn't help. The Qt
       | and PyQt/PySide ecosystem is so fragmented that understanding how
       | to truly use fbs only came to me after months of browsing github
       | for example code.
       | 
       | Something like a video tutorial series on YouTube that shows how
       | to use Qt Creator with QWidgets with fbs would be great then
       | another on how to use Qt Design Studio with QtQuick with fbs
       | would be amazing.
        
       ___________________________________________________________________
       (page generated 2022-03-27 23:01 UTC)