<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>idea Support Tool Attributes in Python Toolboxes in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/support-tool-attributes-in-python-toolboxes/idi-p/1630065</link>
    <description>&lt;P&gt;ArcGIS Pro 3.4 adds &lt;A href="https://pro.arcgis.com/en/pro-app/3.4/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm#LI_D322747FED4A47FBA38265FEF869FEB1" target="_self"&gt;Attributes&lt;/A&gt; to the toolbox spec which adds extra options to script tools that were previously limited to default tools. The catch: these can't be added to Python Toolbox tools, at least not in any stable or documented way.&lt;/P&gt;&lt;P&gt;Please add support for Python Toolboxes. An "attributes" property on each tool that stores a list of attributes to set would align with how ATBX files store this info, something like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool:
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Tool"
        self.description = "My tool that edits the input data and costs credits."
        self.attributes = ["input_data_change", "credits"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jul 2025 18:06:39 GMT</pubDate>
    <dc:creator>DavidSolari</dc:creator>
    <dc:date>2025-07-03T18:06:39Z</dc:date>
    <item>
      <title>Support Tool Attributes in Python Toolboxes</title>
      <link>https://community.esri.com/t5/python-ideas/support-tool-attributes-in-python-toolboxes/idi-p/1630065</link>
      <description>&lt;P&gt;ArcGIS Pro 3.4 adds &lt;A href="https://pro.arcgis.com/en/pro-app/3.4/help/analysis/geoprocessing/basics/create-a-python-script-tool.htm#LI_D322747FED4A47FBA38265FEF869FEB1" target="_self"&gt;Attributes&lt;/A&gt; to the toolbox spec which adds extra options to script tools that were previously limited to default tools. The catch: these can't be added to Python Toolbox tools, at least not in any stable or documented way.&lt;/P&gt;&lt;P&gt;Please add support for Python Toolboxes. An "attributes" property on each tool that stores a list of attributes to set would align with how ATBX files store this info, something like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool:
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Tool"
        self.description = "My tool that edits the input data and costs credits."
        self.attributes = ["input_data_change", "credits"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 18:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/support-tool-attributes-in-python-toolboxes/idi-p/1630065</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-07-03T18:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Support Tool Attributes in Python Toolboxes</title>
      <link>https://community.esri.com/t5/python-ideas/support-tool-attributes-in-python-toolboxes/idc-p/1630159#M489</link>
      <description>&lt;P&gt;I think adding a Protocol and a Literal for the attributes would be a good idea:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from typing import Protocol, Literal
from arcpy import Parameter

ToolAttribute = Literal[
    'show_modification_banner',
    'add_to_map',
    'enable_undo',
    'show_credit_banner',
]

class ToolProto(Protocol):
    """Tool protocol for Python PYT tools"""
    
    def __init__(self) -&amp;gt; None: ... 
    def getParameterInfo(self) -&amp;gt; list[Parameter]: ...
    def isLicensed(self) -&amp;gt; bool: ...
    def updateParameters(self, parameters: list[Parameter]) -&amp;gt; None: ...
    def updateMessages(self, parameters: list[Parameter]) -&amp;gt; None: ...
    def execute(self, parameters: list[Parameter], messages: list) -&amp;gt; None: ...
    def postExecute(self, parameters: list[Parameter]) -&amp;gt; None: ...


# Alternative inheritable base class 
class ToolBase:
    """Tool base for Python PYT tools"""
    
    def __init__(self) -&amp;gt; None:
        self.description: str | None = None
        self.label: str | None = None
        self.category: str | None = None
        self.attributes: list[ToolAttribute] | None = None
        
    def getParameterInfo(self) -&amp;gt; list[Parameter]: ...
    def isLicensed(self) -&amp;gt; bool: ...
    def updateParameters(self, parameters: list[Parameter]) -&amp;gt; None: ...
    def updateMessages(self, parameters: list[Parameter]) -&amp;gt; None: ...
    def execute(self, parameters: list[Parameter], messages: list) -&amp;gt; None: ...
    def postExecute(self, parameters: list[Parameter]) -&amp;gt; None: ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could add docstrings to the Tool methods as well to make it easier to see&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 20:38:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/support-tool-attributes-in-python-toolboxes/idc-p/1630159#M489</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2025-07-03T20:38:03Z</dc:date>
    </item>
  </channel>
</rss>

