Skip to content

Improve and Move Docstrings #312

@FBumann

Description

@FBumann

Prerequisites

  • I have searched existing issues and discussions
  • I have checked the documentation

Feature Category

New Component (storage, generation, conversion, etc.)

Problem Statement

No response

Proposed Solution

Move all Docstrings of Init into classes.
Create assisted by AI
Include Code examples

Use Case & Examples

Python Docstring Best Practices

Placement

  • Classes: Immediately after class ClassName:
  • Functions/Methods: Right after def function_name():
  • Modules: Top of file, after imports

Format

  • Use """triple double quotes""" always (even for one-liners)
  • One-liner: Brief summary ending with period
  • Multi-line: Summary line + blank line + detailed sections

Content Priority

  1. What it does (user perspective, not implementation)
  2. How to use it (parameters, returns, examples)
  3. Important warnings (edge cases, constraints, exceptions)

Standard Structure

Follow PEP 257 + Google style for consistency:

class LinearConverter:
    """Convert flows using linear conversion factors.
    
    Longer description explaining the purpose and context.
    Multiple lines can be used here.
    
    Args:
        param1: Description of first parameter.
        param2: Description of second parameter with more detail
            if needed on multiple lines.
            
    Returns:
        Description of what the function returns.
        
    Raises:
        ValueError: When input validation fails.
        TypeError: When wrong type is provided.
        
    Examples:
        Basic usage:
        
        ```python
        converter = LinearConverter(
            inputs=[flow1],
            outputs=[flow2]
        )
        ```
        
    Note:
        Important additional information or constraints.
        
    Warning:
        Critical information about potential issues.
    """

Key Guidelines

  • User-focused: Write for the person using your code, not maintaining it
  • Be specific: "Calculate efficiency" not "Do calculations"
  • Include examples: Show real usage patterns
  • Keep it current: Update docstrings when code changes

Desired API (Optional)

Alternatives Considered

No response

Priority/Impact

High - Would significantly improve workflow

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions