Skip to content
Merged
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
11 changes: 8 additions & 3 deletions .github/workflows/doc_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ name: Documentation check
on:
- pull_request

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
doc_checks:
runs-on: ubuntu-latest
env:
QISKIT_SETTINGS: ${{github.workspace}}/docs/qiskit_settings.conf

steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.11.0

- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: sQUlearn/sphinx-action@master
with:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@ name: Formatting check
on:
- pull_request

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
black:
runs-on: ubuntu-latest

steps:
- name: Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.11.0

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v6
with:
python-version: 3.9
python-version: 3.13

- name: Install dependencies
run: pip install black[jupyter]

- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Run Black
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ jobs:
id-token: write
steps:
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v6
with:
python-version: 3.9

- name: Install dependencies
run: pip install flit

- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Build
run: flit build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
QISKIT_SETTINGS: ${{github.workspace}}/docs/qiskit_settings.conf
steps:
- name: Checkout Source Code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Checkout GH Pages
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: sQUlearn/squlearn.github.io
fetch-depth: 0
Expand Down
143 changes: 108 additions & 35 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,37 @@ on:
schedule:
- cron: '23 1 * * *'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${
(github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name)
}
cancel-in-progress: true

jobs:
pytest_minimal_requirements:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv_minimal
source venv_minimal/bin/activate
python -m pip install --upgrade pip
pip install toml autoray==0.7.2 matplotlib-inline==0.1.7
python3 install_lowest_dependencies.py
- name: Test with pytest
run: |
source venv_minimal/bin/activate
pip install pytest
pytest tests/
- name: Install example dependencies
run: |
source venv_minimal/bin/activate
python3 install_lowest_dependencies.py --examples
- name: Test examples
run: |
source venv_minimal/bin/activate
pip install nbmake
pytest --nbmake --nbmake-timeout 600 examples/
- name: clean
run: |
rm -rf venv_minimal
Expand All @@ -43,27 +43,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv_qiskit_0_46
source venv_qiskit_0_46/bin/activate
pip install .[examples] qiskit==0.46.3 qiskit-ibm-runtime==0.20.0 autoray==0.7.2
python -m pip install --upgrade pip
pip install . qiskit==0.46.3 qiskit-ibm-runtime==0.20.0 autoray==0.7.2
- name: Test with pytest
run: |
source venv_qiskit_0_46/bin/activate
pip install pytest
pytest tests/
- name: Test examples
run: |
source venv_qiskit_0_46/bin/activate
pip install nbmake
pytest --nbmake --nbmake-timeout 600 examples/
- name: clean
run: |
rm -rf venv_qiskit_0_46
Expand All @@ -72,47 +67,54 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv_qiskit_1
source venv_qiskit_1/bin/activate
pip install .[examples] qiskit==1.1.2 qiskit-algorithms==0.3.0 qiskit-ibm-runtime==0.27.1 autoray==0.7.2
python -m pip install --upgrade pip
pip install . qiskit==1.1.2 qiskit-algorithms==0.3.0 qiskit-ibm-runtime==0.27.1 autoray==0.7.2
- name: Test with pytest
run: |
source venv_qiskit_1/bin/activate
pip install pytest
pytest tests/
- name: Test examples
run: |
source venv_qiskit_1/bin/activate
pip install nbmake
pytest --nbmake --nbmake-timeout 600 examples/
- name: clean
run: |
rm -rf venv_qiskit_1

pytest_latest:
pytest_full:
name: Tests + Examples on ubuntu-latest with Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: |
3.12
${{
matrix.python-version
}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv_latest
source venv_latest/bin/activate
python -m pip install --upgrade pip
pip install .[examples]
- name: Install old autoray
if: matrix.python-version == '3.9'
run: |
source venv_latest/bin/activate
pip install autoray==0.7.2
- name: Test with pytest
run: |
source venv_latest/bin/activate
Expand All @@ -126,3 +128,74 @@ jobs:
- name: clean
run: |
rm -rf venv_latest

pytest_windows:
name: Test on windows-latest with Python ${{ matrix.python-version }}
runs-on: windows-latest

strategy:
matrix:
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: |
${{
matrix.python-version
}}
- name: Install dependencies
run: |
python -m venv venv_latest
.\venv_latest\Scripts\python.exe -m pip install --upgrade pip
.\venv_latest\Scripts\pip.exe install .
- name: Install old autoray
if: matrix.python-version == '3.9'
run: |
.\venv_latest\Scripts\pip.exe install autoray==0.7.2
- name: Test with pytest
run: |
.\venv_latest\Scripts\pip.exe install pytest
.\venv_latest\Scripts\pytest.exe tests/
- name: clean
run: |
rm -Recurse -Force venv_latest

pytest_macos:
name: Test on macos-latest with Python ${{ matrix.python-version }}
runs-on: macos-latest

strategy:
matrix:
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: |
${{
matrix.python-version
}}
- name: Install dependencies
run: |
python -m venv venv_latest
source venv_latest/bin/activate
python -m pip install --upgrade pip
pip install .
- name: Install old autoray
if: matrix.python-version == '3.9'
run: |
source venv_latest/bin/activate
pip install autoray==0.7.2
- name: Test with pytest
run: |
source venv_latest/bin/activate
pip install pytest
pytest tests/
- name: clean
run: |
rm -rf venv_latest
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
"tqdm>=4.1.0",
"qulacs>=0.6.0",
]
requires-python = ">=3.9,<3.13"
requires-python = ">=3.9"
dynamic = ["version", "description"]

[project.optional-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/squlearn/kernel/loss/ode_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,14 @@ def __init__(
ode_functional: Union[sp.Expr, Callable],
initial_values: Union[Sequence, np.ndarray],
symbols_involved_in_ode: Optional[Sequence[sp.Basic]] = None,
eta: float = np.float64(1.0),
eta: float = 1.0,
ode_order: Optional[int] = None,
):
super().__init__()

# normalize initial_values to a 1D numpy array
self.initial_values = np.asarray(initial_values).ravel()
self.eta = float(eta)
self.eta = eta

if isinstance(ode_functional, sp.Expr):
if symbols_involved_in_ode is None:
Expand Down
2 changes: 1 addition & 1 deletion src/squlearn/qnn/loss/ode_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(
ode_functional=None,
symbols_involved_in_ode=None,
initial_values: np.ndarray = None,
eta=np.float64(1.0),
eta: float = 1.0,
):
super().__init__()
self._verify_size_of_ivp_with_order_of_ode(initial_values, symbols_involved_in_ode)
Expand Down
Loading