ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Comparing custom and Python toolboxes

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.

In ArcGIS 10.1, there are two ways to creating your own geoprocessing tools with Python: script tools in custom toolboxes and script tools in Python toolboxes .

In a Python toolbox, parameter definitions, validation code, and the source code are handled in the same place, making it easier to create and maintain Python tools. Additionally, Python toolboxes support capabilities that script tools do not, such as value tables, composite data types, and custom license checking.

For those with Python experience, Python toolboxes provide the opportunity to take advantage of your Python skills and create tools entirely and easily out of Python. If you are new to Python, you will be better suited to creating tools in custom toolboxes, where the wizard will step you through the necessary parts of a script tool.

If you use or are planning to use significant validation code in your script tool, almost certainly you will find the experience more straightforward in a Python toolbox.

Custom toolboxesPython toolboxes

Organization

Script tools in a custom toolbox are organized into three parts:

  1. The tool and parameter definitions which are defined through a wizard.
  2. The optional validation code which provides extra control on parameter behavior and resides in the toolbox.
  3. The source code which is maintained in a separate file for each tool, usually as a Python script (.py).

A Python toolbox is a Python script with a .pyt extension, which contains all aspects of a toolbox and its tools: parameters, validation, and execution. This is done using Python classes: one class for the toolbox and one class for each of the tools.

Editing

The source code can be edited in any editor.

The parameters are edited through the script tool wizard.

Validation code (if used) can be edited via the wizard in an editor.

Python toolbox files (.pyt) can be edited in any editor, and all parts of the tool (parameter definitions, validation code, and source code) can be edited in the same place.

As Python toolboxes can only be edited in an editor, they do not support copying/pasting within a toolbox or between toolboxes.

Using other tools

Custom toolboxes support various tool types, including Python script tools, model tools (built with ModelBuilder), and built-in tools (built using ArcObjects and a compiled language like .NET).

Python toolboxes do not directly support other tool types; that is, you cannot add model or built-in tools to your Python toolbox. However, you can call tools in other toolboxes from within the Python toolbox code.

Additional functionality

n/a

Python toolboxes support an isLicensed method which allows you to control whether a tool can be opened based on your criteria.

Additional security

Script tools in a custom toolbox can have their source code embedded into the toolbox and locked with a password.

n/a

Related Topics

  • Accessing parameters in a script tool
  • Setting script tool parameters
  • Defining parameters in a Python toolbox
  • Accessing parameters within a Python toolbox
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal