chore: remove pygraphviz

This commit is contained in:
Umut
2022-08-18 10:13:52 +02:00
parent caebde9d51
commit 3aef4cd932
18 changed files with 171 additions and 435 deletions

View File

@@ -14,7 +14,7 @@
* [Extensions](tutorial/extensions.md)
* [Table Lookups](tutorial/table\_lookup.md)
* [Floating Points](tutorial/floating\_points.md)
* [Format and Draw](tutorial/formatting\_and\_drawing.md)
* [Format](tutorial/formatting.md)
## How To

View File

@@ -58,7 +58,7 @@ make show_scope
```shell
git commit -m "feat: implement bounds checking"
git commit -m "feat(debugging): add an helper function to draw intermediate representation"
git commit -m "feat(debugging): add an helper function to print intermediate representation"
git commit -m "fix(tracing): fix a bug that crashed pytorch tracer"
```

View File

@@ -7,7 +7,7 @@ Some terms used throughout the project include:
* computation graph - a data structure to represent a computation. This is basically a directed acyclic graph in which nodes are either inputs, constants or operations on other nodes.
* tracing - the technique that takes a Python function from the user and generates the corresponding computation graph in an easy to read format.
* bounds - before a computation graph is converted to MLIR, we need to know which node will output which type (e.g., uint3 vs euint5). Computation graphs with different inputs must remember the minimum and maximum values for each node, which is what we call bounds, and use bounds to determine the appropriate type for each node
* circuit - the result of compilation. A circuit is made of the client and server components and has methods, everything from printing and drawing to evaluation.
* circuit - the result of compilation. A circuit is made of the client and server components and has methods, everything from printing to evaluation.
## Module structure

View File

@@ -15,17 +15,6 @@ pip install concrete-numpy
Apple silicon users must use docker installation (explained below) as there is no ARM version of some of our dependencies for the time being.
{% endhint %}
You can install the extra python dependencies for drawing circuits:
```shell
pip install -U pip wheel setuptools
pip install concrete-numpy[full]
```
{% hint style="info" %}
**Concrete Numpy** depends on `pygraphviz` for drawing, which requires `graphviz` packages to be installed on your system (see [pygraphviz installation documentation](https://pygraphviz.github.io/documentation/stable/install.html)).
{% endhint %}
## Using Docker
You can also get the **Concrete Numpy** docker image:

View File

@@ -3,13 +3,12 @@
PyYAML 6.0 MIT License
concrete-compiler 0.15.0 BSD-3
cycler 0.11.0 BSD License
fonttools 4.34.4 MIT License
fonttools 4.36.0 MIT License
kiwisolver 1.4.4 BSD License
matplotlib 3.5.3 Python Software Foundation License
networkx 2.8.5 BSD License
numpy 1.23.1 BSD License
numpy 1.23.2 BSD License
packaging 21.3 Apache Software License; BSD License
pygraphviz 1.9 BSD License
pyparsing 3.0.9 MIT License
python-dateutil 2.8.2 Apache Software License; BSD License
setuptools-scm 6.4.2 MIT License

View File

@@ -0,0 +1,19 @@
# Format
Sometimes, it can be useful to print circuits. We provide methods to just do that.
## Formatting
You can convert your compiled circuit into its textual representation by converting it to string:
<!--pytest-codeblocks:skip-->
```python
str(circuit)
```
If you just want to see the output on your terminal, you can directly print it as well:
<!--pytest-codeblocks:skip-->
```python
print(circuit)
```

View File

@@ -1,64 +0,0 @@
# Format and Draw
Sometimes, it can be useful to format or draw circuits. We provide methods to just do that.
## Formatting
You can convert your compiled circuit into its textual representation by converting it to string:
<!--pytest-codeblocks:skip-->
```python
str(circuit)
```
If you just want to see the output on your terminal, you can directly print it as well:
<!--pytest-codeblocks:skip-->
```python
print(circuit)
```
## Drawing
{% hint style="danger" %}
Drawing functionality requires the installation of the package with a full feature set. See the Installation section to learn how to do that.
{% endhint %}
You can use the `draw` method of your compiled circuit to draw it:
<!--pytest-codeblocks:skip-->
```python
drawing = circuit.draw()
```
This method will draw the circuit on a temporary PNG file and return the path to this file.
You can show the drawing in a Jupyter notebook, like this:
<!--pytest-codeblocks:skip-->
```python
from PIL import Image
drawing = Image.open(circuit.draw())
drawing.show()
drawing.close()
```
Or, you can use the `show` option of the `draw` method to show the drawing with matplotlib.
<!--pytest-codeblocks:skip-->
```python
circuit.draw(show=True)
```
{% hint style="danger" %}
Beware that this will clear the matplotlib plots you have.
{% endhint %}
Lastly, you can save the drawing to a specific path:
<!--pytest-codeblocks:skip-->
```python
destination = "/tmp/path/of/your/choice.png"
drawing = circuit.draw(save_to=destination)
assert drawing == destination
```