Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Oscar Benjamin
On Mon, 11 Feb 2019 at 17:30, Alan Gauld via Tutor  wrote:
>
> Three is a lot of work going on in Python land but no universal
> solution. Some things work better on particular platforms.
> And building library packages is easier than complete applications.

I think this is the basic problem. There has been a lot of progress in
distributing libraries with pip, wheel etc. For an experienced
programmer it's easy to set something up with pip and venv that gets
you all the libraries you want. It's also pretty straight-forward to
write a setup.py and use setuptools to build the wheels that pop can
then install.

Distributing applications is still problematic though and that's what
Chip wants to do. In particular people often want to be able to do
this in a single file hence py2exe, pyinstaller etc.

But note that most professional software doesn't work that way.
Normally a user can download a single file but that file will be the
installer that then puts all the other files in position.

> But for now, if you have more than a pure Python application,
> you are pretty much stuck with building multiple solutions with
> multiple tools.

Chip is yours a pure Python application?

If it is then my suggestion would be to ask your users (if using
Windows) to install Python from the normal Python downloads page:
https://www.python.org/downloads/

Then you can give them a zipapp of your application:
https://docs.python.org/3/library/zipapp.html

I think if your zipapp has the .py extension and the shebang then it
should be possible to double-click the file to run it on Windows (it's
possible this depends on options ticked/unticked in the Windows
installer - might need to be installed for all users).

The advantage of this approach is that Python already has a
well-maintained installer so you don't have to bother with that part
yourself. It does mean that it's a two step-process for your users but
once they have done the first step you can send them as many zipapps
as you like and it should be fairly easy from there.

I haven't actually tested all of these steps together properly though
so there's a good chance if you try this that you will quickly
encounter some difficulty...

--
Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Chip Wachob
Oscar,

Thanks for your full understanding of my situation.  And putting it into
better words than I did.

The code that I've written is entirely Python.  There are necessary
libraries that go along with that, and, due to my inexperience, I am not
100% certain they are pure Python or not.  Some of the drivers from the IC
manufacturer (FTDI) are .dll files that get installed on the machine, and
I'm sure that's going to have to be a separate step.

I've been tooling around with PyInstaller over the last couple of days, and
it seems to be getting me closer to what I would like.  Unfortunately, I
seem to have hundreds of 'missing' modules.  I'm sure that something must
be missing because I can't launch the .exe file that is created.  It looks
like it is going to run, then it comes up and says it can't execute the
script (not the exact words, but you get the idea).  I'm just not sure how
to cull the 'necessary' modules from the ancillary ones.

I fear that once this is 'in the wild' that folks who don't have much / any
experience with Python will have a really hard time getting all the pieces
together.  Maybe I'm over-concerned, but I've always liked to err on the
side of caution when it comes to 'anyone' being able to do something.

I'm also certain that the 'pros' out there are sitting and saying, 'this
isn't hard to do...  he's being a ninny', but I'm really new to the
language, and feel fortunate that I've gotten to the point where I can
actually 'release' something.

One of the other posts, which I don't think I answered, asked about the
Python version.  Since I have libraries that are locked at 2.7, that is
where I have to stay, and that means that some tools are already off the
table since they are for 3.3, etc.

I really appreciate the input from everyone here.  With the pieces of
information you've offered, I've been able to make a little progress.

Best,



On Mon, Feb 18, 2019 at 8:27 AM Oscar Benjamin 
wrote:

> On Mon, 11 Feb 2019 at 17:30, Alan Gauld via Tutor 
> wrote:
> >
> > Three is a lot of work going on in Python land but no universal
> > solution. Some things work better on particular platforms.
> > And building library packages is easier than complete applications.
>
> I think this is the basic problem. There has been a lot of progress in
> distributing libraries with pip, wheel etc. For an experienced
> programmer it's easy to set something up with pip and venv that gets
> you all the libraries you want. It's also pretty straight-forward to
> write a setup.py and use setuptools to build the wheels that pop can
> then install.
>
> Distributing applications is still problematic though and that's what
> Chip wants to do. In particular people often want to be able to do
> this in a single file hence py2exe, pyinstaller etc.
>
> But note that most professional software doesn't work that way.
> Normally a user can download a single file but that file will be the
> installer that then puts all the other files in position.
>
> > But for now, if you have more than a pure Python application,
> > you are pretty much stuck with building multiple solutions with
> > multiple tools.
>
> Chip is yours a pure Python application?
>
> If it is then my suggestion would be to ask your users (if using
> Windows) to install Python from the normal Python downloads page:
> https://www.python.org/downloads/
>
> Then you can give them a zipapp of your application:
> https://docs.python.org/3/library/zipapp.html
>
> I think if your zipapp has the .py extension and the shebang then it
> should be possible to double-click the file to run it on Windows (it's
> possible this depends on options ticked/unticked in the Windows
> installer - might need to be installed for all users).
>
> The advantage of this approach is that Python already has a
> well-maintained installer so you don't have to bother with that part
> yourself. It does mean that it's a two step-process for your users but
> once they have done the first step you can send them as many zipapps
> as you like and it should be fairly easy from there.
>
> I haven't actually tested all of these steps together properly though
> so there's a good chance if you try this that you will quickly
> encounter some difficulty...
>
> --
> Oscar
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Alan Gauld via Tutor
On 18/02/2019 13:41, Chip Wachob wrote:

> The code that I've written is entirely Python.  There are necessary
> libraries that go along with that, and, due to my inexperience, I am not
> 100% certain they are pure Python or not.  Some of the drivers from the IC
> manufacturer (FTDI) are .dll files that get installed on the machine, and
> I'm sure that's going to have to be a separate step.

OK, that tells us something. The app can only run on Windows since DLLs
are Windows specific and won't work on Mac or Linux. That greatly
simplifies your task and means that py2exe is probably your best bet.


> I'm also certain that the 'pros' out there are sitting and saying, 'this
> isn't hard to do...  he's being a ninny', 

Nope, building a distributable application is one of the harder
bits. It's not technically difficult, in that it requires deep math
or anything, it's just a PITA bit of configuration. You can see
just how hard it is by the number of commercial (and freewaare)
apps that exist just for creating Windows installers. If it was
easy there would not be such a 3rd party market!

It's one reason I have tended to work on server based projects
because desktop distribution is a pain. It's also the main reason
most corporates favour web based apps rather than desktop,
despite the performance penalties inherent in the web,
because web apps are so much easier to distribute and maintain.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Oscar Benjamin
On Mon, 18 Feb 2019 at 13:41, Chip Wachob  wrote:
>
> The code that I've written is entirely Python.  There are necessary libraries 
> that go along with that, and, due to my inexperience, I am not 100% certain 
> they are pure Python or not.  Some of the drivers from the IC manufacturer 
> (FTDI) are .dll files that get installed on the machine, and I'm sure that's 
> going to have to be a separate step.

Do you mean that the users will already need to run a separate
installer for the drivers which is already available somewhere? Or do
you mean that you want to bundle those DLLs yourself?

If you are bundling the DLLs then it's no longer pure Python and the
zipapp approach won't work (DLLs cannot be used from inside a zip
file). In that case py2exe/pyinstaller would be the only possible one
file solutions I know of - they also basically zip up your code but in
a self-extracting exe.

> I've been tooling around with PyInstaller over the last couple of days, and 
> it seems to be getting me closer to what I would like.  Unfortunately, I seem 
> to have hundreds of 'missing' modules.  I'm sure that something must be 
> missing because I can't launch the .exe file that is created.  It looks like 
> it is going to run, then it comes up and says it can't execute the script 
> (not the exact words, but you get the idea).  I'm just not sure how to cull 
> the 'necessary' modules from the ancillary ones.

Yeah, you can spend a long time going through that. I guess you've
probably already read this:
https://pyinstaller.readthedocs.io/en/v3.3.1/operating-mode.html#analysis-finding-the-files-your-program-needs
The suggestion there is to get everything working in one folder mode
before trying one file mode.

Before that though: have you got it working with a hello world type
Python script (no dependencies)?

--
Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Chip Wachob
Yes, the .dll files will have to be installed separately.  So that's one
step.

I'd like to package the Python code together and have it all in one
directory (which it currently is).  Trying to limit human intervention
(error) as much as possible.

It does look like I'm going to have to have them pip install some modules
though.  Things like numpy, etc.  I wish I could avoid that, but I don't
see a way around it.

I'll try the Hello World first and see what happens.  Thanks for the
reminder.  Sometimes you get so far into the forest you can't find a tree
to save your behind.

Thank you,


On Mon, Feb 18, 2019 at 4:08 PM Oscar Benjamin 
wrote:

> On Mon, 18 Feb 2019 at 13:41, Chip Wachob  wrote:
> >
> > The code that I've written is entirely Python.  There are necessary
> libraries that go along with that, and, due to my inexperience, I am not
> 100% certain they are pure Python or not.  Some of the drivers from the IC
> manufacturer (FTDI) are .dll files that get installed on the machine, and
> I'm sure that's going to have to be a separate step.
>
> Do you mean that the users will already need to run a separate
> installer for the drivers which is already available somewhere? Or do
> you mean that you want to bundle those DLLs yourself?
>
> If you are bundling the DLLs then it's no longer pure Python and the
> zipapp approach won't work (DLLs cannot be used from inside a zip
> file). In that case py2exe/pyinstaller would be the only possible one
> file solutions I know of - they also basically zip up your code but in
> a self-extracting exe.
>
> > I've been tooling around with PyInstaller over the last couple of days,
> and it seems to be getting me closer to what I would like.  Unfortunately,
> I seem to have hundreds of 'missing' modules.  I'm sure that something must
> be missing because I can't launch the .exe file that is created.  It looks
> like it is going to run, then it comes up and says it can't execute the
> script (not the exact words, but you get the idea).  I'm just not sure how
> to cull the 'necessary' modules from the ancillary ones.
>
> Yeah, you can spend a long time going through that. I guess you've
> probably already read this:
>
> https://pyinstaller.readthedocs.io/en/v3.3.1/operating-mode.html#analysis-finding-the-files-your-program-needs
> The suggestion there is to get everything working in one folder mode
> before trying one file mode.
>
> Before that though: have you got it working with a hello world type
> Python script (no dependencies)?
>
> --
> Oscar
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor