Skip to content

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TechGen - Technical Diagram Generator

PyPI version Python version License: MIT

TechGen is a powerful Python library for generating technical diagrams, architecture charts, algorithm flowcharts, and sequence diagrams with AI-powered capabilities. Perfect for documentation, presentations, and technical illustrations.

✨ Features

🎨 Multiple Diagram Types

  • Algorithm Flowcharts: Visualize algorithm execution steps and logic flow
  • System Architecture Diagrams: Display system components and connections
  • Sequence Diagrams: Describe time-based interactions between components
  • Memory Layout Diagrams: Visualize memory allocation and states
  • Process Flow Diagrams: Batch processing workflows like vLLM

✍️ Handwritten Annotations

  • Handwritten-style annotation text
  • Curved arrow pointers
  • Multiple color and style options
  • Automatic text wrapping and positioning

🎯 Preset Styles

  • vLLM Style: Optimized for vLLM-type architecture diagrams
  • Algorithm Style: Color schemes for algorithm flowcharts
  • Architecture Style: Professional colors for system architecture
  • Sequence Style: Clear colors for timing diagrams

πŸ”§ Highly Customizable

  • Flexible configuration system
  • Custom color schemes
  • Adjustable component sizes
  • Grid backgrounds and legends support

πŸ€– AI-Powered Features

  • Natural language to diagram configuration
  • Automatic layout optimization
  • Smart component positioning
  • Intelligent color scheme selection

πŸš€ Quick Start

Installation

pip install techgen

Basic Usage

from techgen import TechDiagramGenerator, apply_preset

# Apply vLLM style preset
apply_preset("vllm_style")

# Create generator
generator = TechDiagramGenerator(width=800, height=600)

# Generate algorithm flowchart
algorithm_steps = [
    "Input sequence batch",
    "Tokenization",
    "Chunked Prefill",
    "KV Cache Management",
    "GPU Parallel Computing",
    "Output Generation"
]

# Add handwritten annotations
annotations = {
    "0": "Supports dynamic batching\nImproves throughput",
    "2": "Key optimization technique\nReduces memory usage"
}

# Generate SVG diagram
svg_content = generator.generate_algorithm_flowchart(
    algorithm_steps=algorithm_steps,
    title="vLLM Processing Flow",
    annotations=annotations
)

# Save to file
generator.save_diagram(svg_content, "vllm_flow.svg")

Generate Architecture Diagram

# Define system components
components = [
    {"name": "Frontend", "type": "default", "color": "#E3F2FD"},
    {"name": "API Gateway", "type": "network", "color": "#E8F5E8"},
    {"name": "Business Logic", "type": "cpu", "color": "#FFF3E0"},
    {"name": "Database", "type": "memory", "color": "#F3E5F5"}
]

# Define connections
connections = [(0, 1), (1, 2), (2, 3)]

# Generate architecture diagram
svg_content = generator.generate_architecture_diagram(
    components=components,
    connections=connections,
    title="System Architecture"
)

AI-Powered Generation

from techgen.ai import AIDiagramGenerator

# Create AI-powered generator
ai_generator = AIDiagramGenerator()

# Generate from natural language description
svg_content = ai_generator.generate_from_description(
    "Create a microservices architecture with load balancer,
    three service instances, and a database cluster",
    style="modern"
)

# Save the diagram
ai_generator.save_diagram(svg_content, "microservices_arch.svg")

πŸ“– Documentation

Configuration System

Using Presets

from techgen.config import apply_preset, get_config

# Apply preset
apply_preset("vllm_style")  # or "algorithm_flowchart", "architecture_diagram"

# Get configuration manager
config = get_config()
print(config.get_config_summary())

Custom Configuration

# Create custom preset
config.create_custom_preset("my_style", {
    "diagram": {
        "width": 1000,
        "height": 600,
        "background_color": "#F8F9FA",
        "enable_grid": True
    },
    "colors": {
        "primary": "#6C5CE7",
        "secondary": "#A29BFE",
        "accent": "#FD79A8"
    }
})

# Apply custom preset
apply_preset("my_style")

Command Line Interface

# Generate from configuration file
techgen generate --config my_diagram.json --output diagram.svg

# Generate from natural language
techgen generate --text "Create a REST API architecture" --output api.svg

# List available presets
techgen presets

# Apply preset and generate
techgen generate --preset vllm_style --config flow.json --output flow.svg

🎯 Examples

Algorithm Visualization

# QuickSort algorithm visualization
quicksort_steps = [
    "Choose pivot element",
    "Partition array",
    "Recursively sort left part",
    "Recursively sort right part",
    "Combine results"
]

svg_content = generator.generate_algorithm_flowchart(
    algorithm_steps=quicksort_steps,
    title="QuickSort Algorithm",
    annotations={"1": "O(n) partitioning\nO(n log n) average"}
)

Neural Network Architecture

# CNN architecture diagram
layers = [
    {"name": "Input (224x224x3)", "type": "input"},
    {"name": "Conv2D (64 filters)", "type": "convolution"},
    {"name": "MaxPool2D", "type": "pooling"},
    {"name": "Conv2D (128 filters)", "type": "convolution"},
    {"name": "GlobalAvgPool", "type": "pooling"},
    {"name": "Dense (1000 classes)", "type": "output"}
]

connections = [(i, i+1) for i in range(len(layers)-1)]

svg_content = generator.generate_architecture_diagram(
    components=layers,
    connections=connections,
    title="CNN Architecture"
)

πŸ—οΈ Project Structure

techgen/
β”œβ”€β”€ techgen/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ generator.py          # Core diagram generator
β”‚   β”œβ”€β”€ templates.py          # Templates and style management
β”‚   β”œβ”€β”€ renderer.py           # SVG rendering engine
β”‚   β”œβ”€β”€ config.py            # Configuration management system
β”‚   β”œβ”€β”€ ai.py                # AI-powered generation features
β”‚   β”œβ”€β”€ cli.py               # Command line interface
β”‚   └── examples/            # Example configurations
β”œβ”€β”€ tests/                   # Test suite
β”œβ”€β”€ docs/                    # Documentation
β”œβ”€β”€ examples/                # Usage examples
└── setup.py                # Package setup

πŸ§ͺ Testing

# Run all tests
python -m pytest

# Run specific test category
python -m pytest tests/test_generator.py

# Run with coverage
python -m pytest --cov=techgen tests/

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by modern architecture visualization tools
  • Built with SVG for scalable vector graphics
  • AI features powered by state-of-the-art language models

πŸ”— Links

About

TechGen is a powerful Python library for generating technical diagrams, architecture charts, algorithm flowcharts, and sequence diagrams with AI-powered capabilities. Perfect for documentation, presentations, and technical illustrations.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages