Getting started¶
Prerequisites¶
Before you start the installation of Tranqu Server, you need to install the following tools:
Development Environment¶
| Tool | Version | Description |
|---|---|---|
| Python | >=3.12 | Python programming language |
| uv | - | Python package and project manager |
To start installing Tranqu Server, clone the repository:
git clone https://github.com/oqtopus-team/tranqu-server.git
cd tranqu-server
Info
To use ouqu-tp as a transpiler, staq is required. If staq is not installed, it will be automatically installed the first time you use ouqu-tp. The installation of staq takes several minutes.
Setting Up the Python Environment¶
To install dependencies:
uv sync
Configurations¶
Tranqu Server uses two configuration files:
Info
You can use environment variables as values in the above YAML files.
config.yaml¶
This is the main configuration file for Tranqu Server.
proto: # Settings for Tranqu Server as a gRPC server
max_workers: 10 # Maximum number of workers (default: 10)
address: "[::]:50051" # Address and port for RPCs (default: "[::]:50051")
logging.yaml¶
This is the logging configuration file for Tranqu Server.
It is written in YAML format.
Within Tranqu Server, it is loaded as a dict, and then the logging.config.dictConfig function is called to apply the configuration.
If you use the default settings of config.yaml, the logs directory is required.
mkdir logs
Start Tranqu Server¶
To start Tranqu Server, run the following command:
uv run python src/tranqu_server/proto/service.py -c config/config.yaml -l config/logging.yaml
-cor--config: Specifies the path to the main configuration file.-lor--logging: Specifies the path to the logging configuration file.
When cloned from GitHub, the worker in config.yaml uses the environment variable ${WORKERS},
and the address uses the environment variable ${ADDRESS}.
In this case, the Tranqu Server is started with the following command.
WORKERS=10 ADDRESS="localhost:50051" uv run python src/tranqu_server/proto/service.py -c config/config.yaml -l config/logging.yaml
Run sample client¶
A sample client can call the Tranqu Server to try it out and check its functionality.
uv run python tests/tranqu_server/proto/sample_client.py
Example¶
You can check Tranqu Server's with grpcurl:
Install grpcurl¶
See the grpcurl repository
List services¶
grpcurl -plaintext [::]:50051 list
Check supported methods¶
grpcurl -plaintext "[::]:50051" list tranqu_server.proto.v1.TranspilerService
Request to transpile¶
grpcurl -plaintext -d '{
"program": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\n\nh q[0];\ncx q[0], q[1];\n",
"program_lib": "openqasm3",
"transpiler_lib": "qiskit"
}' "[::]:50051" tranqu_server.proto.v1.TranspilerService.Transpile