Anyone using the new Python Toolboxes at 10.1?

6926
10
09-05-2012 05:48 AM
KevinGooss
Occasional Contributor
Just wondering if anyone has used the new Python toolboxes at 10.1?
The .pyt
I am experimenting with one and could use some tips.
fyi, if you want to edit that pyt file in your favorite python editor you may have to go into the options of your editor and set it up to explicitly recognize pyt files. Mine (Wing, pyScripter) did not do that by default and there was no coloring or intellisense until i modified the program under options to read that pyt.

I want to use pyt because at 10.0 we had such a hassle with deploying script tools and toolboxes because you always need arcatalog to setup the dang params. And they seem to get out of whack on their own over time.

I'm hoping these python-based toolboxes don't work like that.
One drawback is that you only get the one pyt file - so if you want to cram 20 custom tools in there you are looking at a huge file.
10 Replies
KevinGooss
Occasional Contributor
Still not where i want to be on this one unfortunately.
I can get all the py and pyt files in order but that still doesn't get me around having to use ArcMap to create the sd file.
And when that sd file gets published all of the sudden there are lots of new files and folders and my code is being modified by esri hand-holding.

When i publish the sd esri's convoluted directory structure makes this:

-GPServiceName.GPServer
  -extracted
  .GPServiceName.sd

then in the extracted folder we have:
-esriinfo
-v101
.manifest.xml
.serviceconfiguration.json
tilingservice.xml

under esriinfo we have more:
-metadata
-thumbnail
.iteminfo.xml

thumbnail is just an image, the metadata folder has a file named metadata.xml

under v101 we have:
afoldernamedafterwhereyouputyourscripts
GPServiceName.tbx
GPServiceName.rlt

the tbx and rlt are binary
under the folder that esri creates based on your script folder you have:
all of your py files, pyc versions for each, a param text file that i was using and esri dragged in, along with any 'helper' py files
the pyt file for your original python toolbox
a pyt.xml for the toolbox
a Tool.pyt.xml for the toolbox
pyt.xml files for each Tool in the toolbox

Python toolboxes provide the opportunity to take advantage of your Python skills and create tools entirely and easily out of Python


perhaps. but getting them published is a different story.

Say i want to add a Tool to my currently published GPService? Not fun at all. I have to open my pyt, edit it, open it in ArcMap, run EVERY OTHER TOOL including my new tool and then publish?

Certainly i'm missing some very important in this workflow.

At ArcGIS 9.0, the script tool framework was first introduced and is geared towards creating Python-based tools for new users, but it is an inefficient process for more experienced users. In the script tool framework:
You define parameters through the wizard
You create validation code that lives in the toolbox
Plus you create and maintain the source script separately
All of these parts are segregated and more difficult to manage collectively.


That workflow is starting to look a lot better in hindsight.
0 Kudos