Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-16 Thread Christian Gollwitzer

Am 17.12.15 um 01:03 schrieb Bruce Whealton:

I watched one training video that discussed Python and Tkinter. Like many 
similar tutorials from online training sites, I was left scratching my head.

What seems to be blatantly missing is how this would be distributed. In the 
first mentioned tutorial from Lynda.com the Tkinter app was related to a web 
page. However, the browser cannot run Python Bytecode or Python Scripts.

Surely, one is going to want to create GUI apps for users that are not Python 
Developers. I would not think to ask someone to install Python on their system 
and make sure it is added to the path. Maybe it is not so hard for the 
non-technical, average users.

I would want to package in some way so that when launched, it installs whatever 
is needed on the end user's computer. How is this done?
Are there common practices for this?
Thanks,
Bruce

On option is pyinstaller or py2exe, which converts a Python script + 
dependencies into a single file (single directory) executable. Sometimes 
you must give them hints what to include, but in general it works well. 
It may create very large packages (if you include 
numpy/scipy/matplotlib, you'll end up with ~60 MB)


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-16 Thread Rick Johnson
On Wednesday, December 16, 2015 at 6:03:55 PM UTC-6, Bruce Whealton wrote:

> Surely, one is going to want to create GUI apps for users
> that are not Python Developers. I would not think to ask
> someone to install Python on their system and make sure it
> is added to the path. Maybe it is not so hard for the non-
> technical, average users.
> 
> I would want to package in some way so that when launched,
> it installs whatever is needed on the end user's computer.
> How is this done? Are there common practices for this?


Your assumptions are correct! In fact, in a language that was "supposedly" 
designed to be an "applications language" (eat your heart out D'Aprano!!!), one 
would think that distributing apps would not only be obvious, but also 
intuitive!

 ALAS, THE CRUEL REALITIES OF INTERPRETED LANGUAGES SLAPS YOU IN THE PASTEY 
WHITE FACE! 

Unlike a true "applications language", like say, um, *JAVA*, one cannot simply 
compile an executable and distribute it in a teeny tiny binary form, no, with 
Python, the end user must either (1) have Python on his machine already, (2) 
download Python, or (3) you must package a Python interpreter along with your 
script (and dependencies) -- which will end up being a very large file just to 
run (what is in most cases) a very small script. 

 BOO-HISS!

But the good news is that, Python ships on many machines already. But of 
course, you're seeking more consistency in your distribution QA than the "wild 
guess" and the fickle nature of "lady luck". 

Many 3rd party libraries exist to solve your distribution issue. Google 
probably knows about all (or at least most) of them.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-16 Thread Ben Finney
Bruce Whealton  writes:

> What seems to be blatantly missing is how this would be distributed.

Distributing programs so that recipients can run them is an ongoing
problem.

Operating systems arenecessarily involved, and since not every recipient
uses the exact same configuration of the exact same version of the exact
same operating system, the means of getting your program installed and
working on their computer will differn significantly.

> In the first mentioned tutorial from Lynda.com the Tkinter app was
> related to a web page. However, the browser cannot run Python Bytecode
> or Python Scripts.

Web applications are attractive for developers in large part because web
standards are hard-won oases of compatibility across different operating
systems.

It is no accident that operating system vendors (Microsoft, Apple,
Google, etc.) keep trying to carve out attractive incompatible features
and areas of their system, to ensure some applications using those
non-standard features will only run smoothly on the operating system
controlled by that vendor.

> Surely, one is going to want to create GUI apps for users that are not
> Python Developers.

Indeed, and toolkits like Tkinter make this refreshingly easy to do in a
way that works across all mainstream operating systems today.

What is not standardised is installation of software for end users.

> I would want to package in some way so that when launched, it installs
> whatever is needed on the end user's computer. How is this done? 

This is the “bootstrap” problem: a Python program is only useful once
there is a Python interpreter installed and working on the recipient's
system. You still need to get the appropriate version of Python
installed on that recipient's operating system.

You'll need to know your target audience, make decisions about the set
of operating systems you want to support, and build a package for each
one.

> Are there common practices for this?

Common to all mainstream operating systems? No, installation of software
is one major area that makes operating systems incompatible.


For GNU+Linux systems: Up-to-date Python is easily installed as a
dependency of your package. Target the version(s) of Python you know
your recipients will have, and declare a dependency in the operating
system package you make.

For OS X: There is an old, minimal Python installation, which is
probably too old for you to target. I am not aware of a good dependency
resolution system; you'll need to get the latest stable Python onto the
recipient's system with their help.

For iOS: I'm not aware of a good way to install Python programs on iOS.

For Android: There is a decent dependency system, but again I'm not
aware of a good standard way to have a Python program install onto
Android.

For MS Windows: There is definitely no good dependency resolution system
for you to use. You'll need to bundle a Python interpreter with your
program as a single installable file. This makes your program much
larger and redundant with any other such program on the system; this is
what Microsoft has doomed developers to work with.

-- 
 \  “If we have to give up either religion or education, we should |
  `\  give up education.” —William Jennings Bryan, 1923-01 |
_o__)  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-16 Thread Denis Akhiyarov
On Wednesday, December 16, 2015 at 6:45:50 PM UTC-6, Rick Johnson wrote:
> On Wednesday, December 16, 2015 at 6:03:55 PM UTC-6, Bruce Whealton wrote:
> 
> > Surely, one is going to want to create GUI apps for users
> > that are not Python Developers. I would not think to ask
> > someone to install Python on their system and make sure it
> > is added to the path. Maybe it is not so hard for the non-
> > technical, average users.
> > 
> > I would want to package in some way so that when launched,
> > it installs whatever is needed on the end user's computer.
> > How is this done? Are there common practices for this?
> 
> 
> Your assumptions are correct! In fact, in a language that was "supposedly" 
> designed to be an "applications language" (eat your heart out D'Aprano!!!), 
> one would think that distributing apps would not only be obvious, but also 
> intuitive!
> 
>  ALAS, THE CRUEL REALITIES OF INTERPRETED LANGUAGES SLAPS YOU IN THE PASTEY 
> WHITE FACE! 
> 
> Unlike a true "applications language", like say, um, *JAVA*, one cannot 
> simply compile an executable and distribute it in a teeny tiny binary form, 
> no, with Python, the end user must either (1) have Python on his machine 
> already, (2) download Python, or (3) you must package a Python interpreter 
> along with your script (and dependencies) -- which will end up being a very 
> large file just to run (what is in most cases) a very small script. 
> 
>  BOO-HISS!
> 
> But the good news is that, Python ships on many machines already. But of 
> course, you're seeking more consistency in your distribution QA than the 
> "wild guess" and the fickle nature of "lady luck". 
> 
> Many 3rd party libraries exist to solve your distribution issue. Google 
> probably knows about all (or at least most) of them.


if you did not notice Java/.NET ship with runtime VMs as well.
Even C/C++ have some requirements depending on the platform.
We should all switch to assembly to avoid any dependencies and port our code to 
each platform without hesitation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Michiel Overtoom

> On 2015-12-17, at 01:03, Bruce Whealton  
> wrote:
> 
> I would want to package in some way so that when launched, it installs 
> whatever is needed on the end user's computer. How is this done? 

You might want to watch https://www.youtube.com/watch?v=wsczq6j3_bA (Brandon 
Rhodes: The Day of the EXE Is Upon Us - PyCon 2014). 

"It was once quite painful to build your Python app as a single .exe file. 
Support forums filled with lamentations as users struggled with primitive 
tools. But today, two separate tools exist for compiling your Python to real 
machine language! Come learn about how one of the biggest problems in 
commercial and enterprise software has now been solved and how you can benefit 
from this achievement.

Slides can be found at: https://speakerdeck.com/pycon2014 and 
https://github.com/PyCon/2014-slides";

Greetings,


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Ulli Horlacher
Rick Johnson  wrote:

> Unlike a true "applications language", like say, um, *JAVA*, one cannot
> simply compile an executable and distribute it in a teeny tiny binary
> form, no, with Python

Of course you can!
If have done this with pyinstaller. This creates a standalone Windows
executable you can distribute.
Example:
http://fex.rus.uni-stuttgart.de:8080/fexit.html




-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How does one distribute Tkinter or Qt GUI apps Developed in Python

2015-12-17 Thread Oscar Benjamin
On 17 December 2015 at 00:03, Bruce Whealton
 wrote:
> I watched one training video that discussed Python and Tkinter. Like many 
> similar tutorials from online training sites, I was left scratching my head.
>
> What seems to be blatantly missing is how this would be distributed. In the 
> first mentioned tutorial from Lynda.com the Tkinter app was related to a web 
> page. However, the browser cannot run Python Bytecode or Python Scripts.
>
> Surely, one is going to want to create GUI apps for users that are not Python 
> Developers. I would not think to ask someone to install Python on their 
> system and make sure it is added to the path. Maybe it is not so hard for the 
> non-technical, average users.
>
> I would want to package in some way so that when launched, it installs 
> whatever is needed on the end user's computer. How is this done?
> Are there common practices for this?

There are different general approaches in this area. One possibility
is to ship an installer. Another is to try and ship a complete single
file executable. For the single-file executable you have
pyinstaller/py2exe/py2app etc.

If you're user can be expected to install the software before running
it then in the basic case it is not too hard. Python itself comes with
a graphical installer for Windows and is already installed on every
other OS. If you can assume that Python is installed then you can
distribute your application simply as a zip file but with a .py(z)(w)
file extension.

See here:
https://www.python.org/dev/peps/pep-0441/

A Windows user should then be able to simply double click the .pyz
file and have it run. I'm not sure how that works on a MAC but on
Linux you can preface the zip file with a shebang make it executable
and it will run from the terminal and from any file-browser if it
knows how to run executable files.

Another option for Windows although it is relatively new is that as of
Python 3.5 there is an embedded distribution of Python that is
intended to be shipped as part of an application installer and
installed local to the application. This is new and I haven't heard
anyone using it and don't know if any tools exist to help actually
creating an installer using it.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list