Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox.

I thought the Online Help might enlighten me when it prefaces some dot points with:

Once created, tools in a Python toolbox provide many advantages

However, the five advantages listed all seem to be over not being able to use Python to write tools, and none seem to specify an advantage of Python Toolboxes over Python Script Tools.

The two advantages that I can think of are:

  • I can now write a "pure" Python tool in a single Python script without having to hook it up to a separately authored dialog with its Tool Validation looking like it was tacked on but I'm happy to be pragmatic rather than pure in this regard
  • I could now use code (Python or any language capable of writing text files) to automate the writing of Python toolboxes but I am yet to come across a requirement to do this

Am I overlooking the compelling case that led Esri to provide the Python Toolbox capability and, if so, what is it?

share|improve this question
1  
The help section titled Comparing custom and Python toolboxes has a pretty good comparison of why you might choose one over the other, although I'd be curious to hear "real world" advantages/disadvantages from those experienced in creating Python Toolboxes. –  RyanDalton Jun 6 '13 at 4:32
    
Thanks @RyanDalton - shows how much I read the Help - I forgot about that page when writing this Question - please transfer your Comment to an Answer which I'll hold off on Accept-ing until others have had a chance to try and suggest any more compelling ones. –  PolyGeo Jun 6 '13 at 4:39
add comment

2 Answers 2

up vote 9 down vote accepted

The help section titled Comparing custom and Python toolboxes has a pretty good comparison of why you might choose one over the other, although I'd be curious to hear "real world" advantages/disadvantages from those experienced in creating Python Toolboxes.

One clear disadvantage that I read is the inability to mix/match models & scripts in a Python Toolbox, as you can in a standard Custom Toolbox.

share|improve this answer
11  
This. Two other things of note: with a .PYT your tools' parameters and names and such are defined in code, in plain text, which is quite useful if you're a software developer working with others because the tools can be totally managed in a revision control system in a manageable way instead of being in an opaque binary format. You also have a little more control over your parameters -- for example, you can define value tables and composite datatypes in a .PYT. –  Jason Scheirer Jun 6 '13 at 5:25
1  
@JasonScheirer, can you add your comment as another answer? I think it would be more helpful there so it doesn't get buried (like most other comments). Thanks! –  RyanDalton Jun 6 '13 at 5:27
1  
I'd be interested to hear what control system you use to manage PYTs. –  DPierce Jun 6 '13 at 14:59
add comment

My number one reason for leaning towards python toolboxes is for version control and source code management (see Applying version control to ArcGIS Models), followed very closely by being able to use a code editor/IDE with tab completion, regular expressions, snippet libraries, etc.

However as Ryan Dalton notes, by doing so you lose the ability to use Model Builder and old style Tools -- unless you're willing to go through the effort of building the model as per usual and then exporting to python and then rewriting to fit into the .pyt. (If you do this take a look at Guidelines for organizing Python Toolboxes (.pyt) in ArcGIS). At present this disadvantage is big enough that I've yet embark on using python toolboxes seriously.

If you have existing toolboxes you'd like to convert to .pyt, you may find Jason Scheirer's tbxtopyt partial converter useful.

As for the "compelling case?" part of the question: if you already have some software development chops, yes definitely. If like me you're 3 parts GIS Tech/Analyst and 1 part or less pythonista, not so much. (At least not yet -- I really hope this binary one or the other nature of the two approach changes in a near future release.)

share|improve this answer
    
+1 for version control. Great answer! –  RyanDalton Jun 12 '13 at 14:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.