Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Main pipeline for linting and testing

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out
uses: actions/checkout@v4

- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.10.*"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Run pre-commit
# FIXME: Does only run on subset of files since not all files are linted yet
run: pre-commit run --files pyproject.toml .pre-commit-config.yaml requirements/* --show-diff-on-failure

build:
runs-on: ubuntu-latest
timeout-minutes: 60
Copy link

@purva-thakre purva-thakre Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never used this. What's the motivation behind using timeout in a testing workflow? The unit tests could take longer than 60 minutes, right?

strategy:
matrix:
python-version: ["3.10.*"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor suggestion: you should add more python versions given that the readme states that Qrisp is compatible with 3.10, 3.11 & 3.12.

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]

- name: Test with pytest
run: pytest
34 changes: 0 additions & 34 deletions .github/workflows/qrisp_test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ __pycache__/
/docuenv/
/eccvenv/
/python311venv/
/multiverseenv/
/multiverseenv/
63 changes: 0 additions & 63 deletions .gitlab-ci.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-toml
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.12.3"
hooks:
- id: ruff
args: [--exit-non-zero-on-fix, --config=pyproject.toml]
- id: ruff-format
args: [--config=pyproject.toml]
91 changes: 91 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Contributing to Qrisp

Thank you for your interest in contributing to Qrisp! This guide will help you get started with setting up your development environment and understanding the contribution workflow.

- [Contributing to Qrisp](#contributing-to-qrisp)
- [Set up a Python development environment](#set-up-a-python-development-environment)
- [uv](#uv)
- [Conda](#conda)
- [Style and lint](#style-and-lint)
- [Testing](#testing)
- [Dependency management](#dependency-management)
- [License](#license)

## Set up a Python development environment

### uv

For [uv](https://docs.astral.sh/uv/) users, a new virtual environment with required dependencies can be created by running

```bash
uv sync
```

Qrisp can then be installed with development dependencies by running

```bash
uv pip install -e ".[dev]"
```

### Conda

For [Conda](https://anaconda.org/anaconda/conda) users, a new virtual environment can be created as follows

```bash
conda create -y -n qrisp-dev python=3.10 pip
conda activate qrisp-dev
```

Qrisp can then be installed with development dependencies by running

```bash
pip install -e ".[dev]"
```

## Style and lint

Qrisp uses [ruff](https://github.com/astral-sh/ruff) for style checking and linting. The configuration is stored in [pyproject.toml](pyproject.toml). The rules are enforced by using [pre-commit](https://pre-commit.com/). Pre-commit is automatically installed with the `dev` dependencies. It will install [Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) defined in [.pre-commit-config.yaml](.pre-commit-config.yaml), and run them automatically when you run `git commit`. Furthermore, the GitHub pipeline is configured to run pre-commit on every push.

To run `pre-commit` manually

```bash
pre-commit run --show-diff-on-failure
```

To run `ruff` manually

```bash
ruff check
```

## Testing

Tests should be added for every new feature. The tests can be found in the [`tests/`](tests/) folder. For testing the Python library [pytest](https://docs.pytest.org/en/stable/) is used.

To run the tests (use `-s` to print STDOUT)

```bash
pytest
```

## Dependency management

Qrisp dependencies are managed with [pip-compile](https://pip-tools.readthedocs.io/en/latest/) to ensure proper pinning of versions. To update the dependencies, modify the input files (e.g., [`requirements/base.in`](requirements/base.in)), and run:

```bash
pip-compile requirements/base.in -o requirements/base.txt
```

Since we have different groups of dependencies, e.g. `dev` for development dependencies - depending on base dependencies, we use [layered requirement files](https://pip-tools.readthedocs.io/en/latest/#workflow-for-layered-requirements) for [`requirements/dev.in`](requirements/dev.in).

To update all requirement files:

```bash
uv pip compile requirements/base.in -o requirements/base.txt
uv pip compile requirements/dev.in -o requirements/dev.txt
uv pip compile requirements/iqm.in -o requirements/iqm.txt
```

## License

By contributing to Qrisp, you agree that your contributions will be licensed under the [Eclipse Public License 2.0](LICENSE).
6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ No third-party beneficiary rights are created under this Agreement.

Exhibit A - Form of Secondary Licenses Notice

"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
"This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set forth
in the Eclipse Public License, v. 2.0 are satisfied: {name license(s),
version(s), and exceptions or additional permissions here}."

Expand All @@ -274,4 +274,4 @@ version(s), and exceptions or additional permissions here}."
file in a relevant directory) where a recipient would be likely to
look for such a notice.

You may add additional accurate notices of copyright ownership.
You may add additional accurate notices of copyright ownership.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ pip install qrisp
Qrisp has been confirmed to work with Python version 3.10, 3.11 & 3.12.

Qrisp is compatible with any QASM-capable quantum backend! If you want to work with IQM quantum computers as a backend, you need to install additional dependencies using

```bash
pip install qrisp[iqm]
```

## Documentation

The full documentation, alongside with many tutorials and examples, is available under [Qrisp Documentation](https://www.qrisp.eu/).

## Shor's Algorithm with Qrisp
Expand Down Expand Up @@ -75,6 +77,7 @@ To find out how this can be used to break encryption be sure to check the [tutor
Qrisp offers much more than just factoring! More examples, like simulating molecules at the quantum level or how to solve the Travelling Salesman Problem, can be found [here](https://www.qrisp.eu/general/tutorial.html).

## Authors and Citation

Qrisp was mainly devised and implemented by Raphael Seidel, supported by Sebastian Bock, Nikolay Tcholtchev, René Zander, Niklas Steinmann and Matic Petric.

If you have comments, questions or love letters, feel free to reach out to us:
Expand All @@ -89,17 +92,16 @@ If you want to cite Qrisp in your work, please use:

```
@misc{seidel2024qrisp,
title={Qrisp: A Framework for Compilable High-Level Programming of Gate-Based Quantum Computers},
title={Qrisp: A Framework for Compilable High-Level Programming of Gate-Based Quantum Computers},
author={Raphael Seidel and Sebastian Bock and René Zander and Matic Petrič and Niklas Steinmann and Nikolay Tcholtchev and Manfred Hauswirth},
year={2024},
eprint={2406.14792},
archivePrefix={arXiv},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2406.14792},
url={https://arxiv.org/abs/2406.14792},
}
```


## License
[Eclipse Public License 2.0](https://github.com/fraunhoferfokus/Qrisp/blob/main/LICENSE)

[Eclipse Public License 2.0](https://github.com/eclipse-qrisp/Qrisp/blob/main/LICENSE)
56 changes: 48 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"
[project]
name = "qrisp"
version = "0.7.6"
dynamic = ["dependencies", "optional-dependencies"]
description = "Qrisp - A high level language for gate-based quantum computing"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Eclipse Public License 2.0 (EPL-2.0)",
"Operating System :: OS Independent",
]
requires-python = ">=3.10"
readme = "README.md"
license = {file = "LICENSE"}
[[project.authors]]
name = "The Qrisp team"
email = "[email protected]"

[project.urls]
homepage = "https://www.qrisp.eu/"
source = "https://github.com/eclipse-qrisp/Qrisp"
issues = "https://github.com/eclipse-qrisp/Qrisp/issues"

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = [
# isort
"I",
# ruff
"RUF",
# pycodestyle
"E", "W",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
]
ignore = ["E203"]

[tool.setuptools.dynamic.dependencies]
file = "requirements/base.txt"

[tool.setuptools.dynamic.optional-dependencies.dev]
file = "requirements/dev.txt"

[tool.pylint. messages_control]
disable = ["import-error"]
[tool.setuptools.dynamic.optional-dependencies.iqm]
file = "requirements/iqm.txt"
Loading