Skip to content

Commit ba661e1

Browse files
marcosfrenkelSoroushHoseiniv0l01
authored
Updating README (#137)
Co-authored-by: SoroushHoseini <soroushhoseini0@gmail.com> Co-authored-by: Virginia Lorenz <150369115+v0l01@users.noreply.github.com>
1 parent ff28a7e commit ba661e1

1 file changed

Lines changed: 41 additions & 36 deletions

File tree

README.md

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
77

8-
A distributed node based approach to quantum networks. This repository hosts all the code necessary to make nodes of the PQN function (except for the frontend located [here](https://github.com/PublicQuantumNetwork/pqn-gui)).
8+
A distributed node based approach to quantum networks. This repository hosts all the code necessary to make the backend of nodes of the PQN function. For the frontend, see [here](https://github.com/PublicQuantumNetwork/pqn-gui).
99

1010

1111
<p align="center">
@@ -27,7 +27,7 @@ A distributed node based approach to quantum networks. This repository hosts all
2727

2828
Our Node is composed of multiple components. All components inside a node are part of an in internal intranet with no external world access except for quantum links to other hardware or the _Node API_.
2929

30-
* **Node API**: FastAPI based, handles communications with web-ui as well as Node to Node communication. Only component in a Node than can talk to other components and the outside world. Resides in [src/pqnstack/app/main.py](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/src/pqnstack/app/main.py).
30+
* **Node API**: FastAPI based, handles communications with web-ui as well as Node to Node communication. Only component in a Node than can talk to other components and the outside world. Resides in [src/pqnstack/app/main.py](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/src/pqnstack/app/main.py). See the [FastAPI docs](https://fastapi.tiangolo.com/deployment/) for more options on how to run the API.
3131
* **Lightweight Web UI**: Designed for the general public to be able to interact with quantum networks. Resides in its own repository [here](https://github.com/PublicQuantumNetwork/pqn-gui).
3232
* **Router**: Routes messages between _Hardware Providers_, PQN developers and _Node APIs_. Uses ZMQ sockets to communicate between machines. Resides in [src/pqnstack/network/router.py](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/src/pqnstack/network/router.py).
3333
* **Hardware Provider**: Hosts hardware resources that are provided to whoever needs them inside a Node through the use of ProxyInstruments. Resides in [src/pqnstack/network/instrument_provider.py](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/src/pqnstack/network/instrument_provider.py).
@@ -54,88 +54,93 @@ Our Node is composed of multiple components. All components inside a node are pa
5454

5555
2. **Install dependencies**
5656

57-
```bash
58-
uv sync
59-
60-
# Or sync with the --extra flag to run the full node
57+
To run the fastapi backend for node operations, use:
58+
```bash
6159
uv sync --extra webapp
6260
```
6361

64-
### Starting a Node
62+
### Start a Node
6563

6664
To fully start a PQN Node, you need to initialize 4 different processes:
6765

68-
* **Node API**
66+
* **PQN API**
6967
* **Router**
7068
* **Hardware provider** (optional)
7169
* **Web GUI** (optional)
7270

73-
### Node API
71+
### Set up the PQN API
72+
73+
7474

7575
#### Config file
7676

77-
Before starting a Node API, you need to set up a configuration file:
77+
Before starting a Node API, you need to set up a configuration file for the Node:
7878

7979
1. **Copy the example configuration:**
8080
```bash
8181
cp configs/config_app_example.toml config.toml
8282
```
8383

84-
2. **Edit the configuration:**
85-
Open `config.toml` in your editor and replace the placeholder values with your actual settings (router addresses, instrument names, etc.).
86-
8784
> [!IMPORTANT]
8885
> The configuration file **must** be named `config.toml` and placed at the root of the repository. If you use a different name or location, the API will not be able to find it.
8986
90-
#### Run the FastAPI instance
91-
For a quick run you can simply run to get started:
92-
93-
```bash
94-
uv run fastapi run src/pqnstack/app/main.py
95-
```
87+
2. **Edit the configuration:**
88+
Open `config.toml` in your editor and replace the placeholder values with your actual settings (router addresses, instrument names, etc.).
9689

97-
Please take a look at the [FastAPI docs](https://fastapi.tiangolo.com/deployment/) for more options on how to run the API
9890

99-
### Router and Hardware Provider
91+
### Configure Router and Hardware Provider
10092

101-
Both the Router and Hardware Provider can be configured in two ways:
93+
For the first computer on the PQN, both a router and hardware provider are needed. For subsequent computers added to the same node, only a hardware provider is needed.
10294

103-
1. **Using CLI flags** - Pass configuration directly as command-line arguments
104-
2. **Using a config file** - Use the `--config` flag with a path to a TOML configuration file (see example in [configs/config_messaging_example.toml](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/configs/config_messaging_example.toml))
95+
Both the Router and Hardware Provider can be configured using a config file. (Alternatively you could use CLI flags for quick tests.)
10596

106-
The config file can contain settings for both router and provider:
97+
Create a TOML configuration file for the router and hardware provider (see example in [configs/config_messaging_example.toml](https://github.com/PublicQuantumNetwork/pqn-stack/blob/master/configs/config_messaging_example.toml)). The config file can contain settings for both router and provider:
10798
- Router settings go under `[router]`
10899
- Provider settings go under `[provider]` with instruments defined as `[[provider.instruments]]`
109100

110-
Command-line arguments override config file settings.
111-
112-
#### Starting the Router
101+
Start the router:
113102

114103
```bash
115-
# Using CLI flags
116-
uv run pqn start-router --name router1 --host localhost --port 5555
117-
118-
# Using a config file
119104
uv run pqn start-router --config configs/config_messaging_example.toml
120105
```
121106

122-
#### Starting an Instrument Provider
107+
Start the Hardware Provider:
123108

124109
```bash
125-
# Using a config file (recommended for defining instruments)
126110
uv run pqn start-provider --config configs/config_messaging_example.toml
111+
```
112+
113+
**Alternative method using CLI flags:** - Pass configuration directly as command-line arguments
127114

128-
# Using CLI flags with inline JSON for instruments
115+
Start the Router with CLI flags:
116+
```bash
117+
uv run pqn start-router --name router1 --host localhost --port 5555
118+
```
119+
120+
Start the Instrument Provider with CLI flags:
121+
```bash
129122
uv run pqn start-provider \
130123
--name provider1 \
131124
--router-name router1 \
132125
--instruments '{"dummy1": {"import": "pqnstack.pqn.drivers.dummies.DummyInstrument", "desc": "Test Instrument", "hw_address": "123456"}}'
133126
```
134127

135-
### Web GUI
128+
### Start the PQN API server
129+
130+
```bash
131+
uv run fastapi run src/pqnstack/app/main.py
132+
```
133+
134+
To see the list of all the protocols that can be run, go to http://127.0.0.1:8000/docs.
135+
136+
### Install the Web GUI
136137

137138
For instructions on how install and start the web GUI please see the repo where it lives at [https://github.com/PublicQuantumNetwork/pqn-gui](https://github.com/PublicQuantumNetwork/pqn-gui)
138139

139140
## Acknowledgements
140141

141142
The Public Quantum Network is supported in part by NSF Quantum Leap Challenge Institute HQAN under Award No. 2016136, Illinois Computes, and by the DOE Grant No. 712869, "Advanced Quantum Networks for Science Discovery."
143+
144+
## Have questions?
145+
146+
Feel free to contact the PQN team at publicquantumnetwork@gmail.com.

0 commit comments

Comments
 (0)