diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1df16f7b..fe0fa945 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,8 +13,8 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
- platform: [ ubuntu-latest, macos-latest, windows-latest ]
- python-version: [ '3.9', '3.10', '3.11' ]
+ platform: [ubuntu-latest, macos-latest, windows-latest]
+ python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
@@ -36,7 +36,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
- python-version: '3.9'
+ python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
@@ -46,30 +46,30 @@ jobs:
run: tox -e docs
run_resonance_integration_test:
- needs: [test]
- if: |
- success() && (
- github.event_name == 'schedule' ||
- (github.event_name == 'push' && github.ref == 'refs/heads/main')
- )
- runs-on: ${{ matrix.platform }}
- environment: resonance-test # Keep the environment for secure secret management
- strategy:
- matrix:
- platform: [ ubuntu-latest, macos-latest, windows-latest ]
- python-version: [ '3.9', '3.10', '3.11' ]
- steps:
- - uses: actions/checkout@v4
- - name: Setup Python
- uses: actions/setup-python@v5
- with:
- python-version: ${{ matrix.python-version }}
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- python -m pip install -e ".[dev]"
- python -m pip install tox-gh-actions==2.12.0
- - name: Run Resonance example integration test
- run: tox -e test_resonance_example
- env:
- RESONANCE_API_KEY: ${{ secrets.RESONANCE_API_KEY }}
+ needs: [test]
+ if: |
+ success() && (
+ github.event_name == 'schedule' ||
+ (github.event_name == 'push' && github.ref == 'refs/heads/main')
+ )
+ runs-on: ${{ matrix.platform }}
+ environment: resonance-test # Keep the environment for secure secret management
+ strategy:
+ matrix:
+ platform: [ubuntu-latest, macos-latest, windows-latest]
+ python-version: ["3.9", "3.10", "3.11"]
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install -e ".[dev]"
+ python -m pip install tox-gh-actions==2.12.0
+ - name: Run Resonance example integration test
+ run: tox -e test_resonance_example
+ env:
+ RESONANCE_API_KEY: ${{ secrets.RESONANCE_API_KEY }}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..318eb383
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,18 @@
+repos:
+ - repo: local
+ hooks:
+ - id: format
+ name: format
+ entry: tox -e format
+ language: system
+ files: \.py$
+ pass_filenames: false
+
+ - repo: local
+ hooks:
+ - id: pip-compile
+ name: pip-compile
+ entry: tox -e pip-compile
+ language: system
+ files: ^pyproject\.toml$
+ pass_filenames: false
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 838cf8b6..ddef24de 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -14,9 +14,10 @@ and install it in editable mode with all the extras:
$ git clone git@github.com:iqm-finland/qiskit-on-iqm.git
$ cd qiskit-on-iqm
$ pip install -e ".[dev,docs,testing]"
+ $ pre-commit install
-To be able to build the docs `graphviz `_ has to be installed.
+To be able to build the docs `graphviz `_ has to be installed.
Then to build and view the docs run:
.. code-block:: bash
@@ -30,6 +31,12 @@ Format your code:
$ tox -e format
+Update the requirements:
+
+.. code-block:: bash
+
+ $ tox -e pip-compile
+
Run the tests:
.. code-block:: bash
diff --git a/pyproject.toml b/pyproject.toml
index a5129d21..93bdbbe9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,9 @@ changelog = "https://github.com/iqm-finland/qiskit-on-iqm/blob/main/CHANGELOG.rs
# Add here additional requirements for extra features, to install with:
# `pip install qiskit-iqm[dev,docs,testing]
dev = [
- "tox == 4.11.4"
+ "tox == 4.11.4",
+ "pre_commit == 4.0.1",
+ "pip-tools == 7.4.1"
]
docs = [
"sphinx == 7.2.6",
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..82481825
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,257 @@
+#
+# This file is autogenerated by pip-compile with Python 3.11
+# by the following command:
+#
+# pip-compile --all-extras --output-file=requirements.txt pyproject.toml
+#
+accessible-pygments==0.0.5
+ # via pydata-sphinx-theme
+aiohappyeyeballs==2.4.4
+ # via aiohttp
+aiohttp==3.11.10
+ # via black
+aiosignal==1.3.1
+ # via aiohttp
+alabaster==0.7.16
+ # via sphinx
+annotated-types==0.7.0
+ # via pydantic
+astroid==3.0.3
+ # via pylint
+attrs==24.2.0
+ # via aiohttp
+babel==2.16.0
+ # via
+ # pydata-sphinx-theme
+ # sphinx
+beautifulsoup4==4.12.3
+ # via pydata-sphinx-theme
+black==23.12.0
+ # via qiskit-iqm (pyproject.toml)
+build==1.2.2.post1
+ # via pip-tools
+cachetools==5.5.0
+ # via tox
+certifi==2024.8.30
+ # via requests
+cfgv==3.4.0
+ # via pre-commit
+chardet==5.2.0
+ # via tox
+charset-normalizer==3.4.0
+ # via requests
+click==8.1.7
+ # via
+ # black
+ # pip-tools
+colorama==0.4.6
+ # via tox
+coverage[toml]==7.6.9
+ # via pytest-cov
+dill==0.3.9
+ # via
+ # pylint
+ # qiskit
+distlib==0.3.9
+ # via virtualenv
+docutils==0.20.1
+ # via
+ # pydata-sphinx-theme
+ # sphinx
+filelock==3.16.1
+ # via
+ # tox
+ # virtualenv
+frozenlist==1.5.0
+ # via
+ # aiohttp
+ # aiosignal
+identify==2.6.3
+ # via pre-commit
+idna==3.10
+ # via
+ # requests
+ # yarl
+imagesize==1.4.1
+ # via sphinx
+iniconfig==2.0.0
+ # via pytest
+iqm-client==20.8
+ # via qiskit-iqm (pyproject.toml)
+isort==5.13.2
+ # via
+ # pylint
+ # qiskit-iqm (pyproject.toml)
+jinja2==3.1.4
+ # via sphinx
+markupsafe==3.0.2
+ # via jinja2
+mccabe==0.7.0
+ # via pylint
+mockito==1.4.0
+ # via qiskit-iqm (pyproject.toml)
+mpmath==1.3.0
+ # via sympy
+multidict==6.1.0
+ # via
+ # aiohttp
+ # yarl
+mypy==1.7.1
+ # via qiskit-iqm (pyproject.toml)
+mypy-extensions==1.0.0
+ # via
+ # black
+ # mypy
+nodeenv==1.9.1
+ # via pre-commit
+numpy==2.2.0
+ # via
+ # iqm-client
+ # qiskit
+ # qiskit-aer
+ # qiskit-iqm (pyproject.toml)
+ # rustworkx
+ # scipy
+packaging==24.2
+ # via
+ # black
+ # build
+ # iqm-client
+ # pyproject-api
+ # pytest
+ # sphinx
+ # tox
+pathspec==0.12.1
+ # via black
+pbr==6.1.0
+ # via stevedore
+pip-tools==7.4.1
+ # via qiskit-iqm (pyproject.toml)
+platformdirs==4.3.6
+ # via
+ # black
+ # pylint
+ # tox
+ # virtualenv
+pluggy==1.5.0
+ # via
+ # pytest
+ # tox
+pre-commit==4.0.1
+ # via qiskit-iqm (pyproject.toml)
+propcache==0.2.1
+ # via
+ # aiohttp
+ # yarl
+psutil==6.1.0
+ # via qiskit-aer
+pydantic==2.10.3
+ # via iqm-client
+pydantic-core==2.27.1
+ # via pydantic
+pydata-sphinx-theme==0.16.0
+ # via sphinx-book-theme
+pygments==2.18.0
+ # via
+ # accessible-pygments
+ # pydata-sphinx-theme
+ # sphinx
+pylint==3.0.3
+ # via
+ # pytest-pylint
+ # qiskit-iqm (pyproject.toml)
+pyproject-api==1.8.0
+ # via tox
+pyproject-hooks==1.2.0
+ # via
+ # build
+ # pip-tools
+pytest==7.4.3
+ # via
+ # pytest-cov
+ # pytest-pylint
+ # qiskit-iqm (pyproject.toml)
+pytest-cov==4.1.0
+ # via qiskit-iqm (pyproject.toml)
+pytest-pylint==0.21.0
+ # via qiskit-iqm (pyproject.toml)
+python-dateutil==2.9.0.post0
+ # via qiskit
+pyyaml==6.0.2
+ # via pre-commit
+qiskit==1.1.2
+ # via
+ # qiskit-aer
+ # qiskit-iqm (pyproject.toml)
+qiskit-aer==0.14.2
+ # via qiskit-iqm (pyproject.toml)
+requests==2.32.3
+ # via
+ # iqm-client
+ # sphinx
+rustworkx==0.15.1
+ # via qiskit
+scipy==1.14.1
+ # via
+ # qiskit
+ # qiskit-aer
+six==1.17.0
+ # via python-dateutil
+snowballstemmer==2.2.0
+ # via sphinx
+soupsieve==2.6
+ # via beautifulsoup4
+sphinx==7.2.6
+ # via
+ # pydata-sphinx-theme
+ # qiskit-iqm (pyproject.toml)
+ # sphinx-book-theme
+sphinx-book-theme==1.1.2
+ # via qiskit-iqm (pyproject.toml)
+sphinxcontrib-applehelp==2.0.0
+ # via sphinx
+sphinxcontrib-devhelp==2.0.0
+ # via sphinx
+sphinxcontrib-htmlhelp==2.1.0
+ # via sphinx
+sphinxcontrib-jsmath==1.0.1
+ # via sphinx
+sphinxcontrib-qthelp==2.0.0
+ # via sphinx
+sphinxcontrib-serializinghtml==2.0.0
+ # via sphinx
+stevedore==5.4.0
+ # via qiskit
+symengine==0.13.0
+ # via qiskit
+sympy==1.13.3
+ # via qiskit
+tomlkit==0.13.2
+ # via pylint
+tox==4.11.4
+ # via qiskit-iqm (pyproject.toml)
+types-jinja2==2.11.9
+ # via qiskit-iqm (pyproject.toml)
+types-markupsafe==1.1.10
+ # via types-jinja2
+typing-extensions==4.12.2
+ # via
+ # mypy
+ # pydantic
+ # pydantic-core
+ # pydata-sphinx-theme
+ # qiskit
+urllib3==2.2.3
+ # via requests
+virtualenv==20.28.0
+ # via
+ # pre-commit
+ # tox
+wheel==0.45.1
+ # via pip-tools
+yarl==1.18.3
+ # via aiohttp
+
+# The following packages are considered to be unsafe in a requirements file:
+# pip
+# setuptools
diff --git a/tox.ini b/tox.ini
index 22f05630..f711c7f9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
minversion = 4.11
-envlist = py39, py310, py311, qiskit-{v0.45,v0.46,v1.0,v1.1}
+envlist = py39, py310, py311, qiskit-{v0.45,v0.46,v1.0,v1.1}, pip-compile
skip_missing_interpreters = True
[gh-actions]
@@ -87,3 +87,13 @@ deps =
build[virtualenv] == 1.0.3
commands =
python -m build
+
+[testenv:pip-compile]
+description =
+ Update the requirements files.
+skip_install = True
+base_python = python3.11
+deps =
+ pip-tools == 7.4.1
+commands =
+ pip-compile pyproject.toml --all-extras --output-file=requirements.txt