Re: Packaging uwsgi flask app for non-programmers?

2018-02-13 Thread Israel Brewster
> On Feb 13, 2018, at 10:02 AM, Dan Stromberg  wrote:
> 
> On Tue, Feb 13, 2018 at 9:28 AM, Israel Brewster  
> wrote:
>> As such, I'm considering three possible solutions:
>> 
>> 1) Make some sort of installer package that includes the python3 installer
>> 2) Somehow automate the download and install of Python3, or
>> 3) re-write my code to be python 2 compatible (since python 2 is included 
>> with the OS)
>> 
>> If anyone has any suggestions on how I could accomplish 1 or 2, I'd 
>> appreciate it. Thanks!
> 
> Would using homebrew help?
> 
> http://docs.python-guide.org/en/latest/starting/install3/osx/ 
> 

That's a thought. I could offer the user the option of either a) automatically 
installing homebrew and then installing python3 via homebrew, or b) manually 
downloading and running the python3 installer.

> 
> BTW, you might use curl  | bash to get the ball rolling.

On that note, is there a fixed url that will always get the latest python3 
installer? Of course, I might not want to do that, for example after 3.7 or 4.0 
(I know, not for a while) is released, just in case something breaks with a 
newer release.

> 
> I wouldn't recommend moving from 3.x to 2.x, unless perhaps you use a
> common subset.

Yeah, that idea kinda left a sour taste in my mouth, but I figured I'd throw it 
out there as it would solve the python install issue.

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Packaging uwsgi flask app for non-programmers?

2018-02-13 Thread Dan Stromberg
On Tue, Feb 13, 2018 at 9:28 AM, Israel Brewster  wrote:
> As such, I'm considering three possible solutions:
>
> 1) Make some sort of installer package that includes the python3 installer
> 2) Somehow automate the download and install of Python3, or
> 3) re-write my code to be python 2 compatible (since python 2 is included 
> with the OS)
>
> If anyone has any suggestions on how I could accomplish 1 or 2, I'd 
> appreciate it. Thanks!

Would using homebrew help?

http://docs.python-guide.org/en/latest/starting/install3/osx/

BTW, you might use curl  | bash to get the ball rolling.

I wouldn't recommend moving from 3.x to 2.x, unless perhaps you use a
common subset.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Packaging uwsgi flask app for non-programmers?

2018-02-13 Thread Israel Brewster
> 
> On Feb 6, 2018, at 12:12 PM, Israel Brewster  wrote:
> 
> I have been working on writing an Alexa skill which, as part of it, requires 
> a local web server on the end users machine - the Alexa skill sends commands 
> to this server, which runs them on the local machine. I wrote this local 
> server in Flask, and run it using uwsgi, using a command like: "uwsgi 
> serverconfig.ini".
> 
> The problem is that in order for this to work, the end user must:
> 
> 1) Install python 3.6 (or thereabouts)
> 2) Install a number of python modules, and
> 3) run a command line (from the appropriate directory)
> 
> Not terribly difficult, but when I think of my target audience (Alexa users), 
> I could easily see even these steps being "too complicated". I was looking at 
> pyinstaller to create a simple double-click application, but it appears that 
> pyinstaller needs a python script as the "base" for the application, whereas 
> my "base" is uwsgi. Also, I do need to leave a config file accessible for the 
> end user to be able to edit. Is there a way to use pyinstaller in this 
> scenario, or perhaps some other option that might work better to package 
> things up?

So at the moment, since there have been no suggestions for packaging, I'm 
getting by with a bash script that:

a) Makes sure python 3 is installed, prompting the user to install it if not
b) Makes sure pip and virtualenv are installed, and installs them if needed
c) Sets up a virtualenv in the distribution directory
d) Installs all needed modules in the virtualenv - this step requires that dev 
tools are installed, a separate install.
e) modifies the configuration files to match the user and directory, and 
f) Installs a launchd script to run the uwsgi application

This actually seems to work fairly well, and by giving the script a .command 
extension, which automatically gets associated with terminal under OS X, the 
end user can simply double-click setup.command without having to go into 
terminal themselves. The main stumbling block then is the install of python3 - 
the user still has to manually download and install it in addition to my code, 
which I'd prefer to avoid - having to install my code separate from the Alexa 
skill is already an annoyance. As such, I'm considering three possible 
solutions:

1) Make some sort of installer package that includes the python3 installer
2) Somehow automate the download and install of Python3, or
3) re-write my code to be python 2 compatible (since python 2 is included with 
the OS)

If anyone has any suggestions on how I could accomplish 1 or 2, I'd appreciate 
it. Thanks!

---
Israel Brewster
Systems Analyst II
Ravn Alaska
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7293
---

> 
> ---
> Israel Brewster
> Systems Analyst II
> Ravn Alaska
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7293
> ---
> 
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Packaging uwsgi flask app for non-programmers?

2018-02-07 Thread Israel Brewster



> On Feb 6, 2018, at 8:24 PM, Dennis Lee Bieber  wrote:
> 
> On Tue, 6 Feb 2018 12:12:26 -0900, Israel Brewster 
> declaimed the following:
> 
>> I have been working on writing an Alexa skill which, as part of it, requires 
>> a local web server on the end users machine - the Alexa skill sends commands 
>> to this server, which runs them on the local machine. I wrote this local 
>> server in Flask, and run it using uwsgi, using a command like: "uwsgi 
>> serverconfig.ini".
>> 
> 
>   
> 
>> Not terribly difficult, but when I think of my target audience (Alexa 
>> users), I could easily see even these steps being "too complicated". I was 
>> looking at pyinstaller to create a simple double-click application, but it 
>> appears that pyinstaller needs a python script as the "base" for the 
>> application, whereas my "base" is uwsgi. Also, I do need to leave a config 
>> file accessible for the end user to be able to edit. Is there a way to use 
>> pyinstaller in this scenario, or perhaps some other option that might work 
>> better to package things up?
> 
>   Not mentioned is getting your end-user to possibly have to open up
> fire-wall rules to allow INBOUND connections (even if, somehow, limited to
> LAN -- don't want to leave a WAN port open).

Not mentioned because it's not needed - I establish a ngrok tunnel to provide 
external https access to the local server. I just include the ngrok binary with 
my package, and run it using subprocess.Popen. Since it doesn't even require 
you to have an account to use it, that bypasses the need to set up 
port-forwards and firewall rules quite nicely. Also solves the problem of 
dynamic IP's without having to burden the end user with dyndns or the like - I 
just "register" the URL you get when connecting. Admittedly though, that was a 
large concern of mine until I was pointed to ngrok as a solution.

Ideally, I'd just access across the local network, Alexa device to local 
machine, but that's not an option - at least, not yet.

> -- 
>   Wulfraed Dennis Lee Bieber AF6VN
>wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Packaging uwsgi flask app for non-programmers?

2018-02-07 Thread Israel Brewster
On Feb 6, 2018, at 12:12 PM, Israel Brewster  wrote:
> 
> I have been working on writing an Alexa skill which, as part of it, requires 
> a local web server on the end users machine - the Alexa skill sends commands 
> to this server, which runs them on the local machine. I wrote this local 
> server in Flask, and run it using uwsgi, using a command like: "uwsgi 
> serverconfig.ini".
> 
> The problem is that in order for this to work, the end user must:
> 
> 1) Install python 3.6 (or thereabouts)
> 2) Install a number of python modules, and
> 3) run a command line (from the appropriate directory)
> 
> Not terribly difficult, but when I think of my target audience (Alexa users), 
> I could easily see even these steps being "too complicated". I was looking at 
> pyinstaller to create a simple double-click application, but it appears that 
> pyinstaller needs a python script as the "base" for the application, whereas 
> my "base" is uwsgi. Also, I do need to leave a config file accessible for the 
> end user to be able to edit. Is there a way to use pyinstaller in this 
> scenario, or perhaps some other option that might work better to package 
> things up?

A related question, should a way to create a full package not be available, 
would be Is there a way to do a "local" (as in, in the same directory) install 
of Python3.6, and to do it in such a way as I could script it from the shell 
(or python, whatever)? The idea would then be to basically set up a fully 
self-contained virtualenv on the users machine, such that they just have to run 
a "setup.sh" script or the like.

BTW, this would be on a Mac - my local skill server works using AppleScript, so 
it's not actually portable to other OS's :-P

> 
> ---
> Israel Brewster
> Systems Analyst II
> Ravn Alaska
> 5245 Airport Industrial Rd
> Fairbanks, AK 99709
> (907) 450-7293
> ---
> 
> 
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

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