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.2.tar.gz (37.5 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.2-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: renderschema-0.1.2.tar.gz
  • Upload date:
  • Size: 37.5 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.2.tar.gz
Algorithm Hash digest
SHA256 13d9ab2c77bbf75bcc3662d3ef78255bf430f94abfb998251409ea4a4c6b3b90
MD5 6a9d15e1c9480cb4c33c7030a2f846ad
BLAKE2b-256 cebc6f1199064df296444c433341820c2bbb89d4a829185e775d71cbe35891e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: renderschema-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.1 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fd0e60581976ff61607477bf555c680eb0a2f24c6a4e4a636c95996a4db56c81
MD5 3cac0d7edd2504094443b3cfbcad8817
BLAKE2b-256 63edbfb12938a271f7892b752f7d326da36e2a97c1cdf12f647e46e1bd251137

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