Python toolbox documentation from within pyt file

889
1
Jump to solution
04-02-2019 08:35 AM
NilsRatnaweera1
New Contributor II

Python toolboxes are a great way to create custom, GUI toolboxes for ArcGIS without actually interacting with the GUI (since everything can be defined within the pyt file). Regrettably (and incomprehensibly) documenting a python toolbox does require the GUI (Documenting a tool in a Python toolbox). I'd like to document my toolbox as I'm developing it, and since my toolbox is constantly changing during development, I'd like code and documentation to live in the same file. 

This help page also states:

For Python toolboxes, the documentation for the toolbox and tools are stored in .xml files that are associated with the toolbox and tools by name.

Since Python supports writing xml, it shouldn't be too hard to add documentation within the pyt file and dynamically create the xml file. After all, a partially complete xml file is created every time I change my python toolbox. I would imagine an approach similar to Sphinx or roxygen2 for R.

This actually is already proposed as an ArcGIS Idea, Kory Kramer suggested asking here. 

How would something like this be achieved? I've attached the automatically generated, partially complete xml file.

0 Kudos
1 Solution

Accepted Solutions
NilsRatnaweera1
New Contributor II

I've actually been able to solve this some lines of python code. See my stackoverflow answer: arcpy - Python toolbox documentation from within pyt file - Geographic Information Systems Stack Exc... 

View solution in original post

1 Reply
NilsRatnaweera1
New Contributor II

I've actually been able to solve this some lines of python code. See my stackoverflow answer: arcpy - Python toolbox documentation from within pyt file - Geographic Information Systems Stack Exc...