Metadata generator from python toolboxes
Project description
PYT-Metadata
A Metadata tool for ArcGIS Toolboxes.
Description
The one line goal for this package is to attempt write everything related to your python toolbox tools in the python toolbox.
This means your code for the non-business logic (but could also include business logic), but also your metadata, which normally is completed in ArcGIS Pro/Desktop afterwards, often as an afterthought.
Since this leverages Markdown for the descriptions, writing simple full content is simple, but also allows for a lot of flexibility.
Install
This is tested in ArcGIS Pro only. It may work in ArcGIS Desktop, but I have not tested it.
This tool also requires arcpy
to be in the python install used for the module, as its calling arcpy.Parameter() to obtain some of the metadata details.
Installing is simple:
- Clone default ArcGIS Pro conda environment (if you have not already)
- Switch to target environment
- Install package
Install:
pip install PYT-Metadata
Security
Because this tool uses the imp module to load your toolbox from source, as pyt files are not loaded by python, you need to ensure the contents of the toolbox (and any imports) satisfy your security policies.
The TLDR is: make sure you know whats inside the toolbox code before running it.
Ultimately when you load the toolbox in arcgis desktop/pro it will run the code anyways, but as a best practice, you should understand the contents.
Since you're writing metadata for this, you'll likely be one of the authors, so should have a grasp on the contents.
Usage
To add metadata to your tool, a dictionary of meta_params
is required
Each tool will have its own key in the dictionary, using its name parameter, and the value should be a dictionary the dialog and python reference.
using a multi-line string for the text is recommended, but not required. Text is a markdown structure
See the ./example/working.pyt for an example.
meta_params = {
'tool_name_1': {
'dialog_reference': """
""",
},
'tool_name_2': {
'dialog_reference': """
""",
'python_reference': """
""",
},
"tags": ['tag1'],
'summary':"""
""",
'usage': """
"""
}
Once you have added your metadata, call it:
python -m PYT_Metadata -y ./example/working.pyt
If you do not include the -y it will prompt you to include it and a reminder about the imp module.
Output
The tool will overwrite existing files for the metadata. This means any changes made in ArcGIS Pro/Desktip will be overwritten.
Further, since this tool renders the HTML directly, it lets you add features not supported directly through the ArcGIS Metadata Editor, including codeblocks. If you edit the metadata in ArcGIS, these additional structures will be removed by ArcGIS.
Whats not supported?
- Geography Metadata
- Table Metadata
- ArcGIS Desktop (but may still work)
These may be a future addition, but are not currently supported.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for PYT_Metadata-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9420a1305ee5efcb5b56f5ec933b84bf7b8d6db8d012d0c426ee0f8a9a447b14 |
|
MD5 | f20cbc7c7f0bc90fe1a0698704d85138 |
|
BLAKE2b-256 | 6681a96ff2555a9f33db48f554131c954bd6c0ce4b81a166887c2d13671177d5 |