What is the best way to share Python scripts with non-python users?

15136
6
07-28-2017 07:29 AM
berniejconnors
Occasional Contributor III

I recently tried to share a Python Script with a non-python user but they were unwilling or not permitted to install python.  I tried py2exe but that did not work.  What is the best way to share a python script with a non-python / non-GIS user?  I have read a bit about Jupyter Notebook and I have proposed an "Idea" on GeoNet for ESRI to provide a Jupyter Notebook server within ArcGIS Online.  But I wonder if this is the best solution.  Is there an easier way to share python scripts that will allow non-python / non_GIS users to execute the scripts?

0 Kudos
6 Replies
JoshuaBixby
MVP Esteemed Contributor

Your own question refers to these folks as "non-Python / non-GIS" users, so it begs the question of why you want to share Python code with them if they won't understand it and won't know what to do with it, even if they could install Python.  I am wondering if there is a better format for sharing information with these users than Python code in the first place.

0 Kudos
berniejconnors
Occasional Contributor III

Joshua - what I am looking for is a way to package and share my python scripts so others can make use of it.  I created a simple script that will extract a polygon from one of our map services and create a GPX file.  If there was a simple way to execute the script that did not require the end-user to install and configure python my script could be used by many more people.  All they would have to do is provide the pertinent polygon ID to get the GPX file they require.

0 Kudos
MicahBabinski
Regular Contributor

I recommend a custom script tool, if they have ArcGIS Desktop. Otherwise a GP service.

What is a script tool?—Help | ArcGIS for Desktop 

JonathanQuinn
Esri Frequent Contributor

A web application running a GP service like Micah Babinski‌ could be a good approach.  For example, the Clip and Ship tool can be used within a widget in a web application like the Web Application Builder in Portal or AGOL.  A user would access the web app, run the widget to extract the data based on an AOI, and a zip file of the data would be returned to them.

darao_beirne
New Contributor

I' m not sure if this works for you, but you could always use something like this: notebooks.esri.com it stands up a temporary notebook with the Python API. You can save a Jupyter .ipynb file and the user can open that file in a temporary server. These servers don't have arcpy, they just have the Python API. 

DanPatterson_Retired
MVP Esteemed Contributor

If they are unwilling or unable to install python... then they won't have Jupyter notebook access in any event.  That would also preclude them from having ArcMap or Pro installed as well.

So, assuming they have ArcMap and/or Pro installed... a prepackaged project with the necessary toolbox and its associated script staring them in the face upon opening is the best bet as suggested by Micah and Jonathan.

Even talking about a GP service is going to make many people's eyes glaze over, so keep it simple in the first instance, then progress from there.

Worse case scenario, they will get stuck on unzipping what you send them.   Good luck