This project uses numpydoc style for all docstrings.
Required Sections
Short description — One-line summary of what the function does
Extended description — Detailed explanation (optional but recommended)
Parameters — Document each parameter with type and description
Returns — Document return value(s)
Optional Sections
Raises — Document exceptions that may be raised
Examples — Provide usage examples
Notes — Additional context or implementation details
See Also — Related functions
Example Docstring
@logdeflist_workspaces(
capacity: Optional[str | UUID] = None,
workspace_state: Optional[str] = None,
) -> pd.DataFrame:
"""
Lists workspaces for the organization.
This is a wrapper function for the following API: `Workspaces - List Workspaces <https://learn.microsoft.com/rest/api/fabric/admin/workspaces/list-workspaces>`_.
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
Parameters
----------
capacity : str | uuid.UUID, default=None
Returns only the workspaces in the specified Capacity.
workspace_state : str, default=None
Return only the workspace with the requested state.
You can find the possible states in `Workspace States <https://learn.microsoft.com/rest/api/fabric/admin/workspaces/list-workspaces?tabs=HTTP#workspacestate>`_.
Returns
-------
pandas.DataFrame
A pandas dataframe showing a list of workspaces for the organization.
Columns include: 'Id', 'Name', 'State', 'Type', 'Capacity Id'.
Raises
------
FabricHTTPException
If the API request fails.
Examples
--------
>>> import sempy_labs as labs
>>> df = labs.list_workspaces()
>>> df = labs.list_workspaces(capacity="My Capacity")
"""pass
Parameter Documentation Patterns
Standard Parameter Formats
# Simple parameter
item_type : str
The type of item to filter by.
# Parameter with default
item_type : str, default=None
The type of item to filter by. If None, returns all types.
# Union type parameter
workspace : str | uuid.UUID, default=None
The Fabric workspace name or ID.
Defaults to None which resolves to the workspace of the attached lakehouse
orif no lakehouse attached, resolves to the workspace of the notebook.
# Boolean parameter
readonly : bool, default=True
If True, opens in read-only mode. If False, allows modifications.
# List parameter
columns : List[str], default=None
A list of column names to include. If None, includes all columns.
API Reference Links
Always include links to API documentation:
"""
This is a wrapper function for the following API: `Items - List Items <https://learn.microsoft.com/rest/api/fabric/core/items/list-items>`_.
"""
Service Principal Note
For functions supporting Service Principal authentication:
"""
Service Principal Authentication is supported (see `here <https://github.com/microsoft/semantic-link-labs/blob/main/notebooks/Service%20Principal.ipynb>`_ for examples).
"""
Common Documentation Issues
Missing or Incomplete Docstrings
Symptom: Sphinx warning about missing docstring.
Fix: Add complete numpydoc-style docstring with all required sections.
Type Annotation Mismatches
Symptom: Warning about type mismatch between signature and docstring.
Fix: Ensure docstring parameter types match function signature type hints.