Skip to main content

Automatically generate beautiful documentation diagrams from Python code

Project description

🎨 RenderSchema

Automatically generate beautiful documentation diagrams from Python code

Python Version License: MIT Code style: black


✨ Features

  • 🚀 Zero-Config Diagram Generation - Turn Python classes into UML diagrams with one line of code
  • 🎨 Beautiful by Default - Clean, modern diagrams with Tailwind-inspired color schemes
  • 🌓 Light & Dark Themes - Perfect for documentation in any style
  • 📊 Multiple Diagram Types - UML class diagrams, flowcharts, and class relationships
  • 🖼️ Multiple Export Formats - SVG, PNG, PDF, and interactive HTML
  • 🔍 Interactive HTML - Zoomable, pannable diagrams for web documentation
  • 🎯 Type-Safe - Full type hints for excellent IDE support
  • 📦 Framework Integration - Works seamlessly with Sphinx, MkDocs, and more

🎯 Why RenderSchema?

Developers love diagrams but hate making them. RenderSchema solves this by automatically generating clean, professional diagrams from your Python code. No more manual diagramming tools or outdated documentation!

📦 Installation

# Basic installation
pip install renderschema

# With PNG/PDF export support
pip install renderschema[image]

# Full installation (all features)
pip install renderschema[all]

🚀 Quick Start

Generate a UML Diagram

from renderschema import diagram

class Person:
    def __init__(self, name: str, age: int):
        self.name = name
        self.age = age
    
    def greet(self) -> str:
        return f"Hello, I'm {self.name}!"

# Generate diagram - it's that simple!
diagram(Person).export("person.svg")

Create a Flowchart

from renderschema import diagram

def calculate_discount(price: float, customer_type: str) -> float:
    if customer_type == "vip":
        return price * 0.8
    elif customer_type == "premium":
        return price * 0.9
    else:
        return price

diagram(calculate_discount, diagram_type="flowchart").export("discount.svg")

Visualize Class Relationships

from renderschema import diagram

class Animal:
    pass

class Dog(Animal):
    def bark(self): pass

class Cat(Animal):
    def meow(self): pass

diagram([Animal, Dog, Cat], diagram_type="class").export("animals.svg")

🎨 Themes

RenderSchema supports both light and dark themes:

# Light theme (default)
diagram(MyClass, theme="light").export("light.svg")

# Dark theme - perfect for dark mode documentation
diagram(MyClass, theme="dark").export("dark.svg")

📤 Export Formats

Export to multiple formats based on your needs:

# SVG - vector graphics, perfect for web and scaling
diagram(MyClass).export("output.svg")

# PNG - raster image (requires cairosvg)
diagram(MyClass).export("output.png")

# PDF - for print documentation (requires cairosvg)
diagram(MyClass).export("output.pdf")

# Interactive HTML - zoomable and pannable
diagram(MyClass).export("output.html")

💡 Advanced Usage

Get Diagrams as Strings

# Get SVG markup as string
svg_content = diagram(MyClass).to_svg()

# Get interactive HTML as string
html_content = diagram(MyClass).to_html(interactive=True)

Analyze Before Generating

generator = diagram(MyClass)
data = generator.analyze()  # Get structured data about the class
svg = generator.generate()   # Generate the diagram

Custom Options

# Customize diagram generation
diagram(
    MyClass,
    theme="dark",
    color_scheme="tailwind"
).export("custom.svg")

📚 Documentation

🛠️ Development

Setup Development Environment

# Clone the repository
git clone https://github.com/juliuspleunes4/RenderSchema.git
cd RenderSchema

# Install with development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Format code
black renderschema/ tests/

# Lint code
ruff check renderschema/ tests/

# Type check
mypy renderschema/

Running Examples

cd examples
python basic_uml.py
python flowchart_example.py
python class_relationships.py

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

Important: All changes must be documented in docs/CHANGELOG.md. Never create separate .md files to explain changes.

📝 License

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

🎯 Roadmap

  • More diagram types (sequence diagrams, state machines)
  • Custom styling and color schemes
  • Advanced layout algorithms
  • Integration with popular documentation tools
  • Module and package-level diagrams
  • Real-time diagram preview in editors

🙏 Acknowledgments

Built with ❤️ by Julius Pleunes

Inspired by the need for effortless, beautiful diagram generation for Python developers.


⬆ back to top

Made with ❤️ for the Python community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

renderschema-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

renderschema-0.1.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file renderschema-0.1.0.tar.gz.

File metadata

  • Download URL: renderschema-0.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for renderschema-0.1.0.tar.gz
Algorithm Hash digest
SHA256 845b1675d8b8dd2d252a3318e073b1b0c05526f7d0a0610ba7bc2d052b1714e1
MD5 4200e08ffa48a97ee4e2c82803a6cd04
BLAKE2b-256 3439c5bc31374fb8417e3be45027ed0d3caeb190d6bc5e16cb44b482d6e1d7d0

See more details on using hashes here.

File details

Details for the file renderschema-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: renderschema-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for renderschema-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 67a8f21a752ca23f5f8760485fde54a6fc87410d62bc61063ffcdf12f0dbca6e
MD5 922fa6ef4b922895f51ade16f4f163f6
BLAKE2b-256 e1961f9634b76f953b8582204d5c4c87cf7c66b9cf19030e18ddb8c4c1c83464

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page