-
Notifications
You must be signed in to change notification settings - Fork 47
Cleanup Qrisp packaging pipeline #243
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
Draft
JLenssen
wants to merge
2
commits into
eclipse-qrisp:main
Choose a base branch
from
JLenssen:cleanup_qrisp_packaging_pipeline
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.10.*"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,4 +13,4 @@ __pycache__/ | |
| /docuenv/ | ||
| /eccvenv/ | ||
| /python311venv/ | ||
| /multiverseenv/ | ||
| /multiverseenv/ | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
timeoutin a testing workflow? The unit tests could take longer than 60 minutes, right?