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.
- 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-style annotation text
- Curved arrow pointers
- Multiple color and style options
- Automatic text wrapping and positioning
- 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
- Flexible configuration system
- Custom color schemes
- Adjustable component sizes
- Grid backgrounds and legends support
- Natural language to diagram configuration
- Automatic layout optimization
- Smart component positioning
- Intelligent color scheme selection
pip install techgenfrom 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")# 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"
)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")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())# 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")# 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# 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"}
)# 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"
)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
# 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/We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Inspired by modern architecture visualization tools
- Built with SVG for scalable vector graphics
- AI features powered by state-of-the-art language models