Metadata-Version: 2.1
Name: iceberg-dsl
Version: 0.0.1
Summary: A compositional diagramming tool for Python.
Home-page: https://github.com/revalo/iceberg
Author: Shreyas Kapur
Author-email: srkp@berkeley.edu
Maintainer: Shreyas Kapur
Maintainer-email: srkp@berkeley.edu
License: MIT
Project-URL: Documentation, https://github.com/revalo/iceberg/README.md
Project-URL: Code, https://github.com/revalo/iceberg
Project-URL: Issue tracker, https://github.com/revalo/iceberg/issues
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# IceBerg

<img src="images/logo.png" width="150">

Iceberg is a compositional diagramming and graphics library embedding in Python. It is designed to be performant, extensible, and easy to use.

## Showcase

### Neural Network

A composable Neural Network diagramming class written in iceberg. Full example in `examples/neural_network.py`.

<img src="images/nn.png" width="500">

```python
network = NeuralNetwork(
    # Number of nodes in each layer!
    [3, 4, 4, 2],
    node_border_color=Colors.BLACK,
    line_path_style=PathStyle(Colors.BLACK, thickness=3),
)
node = network.layer_nodes[1][0]
node.border_color = Colors.RED
node.border_thickness = 5

canvas = Blank(Bounds(size=(1080, 720)), background=Colors.WHITE)
scene = canvas.center_to(network)

renderer = Renderer()
renderer.render(scene)
renderer.save_rendered_image("test.png")

```


## Install

The library is still under heavy development, hence updates are frequent. To install the latest version, run the following command:

```
pip install -U iceberg-dsl
```

## Quickstart

Full example in `examples/quickstart.py`.

```python
from iceberg import Blank, Bounds, Rectangle, Colors, Text, FontStyle, Directions, Renderer

# Blank is a large empty rectangle.
canvas = Blank(Bounds(size=(1080, 720)))

# Create a rectangle.
rectangle = Rectangle(
    Bounds(size=(500, 100)),
    Colors.WHITE,
    border_thickness=3,
)

# Create a text.
text = Text(
    text="Hello, World!",
    font_style=FontStyle(
        family="Arial",
        size=28,
        color=Colors.WHITE,
    ),
)

# Place the text below the rectangle.
rectangle_and_text = rectangle.next_to(text, Directions.DOWN * 10)

# Center the rectangle and text combination to the canvas.
scene = canvas.center_to(rectangle_and_text)

# Render the scene and save it to a file.
renderer = Renderer()
renderer.render(scene)
renderer.save_rendered_image("test.png")
```

Should produce:

<img src="images/quickstart.png" width="500">


