Python ToolBox Guide Book

880
4
10-24-2012 03:57 PM
Status: Open
Labels (1)
GusMartinka
Occasional Contributor

An in depth guide book, like the one for python add-ins, would be great for learning the power of python toolboxes. An explanation of best practices and debugging would be great.

An example of dynamic tool validation would also be great. For example, a tool that pulled the current data driven page record into a value table or record set for user interaction would be very helpful. 

4 Comments
Suzanne-Boden
We did a free one-hour training seminar on Python toolboxes a little while back. You may find that helpful for learning some best practices. You can access the seminar at http://training.esri.com/gateway/index.cfm?fa=catalog.webCourseDetail&courseid=2523
KoryKramer

Hi Gus,

I realize that a lot of time has passed since the original idea was posted, so I wanted to check with you to make sure you're aware of the following resources:

What is a Python toolbox? What is a Python toolbox?—Geoprocessing and Python | ArcGIS Desktop 

Comparing custom and Python toolboxes: Comparing custom and Python toolboxes—Geoprocessing and Python | ArcGIS Desktop 

As well as all of the resources under the Creating tools in a Python toolbox topic: Creating a new Python toolbox—Geoprocessing and Python | ArcGIS Desktop 

Do you need something more than the above?  If so, please provide additional and specific information about what would be helpful.

curtvprice

Kory, we really need some best practices not detailed in the help. For example, if you put your code in one big pyt file, it takes forever to load, it's really best practice to create separate scripts and import them into the pyt. Perhaps setting up a package is the best way to do this, but there are no cookbooks available from the help. Also, if you do this you need to do a reload() but I understand that's handled differently in 3.4 (accessing toolbox in Pro). The help really doesn't have any good examples, and unlike python add ins there are no templates out there beyond the pyt stub in the help to get things going.

I have avoided getting into pyt's much because of this lack of documentation, I have run into weirdnesses caused probably by the way I am structuring a bigger than "toy" size pyt. If you structure things wrong, you can make ArcMap totally unstable so such a resource is still needed.

MattWilkie1

What @curtvprice says above is still largely true. There aren't enough best practice examplars of fully fledged python toolboxes to study and learn from.