Metadata-Version: 2.4
Name: qciconnect-miniserver
Version: 0.4.2
Summary: Mini server for local development
Keywords: quantum computing,QCI Connect SDK,mini server
Author: DLR-SC, David da Costa, Thomas Keitzl, Elisabeth Lobe, Johannes Renkl, Gary Schmiedinghoff, Thomas Stehle, Lukas Windgätter
Author-email: DLR-SC <qc-software@dlr.de>
License-Expression: Apache-2.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python
Classifier: Operating System :: OS Independent
Requires-Dist: fastapi==0.110.3
Requires-Dist: flower==2.0.1
Requires-Dist: uvicorn>=0.29.0,<1
Requires-Dist: docker>=7.1.0,<8
Requires-Dist: pyyaml>=6.0.2,<7
Requires-Dist: pydantic-settings>=2.4.0
Requires-Dist: grpcio>=1.76.0
Requires-Dist: grpcio-tools>=1.74.0
Requires-Dist: platformdirs>=4.9.2
Requires-Dist: qciconnect-common>=0.2.1
Requires-Python: >=3.12
Description-Content-Type: text/markdown

[<img src="https://gitlab.com/dlr-sc-qc/qciconnect-sdk/commons/-/raw/main/docs/_static/logo_sdk.svg" alt="QCI Connect SDK" height="100"/>](https://dlr-sc-qc.gitlab.io/qciconnect-sdk/landing-page/) &nbsp;
[<img src="https://gitlab.com/dlr-sc-qc/qciconnect-sdk/miniserver/-/raw/main/docs/_static/logo.png" alt="Mini Server Repository" height="100"/>](https://gitlab.com/dlr-sc-qc/qciconnect-sdk/miniserver)

# Miniserver

This python package is used to locally execute the compilers and simulators of the [QCI Connect](https://qci.dlr.de/connect/) platform of the [German Aerospace Center (DLR)](https://www.dlr.de/).
It is a component of the full [QCI Connect SDK](https://pypi.org/project/qciconnect/) and can interface as a server with the [API Client](https://pypi.org/project/qciconnect-client/), substituting the QCI Connect platform.

It allows to

1) locally develop algorithms with the goal to integrate them to the platform, 
2) prototype quickly, and 
3) run algorithms on the local computer using the standard interfaces of the QCI Connect API Client.

## Quick Start (Pip Installation)

The miniserver requires [Docker](https://www.docker.com/) to be installed.

- Run `pip install qciconnect-miniserver qciconnect-client`
- Build compiler images that you want to use (see instructions [below](#build-compiler-image) for building the example compilers included in the miniserver repository)
- Start the server with the compiler path `miniserver -c path_to_compilers_folder`
- Connect API Client with the server as described in the [example notebook](https://dlr-sc-qc.gitlab.io/qciconnect-sdk/api-client/examples/example_local.html)

## Working on Source Code (Dev Mode)

Clone the repository (or download the `.tar.gz` file), initialize the git submodules, then install dependencies. 

We recommend using [ultraviolet](https://docs.astral.sh/uv) ([installation guide](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)).

```bash
git submodule update --init
uv sync
```
You can now [activate](https://docs.python.org/3/library/venv.html#how-venvs-work) the `.venv` in the source directory or use uv to run commands in the `.venv`, e. g.,  `uv run python my_script.py`.

## Using the Miniserver (Dev Mode)

The following steps provide a quick start guide for programmatically interacting with the local development environment.

### Build Compiler Image

First, verify that Docker (including the Docker Compose plugin) is installed, then build the compiler step images as follows:

```bash
cd deployment/docker-dev
docker compose build --no-cache
```

### Start Miniserver

Next, you’re ready to start the `miniserver`:

```bash
uv sync
source .venv/bin/activate
miniserver
```
or
```bash
uv run miniserver
```

## Troubleshooting

### Miniserver

In case you need to restart the `miniserver` just stop it through `CTR+C` or

```bash
miniserver stop
```
It could be that `miniserver` does not restart properly due to `compiler-containers` still running from previous sections
```bash
docker rm -v -f <compiler-container-list>
```

