Skip to content

Commit 70005a4

Browse files
Update README and removed old docs files (#118)
1 parent bfa378e commit 70005a4

File tree

9 files changed

+205
-177
lines changed

9 files changed

+205
-177
lines changed

CONTRIBUTING.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Contributing Guide
2+
3+
> [!NOTE]
4+
> The following is more how to setup your dev environment than a proper contribution guide. Feel free to fork the repo and open a PR. A proper contribution guide is in the works 🚧
5+
6+
## Development Instructions
7+
8+
1. Install [uv](https://docs.astral.sh/uv/), which will handle project management
9+
10+
1. Clone and navigate into this repository
11+
12+
1. Install the dependencies and set up the virtual environment 🏗️
13+
14+
```sh
15+
uv sync
16+
```
17+
18+
1. Run the code 🚀
19+
20+
```sh
21+
uv run pqn
22+
```
23+
24+
### Project Management
25+
26+
A few of the most useful uv commands are shown below.
27+
See the [uv project guide](https://docs.astral.sh/uv/guides/projects) for more information about working on projects with uv.
28+
29+
- `uv add` -- Add dependencies to the project
30+
- `uv remove` -- Remove dependencies from the project
31+
- `uv sync` -- Update the project's environment
32+
- `uv run` -- Run a command or script
33+
34+
> [!IMPORTANT]
35+
> Instead of `pip install <package>`, use `uv add <package>`.
36+
37+
### Scripts
38+
39+
To run your code, or a command that is aware of your project environment, use the following command:
40+
41+
- `uv run` -- Run a command or script
42+
43+
See the [script documentation](https://docs.astral.sh/uv/guides/scripts/) for more information.
44+
45+
### Linting and Formatting
46+
47+
Use [Ruff](https://docs.astral.sh/ruff/) to lint and format your code.
48+
It is already specified as a development dependency in this template's `pyproject.toml`, and is automatically installed when you run `uv sync`.
49+
50+
You can run the linter with `uv run ruff check` (use the `--fix` flag to apply fixes), and the formatter with `uv run ruff format`.
51+
There are many options available to customize which linting rules are applied.
52+
All rules are enabled by default, and I have disabled a few redundant ones as a starting point in the `pyproject.toml`.
53+
Feel free to modify the list as needed for your project.
54+
See the [documentation](https://docs.astral.sh/ruff/tutorial/) or command help output for additional information.
55+
56+
### Type Checking
57+
58+
Use [mypy](https://www.mypy-lang.org/) for type checking: `uv run mypy`.
59+
60+
### Testing
61+
62+
Use [pytest](https://docs.pytest.org/en/stable/) to run tests:
63+
64+
- `uv run pytest`
65+
- Use `uv run pytest --cov` to check code coverage.
66+
67+
### Alternate Manual Setup
68+
69+
If it is not possible to use uv for installation, there is a workaround using `virtualenv` and `pip`.
70+
71+
> [!IMPORTANT]
72+
> This method is intended as a workaround **only** for situations where uv is not available, and **only for local installations** rather than for active project development.
73+
74+
From the root directory of the repository:
75+
76+
1. Create the virtual environment
77+
78+
```sh
79+
virtualenv .venv
80+
```
81+
82+
1. Activate the virtual environment
83+
84+
```sh
85+
source .venv/bin/activate
86+
```
87+
88+
1. Install the project dependencies
89+
90+
```sh
91+
pip install -e .
92+
```
93+
94+
1. Run the code
95+
96+
```sh
97+
pqn
98+
```
99+
100+
### Possible Problems
101+
102+
What to try if things don't seem to be working:
103+
104+
- Remove the `.venv/` directory and try again ♻️

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2024 Public Quantum Network
3+
Copyright (c) 2025 Public Quantum Network
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 97 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,137 @@
1-
# Public Quantum Network
1+
# PQN Stack
22

3-
Software for Public Quantum Network nodes.
3+
**Software stack for Public Quantum Network (PQN) nodes**
44

5-
## Development Instructions
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
67

7-
1. Install [uv](https://docs.astral.sh/uv/), which will handle project management
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)).
89

9-
1. Clone and navigate into this repository
1010

11-
1. Install the dependencies and set up the virtual environment 🏗️
11+
<p align="center">
12+
<img src="docs/images/frontend_screenshot.png" alt="PQN Web Interface" width="800"/>
13+
<br>
14+
<em>PQN web interface for public interaction with a quantum network</em>
15+
</p>
1216

13-
```sh
14-
uv sync
15-
```
17+
> [!WARNING]
18+
> **Early Development**: This package is in early stages of development. APIs, installation procedures, and distribution methods are subject to change. Use in production environments is not recommended at this time.
1619
17-
1. Run the code 🚀
20+
## Node Architecture
1821

19-
```sh
20-
uv run pqn
21-
```
22+
<p align="center">
23+
<img src="docs/images/network_architecture.png" alt="PQN Node Architecture" width="800"/>
24+
<br>
25+
<em>PQN web interface for monitoring and controlling quantum network nodes</em>
26+
</p>
2227

23-
### Project Management
28+
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_.
2429

25-
A few of the most useful uv commands are shown below.
26-
See the [uv project guide](https://docs.astral.sh/uv/guides/projects) for more information about working on projects with uv.
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).
31+
* **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).
32+
* **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).
33+
* **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).
2734

28-
- `uv add` -- Add dependencies to the project
29-
- `uv remove` -- Remove dependencies from the project
30-
- `uv sync` -- Update the project's environment
31-
- `uv run` -- Run a command or script
35+
## Quick Start
3236

33-
> [!IMPORTANT]
34-
> Instead of `pip install <package>`, use `uv add <package>`.
37+
> [!NOTE]
38+
> **Hardware Requirements**: To do anything interesting with this software currently requires real quantum hardware components (TimeTagger, rotators, etc.). We are actively working on fully simulated hardware components to enable single-machine demos without physical devices, but this capability is not yet available.
3539
36-
### Scripts
40+
### Prerequisites
3741

38-
To run your code, or a command that is aware of your project environment, use the following command:
42+
- Python 3.12 or higher
43+
- [uv](https://docs.astral.sh/uv/) package manager
44+
- Quantum hardware components (TimeTagger, compatible instruments)
3945

40-
- `uv run` -- Run a command or script
46+
### Installation
4147

42-
See the [script documentation](https://docs.astral.sh/uv/guides/scripts/) for more information.
48+
1. **Clone the repository**
4349

44-
### Linting and Formatting
50+
```bash
51+
git clone https://github.com/PublicQuantumNetwork/pqn-stack.git
52+
cd pqn-stack
53+
```
4554

46-
Use [Ruff](https://docs.astral.sh/ruff/) to lint and format your code.
47-
It is already specified as a development dependency in this template's `pyproject.toml`, and is automatically installed when you run `uv sync`.
55+
2. **Install dependencies**
4856

49-
You can run the linter with `uv run ruff check` (use the `--fix` flag to apply fixes), and the formatter with `uv run ruff format`.
50-
There are many options available to customize which linting rules are applied.
51-
All rules are enabled by default, and I have disabled a few redundant ones as a starting point in the `pyproject.toml`.
52-
Feel free to modify the list as needed for your project.
53-
See the [documentation](https://docs.astral.sh/ruff/tutorial/) or command help output for additional information.
57+
```bash
58+
uv sync
59+
60+
# Or sync with the --extra flag to run the full node
61+
uv sync --extra webapp
62+
```
5463

55-
### Type Checking
64+
### Starting a Node
5665

57-
Use [mypy](https://www.mypy-lang.org/) for type checking: `uv run mypy`.
66+
To fully start a PQN Node, you need to initialize 4 different processes:
5867

59-
### Testing
68+
* **Node API**
69+
* **Router**
70+
* **Hardware provider** (optional)
71+
* **Web GUI** (optional)
6072

61-
Use [pytest](https://docs.pytest.org/en/stable/) to run tests:
73+
### Node API
6274

63-
- `uv run pytest`
64-
- Use `uv run pytest --cov` to check code coverage.
75+
#### Config file
6576

66-
### Alternate Manual Setup
77+
Before starting a Node API, you need to set up a configuration file:
78+
79+
1. **Copy the example configuration:**
80+
```bash
81+
cp configs/config_app_example.toml config.toml
82+
```
6783

68-
If it is not possible to use uv for installation, there is a workaround using `virtualenv` and `pip`.
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.).
6986

7087
> [!IMPORTANT]
71-
> This method is intended as a workaround **only** for situations where uv is not available, and **only for local installations** rather than for active project development.
88+
> 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.
7289
73-
From the root directory of the repository:
90+
#### Run the FastAPI instance
91+
For a quick run you can simply run to get started:
7492

75-
1. Create the virtual environment
93+
```bash
94+
uv run fastapi run src/pqnstack/app/main.py
95+
```
7696

77-
```sh
78-
virtualenv .venv
79-
```
97+
Please take a look at the [FastAPI docs](https://fastapi.tiangolo.com/deployment/) for more options on how to run the API
8098

81-
1. Activate the virtual environment
99+
### Router and Hardware Provider
82100

83-
```sh
84-
source .venv/bin/activate
85-
```
101+
Both the Router and Hardware Provider can be configured in two ways:
86102

87-
1. Install the project dependencies
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))
88105

89-
```sh
90-
pip install -e .
91-
```
106+
The config file can contain settings for both router and provider:
107+
- Router settings go under `[router]`
108+
- Provider settings go under `[provider]` with instruments defined as `[[provider.instruments]]`
92109

93-
1. Run the code
110+
Command-line arguments override config file settings.
94111

95-
```sh
96-
pqn
97-
```
112+
#### Starting the Router
113+
114+
```bash
115+
# Using CLI flags
116+
uv run pqn start-router --name router1 --host localhost --port 5555
117+
118+
# Using a config file
119+
uv run pqn start-router --config configs/config_messaging_example.toml
120+
```
121+
122+
#### Starting an Instrument Provider
123+
124+
```bash
125+
# Using a config file (recommended for defining instruments)
126+
uv run pqn start-provider --config configs/config_messaging_example.toml
98127

99-
### Possible Problems
128+
# Using CLI flags with inline JSON for instruments
129+
uv run pqn start-provider \
130+
--name provider1 \
131+
--router-name router1 \
132+
--instruments '{"dummy1": {"import": "pqnstack.pqn.drivers.dummies.DummyInstrument", "desc": "Test Instrument", "hw_address": "123456"}}'
133+
```
100134

101-
What to try if things don't seem to be working:
135+
### Web GUI
102136

103-
- Remove the `.venv/` directory and try again ♻️
137+
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)

configs/config_app_example.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ router_name = "router1"
55
router_address = "xx.xx.xx.xx" # Replace with actual IP address
66
router_port = 5555
77

8+
# Rotary encoder serial adress
9+
rotary_encoder_address = "/dev/tty.usbmodem1101"
10+
811
# Timetagger configuration (provider_name, instrument_name)
912
timetagger = ["provider", "tagger"] # Replace with actual provider and instrument names
1013

330 KB
Loading
204 KB
Loading

docs/packet.md

Lines changed: 0 additions & 40 deletions
This file was deleted.

docs/project-goals.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)