Skip to main content

Automatically generate beautiful documentation diagrams from Python code

Project description

🎨 RenderSchema

Automatically generate beautiful documentation diagrams from Python code

PyPI version 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.1.tar.gz (27.0 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.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: renderschema-0.1.1.tar.gz
  • Upload date:
  • Size: 27.0 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.1.tar.gz
Algorithm Hash digest
SHA256 9f7f35f5d22282c0a34fec2833713a539dc343c0c4edfbde19abdd648ca4d4a0
MD5 0cc3186ad9dfd1db85e8bdbd7cd31a19
BLAKE2b-256 5b52bdccfb2e77afffaf6f870a3b8e89edb110f887ea35c526d418f1d26376bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: renderschema-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ae67390b3948d067f9e4a45e14e78dd049ed3c2b36e6f8aa2994b1e39a31f123
MD5 7a63d5bb49f90ea9a74fb0b4fcfd9c5b
BLAKE2b-256 dfc8e3e7347b24dd375e07d82743316e68422b80231804e27bdf584bc7c2499a

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