ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS 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
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

Comparing custom and Python toolboxes

At ArcGIS 9.0, the script tool framework was first introduced and is geared toward creating Python-based tools for new users, but it is an inefficient process for more experienced users. In the script tool framework, you can do the following:

  • Define parameters through the wizard.
  • Create validation code that lives in the toolbox.
  • Create and maintain the source script separately.

All of these parts are segregated and more difficult to manage collectively.

As of 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 or 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 secured with a password.

A Python toolbox .pyt file can be encrypted in place and secured with a password.

Related topics

  • Accessing parameters in a script tool
  • Setting script tool parameters
  • Defining parameters in a Python toolbox
  • Accessing parameters within a Python toolbox

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2021 Esri. | Privacy | Legal