Skip to content

Commit

Permalink
Merge branch 'develop' into 30-implement-qoala-runtime
Browse files Browse the repository at this point in the history
# Conflicts:
#	netqasm/lang/instr/flavour.py
#	netqasm/sdk/connection.py
  • Loading branch information
dieriver committed Sep 16, 2024
2 parents 8d8f244 + aa9b2e3 commit 3e1ec1c
Show file tree
Hide file tree
Showing 32 changed files with 370 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: General check

on: push
on: [push, pull_request]

jobs:
lint:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/simulaqron.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

name: SimulaQron backend tests

on: push
on: [push, pull_request]

jobs:
examples:
Expand All @@ -17,7 +16,7 @@ jobs:
- name: Install netqasm
run: make install-dev
- name: Install projectq
run: pip install -Iv projectq==0.5.1
run: pip install -Iv projectq
- name: Run examples
env:
NETQASM_SIMULATOR: simulaqron
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/squidasm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: SquidASM backend tests

on: push
on: [push, pull_request]

jobs:
tests:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*.log
**/log/*
*.pkl
/docs/build/*
/docs/_build/*
/build/*
/dist/*
/*.egg-info/*
Expand Down
22 changes: 19 additions & 3 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

python:
version: 3.8
setup_py_install: true
pip_install: true
install:
- requirements: docs/requirements.txt
- method: pip
path: .

formats:
- pdf
- epub
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
CHANGELOG
=========

2024-09-13 (1.0.0)
-------------------
- Fix bell state corrections when compiling for hardware

2024-03-20 (0.16.0)
-------------------
- Added the REIDS flavour.

2024-01-15 (0.15.0)
-------------------
- Change level of subroutine compilation logging from `INFO` to `DEBUG` to avoid cluttering.

2023-10-10 (0.14.0)
-------------------
- Fix connection getting flushed during exception handling

2023-07-24 (0.13.3)
-------------------
- Fixed an issue with LAST instruction logs.

2023-07-07 (0.13.2)
-------------------
- Relaxed version requirements on dependencies

2023-01-26 (0.13.1)
-------------------
- Add instructions on updating CHANGELOG.md

2022-12-13 (0.13.0)
-------------------
- Use nodes' app names for instruction logging.

2022-11-15 (0.12.2)
-------------------
- Update SquidASM to 0.10.0.
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,41 @@ explore a commercial market, please contact us for a license agreement.



## Development
# Development
For code formatting, [`black`](https://github.com/psf/black) and [`isort`](https://github.com/PyCQA/isort) are used.
Type hints should be added as much as possible.
Types are checked using [`mypy`](https://github.com/python/mypy).

Before code is pushed, make sure that the `make lint` command succeeds, which runs `black`, `isort`, `flake8` and `mypy`.

## Branches
A form of "git flow" is used for branch and release management. The main active branch is `develop`.
New features are developed in new separate branches, preferrably with a name representing the new feature.
To get the new features in the main branch, open a pull request for merging the feature branch into the `develop` branch.
These pull requests are then reviewed by maintainers of the repository.
A `master` or `main` branch is not used.


## Releases (for maintainers only)
When a release is made, a new branch `release-X.Y` (e.g. `release-0.12`) is created from the `develop` branch.
Only small fixes (patches) may be pushed onto this release branch. Bigger new features need to go into separate branches, merged into `develop`, and will hence end up in a later release.
**Tags** are *only* applied on commits in the release branch. The first tag on a new release branch needs to be `vX.Y.0`, e.g. `v0.12.0`.
Patches (i.e. commits on the release branch) may then be tagged with `vX.Y.1`, `vX.Y.2` etc.
Pushing a 'tag' automatically triggers the Github Action for publishing the corresponding version to PyPI.
Whenever a new tag is pushed for a patch, the corresponding commit (on the release branch) should be merged into `develop`.

Example list of steps for releasing a new version:
- (0) `develop` contains all the features that are needed for the release
- (1) update `CHANGELOG.md` with the new version number and the changes (this will require a final PR to `develop`)
- (2) create a `release-X.Y` branch from `develop` and switch to this branch
- (3) create a tag `vX.Y.0` on this branch
- (4) push the release branch as well as the tag (pushing the tag will automatically publish to PyPI)
- (5) develop a small fix (patch) as a commit on the `release-X.Y` branch
- (6) update `CHANGELOG.md` with the new (minor) version number and the changes
- (7) push the new commit and see if all the workflows (in Github Actions) succeed for `release-X.Y`
- (8) add a tag `vX.Y.1` to this latest commit
- (9) push the new tag; the patch will automatically be published on PyPI
- (10) create a pull request for merging `release-X.Y` into `develop`

# Contributors
In alphabetical order:
Expand Down
5 changes: 2 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SOURCEDIR = .
BUILDDIR = build
PYTHON3 = python3
BUILDDIR = _build
PYTHON3 = python
# TODO handle like this?
export NETQASM_SIMULATOR = debug

Expand All @@ -19,7 +19,6 @@ help:
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)


python-deps:
@${PYTHON3} -m pip install -r requirements.txt

Expand Down
2 changes: 1 addition & 1 deletion docs/api_root.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ netqasm package
netqasm.logging
netqasm.runtime
netqasm.sdk
netqasm.util
netqasm.util
8 changes: 0 additions & 8 deletions docs/api_sdk/netqasm.sdk.compiling.rst

This file was deleted.

13 changes: 8 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
from importlib.metadata import version as get_release_version
# import os
import re
# import sys

# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = "netqasm"
copyright = "2021, QuTech"
copyright = "2023, QuTech"
author = "QuTech"

# The full version, including alpha/beta/rc tags
from importlib.metadata import version

release = version("netqasm")
release = get_release_version("netqasm")

# The short X.Y version.
version = re.match(r'^(\d+\.\d+)', release).expand(r'\1')

# -- General configuration ---------------------------------------------------

Expand Down Expand Up @@ -84,4 +87,4 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
# html_static_path = ["_static"]
4 changes: 3 additions & 1 deletion docs/netqasm.examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ netqasm\.examples
api_examples/netqasm.examples.apps
api_examples/netqasm.examples.lib
api_examples/netqasm.examples.netqasm_files
api_examples/netqasm.examples.sdk_examples
api_examples/netqasm.examples.qne_apps
api_examples/netqasm.examples.sdk_compilation
api_examples/netqasm.examples.sdk_scripts
5 changes: 2 additions & 3 deletions docs/netqasm.sdk.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
netqasm\.sdk
================
============

.. toctree::
:caption: Modules
:maxdepth: 2

api_sdk/netqasm.sdk.builder
api_sdk/netqasm.sdk.classical_communication
api_sdk/netqasm.sdk.compiling
api_sdk/netqasm.sdk.config
api_sdk/netqasm.sdk.connection
api_sdk/netqasm.sdk.epr_socket
Expand All @@ -17,4 +16,4 @@ netqasm\.sdk
api_sdk/netqasm.sdk.progress_bar
api_sdk/netqasm.sdk.qubit
api_sdk/netqasm.sdk.shared_memory
api_sdk/netqasm.sdk.toolbox
api_sdk/netqasm.sdk.toolbox
15 changes: 7 additions & 8 deletions docs/quickstart/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ NetQASM connection
:noindex:
:special-members: __enter__, __exit__
:members:
:undoc-members: app_name, node_name, app_id, flush, block
:undoc-members: app_name, node_name, app_id, flush, block

Qubit
-----
Expand All @@ -61,7 +61,7 @@ Qubit
.. autoclass:: Qubit
:noindex:
:members:
:undoc-members: qubit_id, entanglement_info, remote_entangled_node, measure,
:undoc-members: qubit_id, entanglement_info, remote_entangled_node, measure,
X, Y, Z, H, S, K, T,
rot_X, rot_Y, rot_Z,
cnot, cphase, reset, free
Expand All @@ -74,8 +74,8 @@ EPR socket

.. autoclass:: EPRSocket
:members:
:undoc-members: conn, remote_app_name, remote_node_id, epr_socket_id, remote_epr_socket_id, min_fidelity,
create, recv,
:undoc-members: conn, remote_app_name, remote_node_id, epr_socket_id, remote_epr_socket_id, min_fidelity,
create, recv,
:noindex:

.. automethod:: create_context(number=1, sequential=False)
Expand All @@ -92,20 +92,19 @@ Futures

.. autoclass:: Future
:members:
:undoc-members: add, value
:undoc-members: add, value
:noindex:

.. autoclass:: Array
:members:
:undoc-members: get_future_index, get_future_slice, foreach, enumerate
:undoc-members: get_future_index, get_future_slice, foreach, enumerate
:noindex:

.. autoclass:: RegFuture
:members:
:undoc-members: add, value
:undoc-members: add, value
:noindex:


Classical communication
-----------------------

Expand Down
6 changes: 4 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sphinx>=3.5.3,<4.0.0
sphinx-rtd-theme>=0.5.2,<1.0.0
sphinx>=7.2.6
sphinx-rtd-theme>=2.0.0
sphinx-autodoc-typehints>=1.11.1,<2.0.0
jinja2>=3.0
MarkupSafe==2.0.1
2 changes: 1 addition & 1 deletion netqasm/lang/instr/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ class DebugInstruction(NetQASMInstruction):

@property
def operands(self) -> List[Operand]:
pass
return []

@classmethod
def deserialize_from(cls, raw: bytes):
Expand Down
9 changes: 9 additions & 0 deletions netqasm/lang/instr/flavour.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ def __init__(self):
super().__init__(self.instrs)


class REIDSFlavour(Flavour):
@property
def instrs(self):
return []

def __init__(self):
super().__init__(self.instrs)


class TrappedIonFlavour(Flavour):
@property
def instrs(self):
Expand Down
4 changes: 2 additions & 2 deletions netqasm/lang/parsing/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def parse_text_subroutine(
assign_branch_labels=True,
make_args_operands=True,
replace_constants=True,
flavour: Flavour = None,
flavour: Optional[Flavour] = None,
) -> Subroutine:
"""
Convert a text representation of a subroutine into a Subroutine object.
Expand All @@ -70,7 +70,7 @@ def assemble_subroutine(
assign_branch_labels=True,
make_args_operands=True,
replace_constants=True,
flavour: Flavour = None,
flavour: Optional[Flavour] = None,
) -> Subroutine:
"""
Convert a `ProtoSubroutine` into a `Subroutine`, given a Flavour (default: vanilla).
Expand Down
6 changes: 3 additions & 3 deletions netqasm/runtime/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def load_yaml_file(path: str) -> Any:
return load_yaml(path)


def app_instance_from_path(app_dir: str = None) -> ApplicationInstance:
def app_instance_from_path(app_dir: Optional[str] = None) -> ApplicationInstance:
"""
Create an Application Instance based on files in a directory.
Uses the current working directory if `app_dir` is None.
Expand Down Expand Up @@ -168,7 +168,7 @@ def default_app_instance(programs: List[Tuple[str, Callable]]) -> ApplicationIns


def network_cfg_from_path(
app_dir: str = None, network_config_file: str = None
app_dir: Optional[str] = None, network_config_file: Optional[str] = None
) -> Optional[NetworkConfig]:
if network_config_file is None:
network_config_file = "network.yaml"
Expand All @@ -184,7 +184,7 @@ def network_cfg_from_path(


def post_function_from_path(
app_dir: str = None, post_function_file: str = None
app_dir: Optional[str] = None, post_function_file: Optional[str] = None
) -> Optional[Callable]:
if post_function_file is None:
post_function_file = "post_function.yaml"
Expand Down
Loading

0 comments on commit 3e1ec1c

Please sign in to comment.