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 enjoy making different geoprocessing tools to practice Python and to become more familiar with the arcpy modules. I've just been using a Custom Toolbox and then importing the Python script and setting the parameters, but I'm wondering if I should be using a Python Toolbox instead.

Are there any distinct advantages of one Toolbox over the other? Can a Python Toolbox do everything that a Custom Toolbox can do, and vise versa? Does one provide more functionality than the other?

share|improve this question
2  
A similar question here, worth reading! gis.stackexchange.com/questions/62839/… –  Alex Tereshenkov Apr 2 at 16:15
    
I thought this had already been posted but couldn't find it. Should this be marked as duplicate? –  Jason Scheirer Apr 2 at 16:23
1  
I didn't see it, but I think your answer here trumps any answer in the other question. –  ian Apr 2 at 16:25

1 Answer 1

up vote 12 down vote accepted

The two are very, very close in functionality but not completely equivalent.

Common to both

  • Includes a set of tools with a unique alias for identification
  • Can call from arcpy
  • Get a Geoprocessing tool dialog (essentially a full UI) for free for each tool
  • Can keep all Python code in one file (embedding tool source in TBX, holding all the implementation in one PYT) and distribute via email or shared network drives

Unique to TBX files:

  • Can include references to system toolboxes, custom COM tools, and custom .Net tools
  • Easy wizard UI for setting up parameters and doing validation code
  • Disadvantage: Opaque binary format, newer versions of TBX files need to be explicitly saved as older versions to work in previous versions of the software, the UI can be a double edged sword as you have to switch between property pages to see if you missed a setting (such as relative paths)

Unique to Python Toolboxes:

  • Plain text, so toolboxes can be treated the same as any other code (useful in environments where good revision control tooling is used as you can trace its development history -- look at how many projects on GitHub use PYT over TBX.)
  • Have more control over certain parameter types (namely you can do composite datatypes and define value tables' schemata)
  • Disadvantage: No wizard UI for configuring tool parameters, significantly more scaffolding code in Python, turns Toolbox development into more of a formal software development task over simply adding an implementation script

A while ago when I was working on my first dozen or so PYT toolboxes I got flustered at how much of a hassle it was to set up a PYT for the first time, so I developed a tool called tbx2pyt. It'll take a TBX toolbox and convert it to a PYT with a minimal loss of code. In fact, the PYT that powers it was first a TBX. This may be a good way to transition existing tools to the Python Toolbox format if you so desire. At the very least, it makes it possible to set up your tools' parameters using the UI before switching to code.

share|improve this answer
    
Not going to get any better than this, thanks! Oh and I'll definitely be checking out the tbx2pyt, sounds great. –  ian Apr 2 at 16:11
2  
Great comparison. Just to be thorough here is the a write-up by ESRI comparing the two –  JamesSLC Apr 2 at 16:36
2  
Included in the list of .tbx only is the ability to use Model Builder. –  matt wilkie Apr 9 at 8:51

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.