Skip to content

Commit d95ac09

Browse files
Merge pull request #1 from OpenQuantumDesign/packaging-and-documentation
Packaging and documentation
2 parents bd2d8d5 + a11be93 commit d95ac09

5 files changed

Lines changed: 62 additions & 47 deletions

File tree

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: CI
55

66
on:
77
push:
8-
branches: [ "master" ]
8+
branches: ["main"]
99
pull_request:
10-
branches: [ "master" ]
10+
branches: ["main"]
1111

1212
permissions:
1313
contents: read
@@ -18,26 +18,26 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
version:
21-
- '3.10'
22-
- '3.11'
23-
- '3.12'
21+
- "3.10"
22+
- "3.11"
23+
- "3.12"
2424
os:
2525
- ubuntu-latest
2626
arch:
2727
- x64
2828
name: Python ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
2929
runs-on: ${{ matrix.os }}
3030
steps:
31-
- uses: actions/checkout@v4
32-
- name: Set up Python
33-
uses: actions/setup-python@v4
34-
with:
35-
python-version: ${{ matrix.version }}
36-
cache: "pip"
37-
- name: Install dependencies
38-
run: |
39-
python -m pip install --upgrade pip
40-
pip install .
41-
- name: Run unittest
42-
run: |
43-
python -m unittest discover tests -v
31+
- uses: actions/checkout@v4
32+
- name: Set up Python
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: ${{ matrix.version }}
36+
cache: "pip"
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install .[server]
41+
- name: Run unittest
42+
run: |
43+
python -m unittest discover tests -v

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
1-
# ![Open Quantum Design](docs/img/oqd-logo-text.png)
2-
3-
![Python](https://img.shields.io/badge/Python-3.10_|_3.11_|_3.12-blue)
4-
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
1+
# ![Open Quantum Design](https://raw.githubusercontent.com/OpenQuantumDesign/oqd-compiler-infrastructure/main/docs/img/oqd-logo-text.png)
52

63
<h2 align="center">
74
Open Quantum Design: Cloud
85
</h2>
96

7+
[![doc](https://img.shields.io/badge/documentation-lightblue)](https://docs.openquantumdesign.org/open-quantum-design-cloud)
8+
[![PyPI Version](https://img.shields.io/pypi/v/oqd-cloud)](https://pypi.org/project/oqd-cloud)
9+
[![CI](https://github.com/OpenQuantumDesign/oqd-cloud/actions/workflows/pytest.yml/badge.svg)](https://github.com/OpenQuantumDesign/oqd-cloud/actions/workflows/pytest.yml)
10+
![versions](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-blue)
11+
[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
12+
[![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg)](https://opensource.org/licenses/Apache-2.0)
13+
14+
15+
1016
## What's Here
1117
This repository contains the software needed to submit jobs to a remote, cloud server for classical simulations of quantum programs.
1218
In addition, it provides a Docker script to self-host a simulation server of the OQD emulator backends.
1319

1420
## Installation
21+
```bash
22+
pip install oqd-cloud
23+
```
24+
1525
To install locally for development or launching a Docker container server:
1626

1727
```bash
@@ -21,7 +31,8 @@ pip install .
2131

2232
To start the simulation server, ensure Docker is installed on the machine, navigate to the `docker` folder, and run,
2333
```bash
24-
docker compose up
34+
cd oqd-cloud/docker
35+
docker compose up -d
2536
```
2637

2738
To serve the documentation,

docker/Dockerfile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ ENV PATH="/python/venv/bin:$PATH"
1818
COPY docker/requirements.txt .
1919
RUN pip install -r requirements.txt
2020

21-
# todo: remove github token once repos are public
22-
ARG GITHUB_TOKEN
23-
RUN pip install git+https://${GITHUB_TOKEN}@github.com/OpenQuantumDesign/oqd-compiler-infrastructure.git
24-
RUN pip install git+https://${GITHUB_TOKEN}@github.com/OpenQuantumDesign/oqd-core.git
25-
RUN pip install git+https://${GITHUB_TOKEN}@github.com/OpenQuantumDesign/oqd-analog-emulator.git
21+
RUN pip install oqd-compiler-infrastructure
22+
RUN pip install oqd-core
23+
RUN pip install oqd-analog-emulator
2624

2725

2826
########################################################################################

pyproject.toml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,34 @@ build-backend = "setuptools.build_meta"
55

66
[project]
77
name = "oqd-cloud"
8-
version = "0.0.0"
8+
version = "0.1.0"
99
requires-python = ">=3.10"
1010
readme = "README.md"
11-
license = {file = "LICENSE"}
11+
license = {text = "Apache 2.0"}
1212
keywords = ["quantum", "computing", "simulation", "cloud", "server"]
1313
classifiers = [
14-
"Development Status :: 3 - Alpha",
14+
"Development Status :: 3 - Alpha",
1515

16-
"Intended Audience :: Science/Research ",
17-
"Topic :: Scientific/Engineering :: Physics",
18-
"Topic :: Scientific/Engineering :: Information Analysis",
16+
"Intended Audience :: Science/Research ",
17+
"Topic :: Scientific/Engineering :: Physics",
18+
"Topic :: Scientific/Engineering :: Information Analysis",
1919

20-
"License :: OSI Approved :: Apache Software License",
20+
"License :: OSI Approved :: Apache Software License",
2121

22-
"Programming Language :: Python :: 3",
23-
"Programming Language :: Python :: 3.10",
24-
"Programming Language :: Python :: 3.11",
25-
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3",
23+
"Programming Language :: Python :: 3.10",
24+
"Programming Language :: Python :: 3.11",
25+
"Programming Language :: Python :: 3.12",
2626
]
2727

2828

2929
dependencies = [
3030
"requests",
3131
"pydantic>=2.4",
3232
"numpy~=1.0",
33+
"oqd-compiler-infrastructure",
34+
"oqd-core",
35+
"oqd-analog-emulator"
3336
]
3437

3538
[project.optional-dependencies]
@@ -43,14 +46,17 @@ docs = [
4346
test = ["unittest_prettify"]
4447

4548
server = [
46-
# "oqd-compiler-infrastructure",
4749
"pydantic>=2.4",
4850
"qutip~=5.0.1",
4951
"asyncpg",
5052
"uvicorn",
5153
"python-jose",
5254
"passlib",
5355
"python-multipart",
56+
#
57+
"oqd-compiler-infrastructure",
58+
"oqd-core",
59+
"oqd-analog-emulator",
5460
]
5561

5662

@@ -59,7 +65,6 @@ where = ["src"]
5965
include = ["oqd_cloud*"]
6066

6167

62-
6368
[project.urls]
6469
Homepage = "https://github.com/OpenQuantumDesign/oqd-cloud"
6570
Repository = "https://github.com/OpenQuantumDesign/oqd-cloud.git"

src/oqd_cloud/client.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class Job(BaseModel):
2828
"""
2929
Job model which is stored in the SQL database
3030
"""
31+
3132
model_config = ConfigDict(from_attributes=True)
3233

3334
job_id: str
@@ -105,7 +106,7 @@ def authorization_header(self):
105106
)
106107

107108
def connect(self, provider: Provider, username: str, password: str):
108-
""" Connect to a provider URL with `username` and `password` """
109+
"""Connect to a provider URL with `username` and `password`"""
109110
self._provider = provider
110111

111112
# username = input("Enter username: ")
@@ -129,7 +130,7 @@ def connect(self, provider: Provider, username: str, password: str):
129130
# pass
130131

131132
def submit_job(self, task: Task, backend: Literal["analog-qutip",]):
132-
""" Submit a Task as an AnalogCircuit, DigitalCircuit, or AtomicCircuit to a backend. """
133+
"""Submit a Task as an AnalogCircuit, DigitalCircuit, or AtomicCircuit to a backend."""
133134
response = requests.post(
134135
self.provider.job_submission_url(backend=backend),
135136
json=task.model_dump(),
@@ -144,7 +145,7 @@ def submit_job(self, task: Task, backend: Literal["analog-qutip",]):
144145
raise response.raise_for_status()
145146

146147
def retrieve_job(self, job_id):
147-
""" Retrieve the results object of a finished job. """
148+
"""Retrieve the results object of a finished job."""
148149

149150
response = requests.get(
150151
self.provider.job_retrieval_url(job_id=job_id),
@@ -159,22 +160,22 @@ def retrieve_job(self, job_id):
159160
raise response.raise_for_status()
160161

161162
def status_update(self):
162-
""" Request status update for all jobs. """
163+
"""Request status update for all jobs."""
163164

164165
for job_id in self.jobs.keys():
165166
self.retrieve_job(job_id)
166167
pass
167168

168169
def resubmit_job(self, job_id):
169-
""" Resubmit failed job. """
170+
"""Resubmit failed job."""
170171

171172
return self.submit_job(
172173
task=Task.model_validate_json(self.jobs[job_id].task),
173174
backend=self.jobs[job_id].backend,
174175
)
175176

176177
def cancel_job(self, job_id):
177-
""" Cancel a job. """
178+
"""Cancel a job."""
178179

179180
response = requests.delete(
180181
self.provider.job_cancellation_url(job_id=job_id),

0 commit comments

Comments
 (0)