Skip to content

Commit 92f8596

Browse files
committed
containerize-environment: Add docker container with preinstalled recursion-tree-visualiser
1 parent f35366c commit 92f8596

File tree

3 files changed

+56
-10
lines changed

3 files changed

+56
-10
lines changed

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
FROM python:3.6-slim
2+
RUN apt-get update
3+
RUN apt-get -y install graphviz
4+
ADD . /vs
5+
WORKDIR /vs
6+
RUN pip install recursion-visualiser

README.md

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,62 @@ Just add the recursion-visualiser decorator to your function and let it do the r
1616

1717

1818
## Installation
19-
The only dependency for recursion visualiser is Graphviz which you can download from [here](https://www.graphviz.org/download/)
20-
21-
- Download [graphviz binary](https://www.graphviz.org/download/)
19+
### 1. Installing graphviz
20+
#### Windows
21+
The only dependency for recursion visualiser is Graphviz
22+
- Download [graphviz binary](https://www2.graphviz.org/Packages/stable/windows/10/msbuild/Release/Win32/)
2223
- Add graphviz bin to path manually or by adding the following line on your script. Change the installation directory according to your installation path
23-
2424
```
2525
# Set it to bin folder of graphviz
2626
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'
2727
```
28-
2928

29+
#### Ubuntu
30+
- Install graphviz
31+
```
32+
sudo apt install graphviz
33+
```
34+
35+
> The instructions to install graphviz for other operating system is available [here](https://www.graphviz.org/download/#linux)
36+
37+
### 2. Installing recursion-visualiser
38+
3039
The easiest way to install ```recursion-visualiser``` package is from [pypi](https://pypi.org/project/recursion-visualiser/)
3140
```
3241
pip install recursion-visualiser
3342
```
34-
The preferred way to import the decorator class from the package is as:
35-
```python
36-
from visualiser.visualiser import Visualiser as vs
37-
```
43+
3844

3945
An alternative way is to clone the repository and install all the requirements.
4046
```
4147
pip install -r requirements.txt
4248
```
4349

50+
## Alternative Installation using Docker
51+
If you have `docker` and `docker-compose` installed then you can install `recursion-tree-visualiser` using `Docker` and `docker-compose.yml` file
52+
1. Download `Docker` file from repo
53+
```bash
54+
curl https://raw.githubusercontent.com/Bishalsarang/Recursion-Tree-Visualizer/master/Dockerfile --output Dockerfile
55+
```
56+
57+
3. Download `docker-compose.yml`
58+
```bash
59+
curl https://raw.githubusercontent.com/Bishalsarang/Recursion-Tree-Visualizer/master/docker-compose.yml --output docker-compose.yml
60+
```
61+
5. Start docker container
62+
```bash
63+
CURRENT_UID=$(id -u):$(id -g) docker-compose up
64+
```
65+
66+
7. Run any python scripts and run using
67+
```
68+
docker-compose exec vs python fibonacci.py
69+
```
4470
## Usage
71+
The preferred way to import the decorator class from the package is as:
72+
```python
73+
from visualiser.visualiser import Visualiser as vs
74+
```
4575
### 1. Fibonacci
4676
Let's draw the recursion tree for fibonacci number.
4777
Here is how the simple code looks like
@@ -98,7 +128,7 @@ Animation:
98128
# Support:
99129
Find other examples [here](https://github.com/Bishalsarang/Recursion-Tree-Visualizer/tree/master/examples)
100130
and read more about **recursion-visualiser** [here](https://github.com/Bishalsarang/Recursion-Tree-Visualizer/blob/master/Examples.md)
101-
The official documentation for recursion-visualiser is available at [https://recursion-visualiser.readthedocs.io/en/](https://recursion-visualiser.readthedocs.io/en/latest/) ![](https://img.shields.io/badge/under-progress-green)
131+
102132

103133
## TODO:
104134
- [x] Minimal working version

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3.6"
2+
services:
3+
vs:
4+
build: .
5+
container_name: recursion-visualiser-env
6+
stdin_open: true
7+
tty: true
8+
user: ${CURRENT_UID}
9+
volumes:
10+
- .:/vs

0 commit comments

Comments
 (0)