Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version of docs + HQAR -> QART rename #5

Merged
merged 26 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
555be06
Add docs stub
dexter2206 Mar 25, 2024
907e383
Add language server info to mkdocs.yml
dexter2206 Mar 25, 2024
adfc704
Add basic docs structure
dexter2206 Mar 28, 2024
1a72dd1
Add basic program/circuit example
dexter2206 Apr 4, 2024
367e9b1
Add short desription of QART format
dexter2206 Apr 4, 2024
53849cf
Add API reference
dexter2206 Apr 4, 2024
9881510
Update mkdocs.yml
dexter2206 Apr 4, 2024
8e31d19
Remove copyright notices
dexter2206 Apr 4, 2024
1d19275
Rename hqar package to qart
dexter2206 Apr 5, 2024
2239a81
Remove copyright checks
dexter2206 Apr 5, 2024
9b865cd
Remove remaining copyright notices
dexter2206 Apr 5, 2024
b9333d2
Reorganize chapter on QART Python library
dexter2206 Apr 5, 2024
fb117ed
Add content to index.md
dexter2206 Apr 5, 2024
7c6b706
Add required plugins
dexter2206 Apr 5, 2024
88c89fd
Reorganize docs for python library
dexter2206 Apr 5, 2024
614a6da
Remove whitespace
dexter2206 Apr 5, 2024
11a129b
Update example yaml and svg (my_algorithm -> my_program)
dexter2206 Apr 5, 2024
95adc7a
Add basic development guide
dexter2206 Apr 5, 2024
1b58308
Update links in index.md
dexter2206 Apr 5, 2024
cbb2c51
Add docs-related dependencies
dexter2206 Apr 5, 2024
b1ee4a9
Add more descriptions to format chapter
dexter2206 Apr 5, 2024
bb40000
Add job for building docs
dexter2206 Apr 5, 2024
c9a0240
Attempt running mkdocs through poetry run
dexter2206 Apr 5, 2024
cbe8101
Add missing dependency on mkdocstrings
dexter2206 Apr 5, 2024
d2b5e87
Apply changes suggested in the review
dexter2206 Apr 8, 2024
f157337
Add missing images
dexter2206 Apr 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ ignore =
per-file-ignores =
tests/**/test_*.py:D103,D102,D101
__init__.py:F401
copyright-check = True
copyright-regexp = Copyright\s+(©\s+)?\d{4}([-,]\d{4})*\s+%(author)s
copyright-author = PsiQuantum Corp.
copyright-min-file-size = 1
16 changes: 16 additions & 0 deletions .github/workflows/quality_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,19 @@ jobs:
pre-commit run -a
- name: Run mypy
run: MYPYPATH=src poetry run mypy --install-types --non-interactive src

test_docs_are_building:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: actions/checkout@v2
- name: Setup poetry
uses: abatilo/actions-poetry@v2
- name: Install package and deps
run: |
poetry install --with docs
- name: Build docs
run: poetry run mkdocs build
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ repos:
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-copyright]
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# HQAR
Hierarchical Quantum Algorithms Representation is an open format for representing
# QART
Quantum Algorithms Represented Topologically (QART) is an open format for representing
quantum algorithms, optimized for usage in quantum resource estimation (QRE).

HQAR comprises:
QART comprises:

- Definition of data format, formalized as a JSON schema.
- A Python library for validation of quantum programs written in HQAR format using [Pydantic](https://docs.pydantic.dev/).
- Rudimentary visualization tool `hqar-render`.
- A Python library for validation of quantum programs written in QART format using [Pydantic](https://docs.pydantic.dev/).
- Rudimentary visualization tool `qart-render`.

## Installation

Using HQAR data format does not require installation - you can easily write quantum
Using QART data format does not require installation - you can easily write quantum
programs in YAML or JSON.

To install HQAR Python package, clone this repository and install it as usual with `pip`:
To install QART Python package, clone this repository and install it as usual with `pip`:

```bash
# Clone HQAR repo (you can use HTTP link as well)
git clone git@github.com:PsiQ/hqar.git
cd hqar
# Clone QART repo (you can use HTTP link as well)
git clone git@github.com:PsiQ/qart.git
cd qart
pip install .
```

## HQAR format
## QART format

HQAR format represents quantum programs as a hierarchical directed acyclic graphs (DAGs).
QART format represents quantum programs as a hierarchical directed acyclic graphs (DAGs).
That's a mouthful, so let us unpack what it means:

- *hierarchical*: each node can contain subgraphs, i.e. routines can be nested inside
Expand All @@ -36,7 +36,7 @@ Consider the following hierarchical DAG of a hypothetical quantum program:

![program example](example_routine.svg)

It can be succinctly written in HQAR format as:
It can be succinctly written in QART format as:


```yaml
Expand Down Expand Up @@ -103,21 +103,21 @@ program:
```


For full description of HQAR format, check our [docs](https://example.com).
For full description of QART format, check our [docs](https://example.com).

## Using HQAR package
## Using QART package

### Using JSON schema for validating data in HQAR format
### Using JSON schema for validating data in QART format

JSON schema for HQAR format can be obtained by calling `generate_program_schema` function.
JSON schema for QART format can be obtained by calling `generate_program_schema` function.
Such schema can be then used for validating user's input, e.g. using `jsonschema` package:

```python
from jsonschema import validate
from hqar import generate_program_schema
from qart import generate_program_schema

# Hypothetical function loading your data as native Python dictionary.
data = load_some_program()
data = load_some_program()
schema = generate_program_schema()

# This will raise if there are some validation errors.
Expand All @@ -126,12 +126,12 @@ validate(schema, data)

### Validation using Pydantic models

If you are familiar with Pydantic, you might find it easier to work with HQAR Pydantic
If you are familiar with Pydantic, you might find it easier to work with QART Pydantic
models instead of interacting with JSON schema directly. In the example below, we create
an instance of `SchemaV1` model from validated data stored in HQAR format:
an instance of `SchemaV1` model from validated data stored in QART format:

```python
from hqar import SchemaV1
from qart import SchemaV1

data = load_some_program()

Expand Down
37 changes: 37 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Development guide

## Setting up development environment

QART uses [Poetry](https://python-poetry.org/) for managing dependencies.
Therefore, we recommend you use Poetry to setup your environment. However,
if you insist on not using Poetry, the more traditional way of using
editable install with `pip` is still avaiable.

### Using editable install with Poetry

To setup your development environment install poetry (if you don't have it yet):

```bash
pip install poetry
```

And then install the project and its dependencies:

```bash
poetry install
```

### Using editable install with pip

You can also develop Poetry using `pip`:

```bash
pip install -e .
```

!!! Warning

If you are planning to add/modify dependencies of QART, we
highly recommend you use Poetry instead of pip editable install.
Without Poetry, you will need to edit dependencies manually,
which is very error-prone.
Loading
Loading