Skip to content

Release 0.1.2 – Structured Route Parsing & Improved Class Rendering

Latest

Choose a tag to compare

@ProudRykar ProudRykar released this 22 Feb 01:30
bd0dd81

Overview

This release enhances the Gutarik documentation generator with structured HTTP route parsing, improved class rendering, and safer AST-based decorator analysis.
The generator now produces cleaner, more readable Markdown output for modern Python web frameworks.


What's New

Structured HTTP Route Extraction

  • AST-based parsing of HTTP decorators (e.g., @get, @post, etc.).

  • Extracts:

    • HTTP method
    • Route path
    • Summary
    • Description
    • Tags
    • Status code (defaults to 200 if not provided)
  • Ignores heavy nested arguments like responses, examples, and dependencies to keep documentation clean.

  • Renders route metadata in a structured Markdown format instead of raw decorator strings.

Example output:

#### Route:

- Decorator: @post
- Path: `/logout`
- Summary: Logout user
- Description: Endpoint for user logout.
- Tags: Authentication
- Status Code: 200

Improved Class Rendering

  • Extracts and renders the top section of a class:

    • Class decorators
    • Signature
    • Annotated attributes
  • Stops before the first method definition.

  • Displays the extracted fragment inside a dedicated Python code block.

  • Preserves formatting using AST line boundaries (no fragile string slicing).


Decorator Handling Refactor

  • Replaced string-based decorator parsing with AST-based analysis.
  • Removed truncation logic that caused decorator output to be cut off.
  • Eliminated regex-dependent formatting issues.
  • Ensures stable behavior for multi-line decorators.

Markdown Formatting Improvements

  • Better separation of routes, arguments, and code blocks.
  • Improved escaping logic.
  • Cleaner layout for class and method sections.

Technical Improvements

  • Safer AST traversal with proper scope handling.
  • Fixed UnboundLocalError related to decorator metadata extraction.
  • Improved internal data structure for storing route metadata.
  • Cleaner separation between extraction and rendering stages.

Installation

poetry add gutarik

Usage

Generate documentation:

poetry run gutarik

Push to GitHub Wiki:

poetry run gutarik --push

Notes

  • Focus remains on Python projects with Google-style docstrings.
  • Route parsing is optimized for modern decorator-based frameworks.
  • Complex decorator arguments are intentionally omitted from rendered route metadata for clarity.