Select to view content in your preferred language

Best practices for a Toolbox on GitHub

375
1
2 weeks ago
KurtSchwehr
New Contributor

Hi all,

I'm looking for examples of best practices setting up a python toolbox on GitHub. We have a pre-commit that reformats the xml so that the diffs are usable in review. We are looking to do:

  • pre-commit for black python formatting
  • pre-commit for codespell
  • run mypy to check type annotations that includes definitions for arcpy
  • CI testing that mocks or fakes arcpy
  • github action to publish to PyPI
  • add a pyproject.toml

I'm looking for examples of any of those and suggestions for anything else that we should do to make the toolbox easier to use and maintain. Our repository is here:

https://github.com/gee-community/arcgis-earthengine-toolbox

Thanks!

-Kurt

1 Reply
KurtSchwehr
New Contributor

black/ruff/codespell/doc8/mypy and the like are fairly standard with lots of examples around, but I would love to see github repos for toolboxes that do any of this as it is an indicator of possibly other useful things that can be done to improve the code quality and test the toolbox on github.

And mocking / faking shouldn't have the size of the API stop anyone from doing it.

  1. mock / MagicMock can get started without needing to do anything specific for the API.
  2. There is probably a small core of things that need to be provided in a fake to hit the majority of things that a toolbox would need. 

Looking at the Earth Engine toolbox, there isn't that much there:

`find . -name \*.py\* | grep -v xml | xargs egrep -h 'arcpy\.'  | cut -d\( -f1`

  • arcpy.mp.ArcGISProject
  • arcpy.AddError 
  • arcpy.AddWarning
  • arcpy.conversion.JSONToFeatures
  • arcpy.FeaturesToJSON_conversion
  • arcpy.management.Delete
  • arcpy.Extent
  • arcpy.SpatialReference
  • arcpy.Parameter
  • arcpy.Point
  • arcpy.PointGeometry
  • arcpy.Describe
0 Kudos