Best practices for sharing template including Python toolbox

1355
3
04-26-2021 11:28 AM
Labels (3)
RyanDavis1
Occasional Contributor

Hi -

Can anyone provide some guidance on sharing project templates?  I'm attempting to find best practices about how to properly share an .aptx template with colleagues.  The main pieces of the template are a Python toolbox, several layouts, and SDE connections.

Yes, I have already read both https://pro.arcgis.com/en/pro-app/latest/help/projects/create-your-own-project-template.htm and https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/package-project.htm, but perhaps I'm missing something obvious.

Background:  We are attempting to convert an internal tool from ArcMap to ArcGIS Pro.  The tool relies on Python scripts to generate a series of map PDFs.  We have successfully rewritten the scripts to use Python3 and arcpy.mp and converted .mxds to .pagxs.  Everything runs fine from the development .aprx.  That is, all of the PDFs are generated as desired.  I'm now attempting to package up a template .aptx, but I quickly run into errors when I run the Python tool.  The errors are not all that informative, and troubleshooting from the aptx-generated project is cumbersome.  I'm currently conjecturing that the issues might be related to file paths as the .aptx seems to add some lines of code and reorganize file locations in the project folder.  I'll add that the source files are saved on network folders, but it doesn't seem to make much difference if I use relative paths or absolute paths.

Thanks,

Ryan

0 Kudos
3 Replies
RyanDavis1
Occasional Contributor

Update:  Talked the problem over with some Esri folks.  As a result I am going to explore the use of geoprocessing packages (.gpkx) rather than project templates (.aptx).  I will come back to this post to update.

Tags (1)
SilasMathes
New Contributor

Ryan--I just came across your entry.  We have scripts we're trying to share via a template as well and the ESRI path changes cause the scripts to fail.  Did you end up going with the geoprocessing package instead?  Thanks, Silas

0 Kudos
RyanDavis1
Occasional Contributor

Hi @SilasMathes ,

No, after some exploring I found the .aptx less than ideal for our purposes. It's been long enough that I don't remember the exact issues now.

We ended up using a Python toolbox (.pyt) with supporting files (.py, .pagx, SDE connections, .lyrx, etc.) contained in a directory in the same folder as the .pyt. It generally works well, but development hasn't been without it's headaches.