Skip to content

Commit 5a40e5d

Browse files
committed
Copy over docs from #97
1 parent 72ae681 commit 5a40e5d

File tree

4 files changed

+162
-6
lines changed

4 files changed

+162
-6
lines changed

docs/contributing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Contributing
1+
```{include} ../.github/contributing.md
22
3-
The documentation of MQT NAViz is still under construction.
3+
```

docs/installation.md

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,118 @@
11
# Installation
22

3-
The documentation of MQT NAViz is still under construction.
3+
MQT NAViz is mainly developed as a Rust library with Python bindings.
4+
The resulting Python package is available on [PyPI](https://pypi.org/project/mqt.naviz/) and can be installed on all major operating systems using all modern Python versions.
5+
6+
:::::{tip}
7+
We highly recommend using [`uv`](https://docs.astral.sh/uv/) for working with Python projects.
8+
It is an extremely fast Python package and project manager, written in Rust and developed by [Astral](https://astral.sh/) (the same team behind [`ruff`](https://docs.astral.sh/ruff/)).
9+
It can act as a drop-in replacement for `pip` and `virtualenv`, and provides a more modern and faster alternative to the traditional Python package management tools.
10+
It automatically handles the creation of virtual environments and the installation of packages, and is much faster than `pip`.
11+
Additionally, it can even set up Python for you if it is not installed yet.
12+
13+
If you do not have `uv` installed yet, you can install it via:
14+
15+
::::{tab-set}
16+
17+
:::{tab-item} macOS and Linux
18+
19+
```console
20+
$ curl -LsSf https://astral.sh/uv/install.sh | sh
21+
```
22+
23+
:::
24+
25+
:::{tab-item} Windows
26+
27+
```console
28+
$ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
29+
```
30+
31+
:::
32+
33+
::::
34+
35+
Check out their excellent [documentation](https://docs.astral.sh/uv/) for more information.
36+
37+
:::::
38+
39+
::::{tab-set}
40+
:sync-group: installer
41+
42+
:::{tab-item} uv _(recommended)_
43+
:sync: uv
44+
45+
```console
46+
$ uv pip install mqt.naviz
47+
```
48+
49+
:::
50+
51+
:::{tab-item} pip
52+
:sync: pip
53+
54+
```console
55+
(.venv) $ python -m pip install mqt.naviz
56+
```
57+
58+
:::
59+
60+
::::
61+
62+
In most practical cases (under 64-bit Linux, MacOS incl. Apple Silicon, and Windows), this requires no compilation and merely downloads and installs a platform-specific pre-built wheel.
63+
64+
Once installed, you can check if the installation was successful by running:
65+
66+
<!-- todo: adapt the following code -->
67+
68+
```console
69+
(.venv) $ python -c "import mqt.naviz; print(mqt.naviz.__version__)"
70+
```
71+
72+
which should print the installed version of the library.
73+
74+
## Building from source for performance
75+
76+
For building MQT NAViz from the source, take a look at the {doc}`Development Guide <development_guide>`.
77+
78+
## Integrating MQT NAViz into your project
79+
80+
If you want to use the MQT Naviz Python package in your own project, you can simply add it as a dependency in your `pyproject.toml` or `setup.py` file.
81+
This will automatically install the MQT Naviz package when your project is installed.
82+
83+
::::{tab-set}
84+
85+
:::{tab-item} uv _(recommended)_
86+
87+
```console
88+
$ uv add mqt.naviz
89+
```
90+
91+
:::
92+
93+
:::{tab-item} pyproject.toml
94+
95+
```toml
96+
[project]
97+
# ...
98+
dependencies = ["mqt.naviz>=0.1.1"]
99+
# ...
100+
```
101+
102+
:::
103+
104+
:::{tab-item} setup.py
105+
106+
```python
107+
from setuptools import setup
108+
109+
setup(
110+
# ...
111+
install_requires=["mqt.naviz>=0.1.1"],
112+
# ...
113+
)
114+
```
115+
116+
:::
117+
118+
::::

docs/support.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Support
1+
```{include} ../.github/support.md
22
3-
The documentation of MQT NAViz is still under construction.
3+
```

docs/usage.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
# Usage
22

3-
The documentation of MQT NAViz is still under construction.
3+
## Standalone Application
4+
5+
NAViz allows opening `.naviz` instruction files or importing instructions from external formats such as `mqt na` under the `File` menu.
6+
Alternatively, files can simply be dropped onto or pasted into the application.
7+
You can read more about the supported file formats in the {doc}`file format documentation <file_format>`.
8+
9+
The machine and style can be selected from the `Machine` and `Style` menus respectively.
10+
These menus allow selecting a config from the loaded configs as well as opening or importing a new config.
11+
12+
When the animation plays, the progress bar at the bottom of the window can be used to seek through the visualization.
13+
14+
## Python Package
15+
16+
The python library currently only exports a simple functionality to export a visualization as a video.
17+
An example can be seen below:
18+
19+
```python
20+
from naviz import *
21+
22+
# Get machine and style from repository
23+
machine = Repository.machines().get("example")
24+
style = Repository.machines().get("tum")
25+
26+
# Alternatively, you can also use manual configurations
27+
machine = "<...>"
28+
style = "<...>"
29+
30+
# Render `naviz` instructions to `out.mp4` at 1080p60
31+
export_video("<naviz instructions>", "out.mp4", (1920, 1080), 60, machine, style)
32+
33+
# Render `mqt na` instructions to `out.mp4` at 1080p60 with the default import options
34+
# Alternatively, substitute the call to `default_import_settings` with your custom import settings
35+
export_video(
36+
"<mqt na instructions>",
37+
"out.mp4",
38+
(1920, 1080),
39+
60,
40+
machine,
41+
style,
42+
default_import_settings("MqtNa"),
43+
)
44+
```

0 commit comments

Comments
 (0)