Skip to content

Commit cc0a0e4

Browse files
lneuhausheltluke
andauthored
Updates for scipy, numpy 2, and Python 3.12 (#757)
* scipy.integrate.simps to scipy.integrate.simpson * no more ragged arrays * run black * bump versions, update CHANGELOG * fixes * fix docs? * run black * use numpy 2 * allow older scipt as well * fix docs? * Apply suggestions from code review * fix docs? * fix test * fix docs? * fix docs? * fix docs? * fix docs? * fix docs? * fix docs? * fix docs? * fix docs? * try to fix tests * try to fix tests * try to fix tests using latest thewalrus * try to fix tests using latest thewalrus * fix typo in test fix * debug info * xfail broken test * codecov * codecov * test * Update test_param.py * Apply suggestions from code review Co-authored-by: Luke Helt <31250931+heltluke@users.noreply.github.com> * fmt * Update requirements.txt * Update requirements-ci.txt * revert cosmetic changes * more * more * even more * and yet more * Apply suggestions from code review Still needs capitals * Revert "Apply suggestions from code review " This reverts commit 01a1e58. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch updates-for-scipy-2 # Your branch is up to date with 'origin/updates-for-scipy-2'. # # Changes to be committed: # modified: .github/workflows/tests.yaml # * black --------- Co-authored-by: Luke Helt <luke.helt@gmail.com> Co-authored-by: Luke Helt <31250931+heltluke@users.noreply.github.com>
1 parent 9cd6444 commit cc0a0e4

32 files changed

+114
-69
lines changed

.github/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212

1313
<h3>Bug fixes</h3>
1414

15+
* Updates `scipy.integrate.simps` to `scipy.integrate.simpson` when using newer scipy versions, such that SF continues working. Also makes numpy usage explicit about the creation of ragged numpy arrays. This patch furthermore fixes a number of CI issues, to get most test pipelines passing again.
16+
[#757](https://github.com/XanaduAI/strawberryfields/pull/757)
17+
1518
<h3>Documentation</h3>
1619

1720
<h3>Contributors</h3>
1821

1922
This release contains contributions from (in alphabetical order):
2023

21-
Theodor Isacsson
24+
Leonhard Neuhaus, Luke Helt, Theodor Isacsson
2225

2326

2427
# Release 0.23.0 (current release)

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
sphinx:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
9+
- uses: actions/checkout@v4
1010
- uses: XanaduAI/sphinx-action@master
1111
with:
1212
docs-folder: "doc/"

.github/workflows/tests.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ jobs:
3737
with:
3838
access_token: ${{ github.token }}
3939

40-
- uses: actions/checkout@v2
40+
- uses: actions/checkout@v4
4141
with:
4242
fetch-depth: 2
4343

4444
- name: Set up Python
4545
uses: actions/setup-python@v2
4646
with:
47-
python-version: 3.8
47+
python-version: 3.12
4848

4949
- name: Install dependencies
5050
run: |
@@ -57,7 +57,7 @@ jobs:
5757
run: |
5858
pip install -r requirements-ci.txt
5959
python3 setup.py bdist_wheel
60-
pip install dist/StrawberryFields*.whl
60+
pip install dist/strawberryfields*.whl
6161
6262
- name: Run tests
6363
run: python3 -m pytest tests --cov=strawberryfields --cov-report=term-missing --cov-report=xml -p no:warnings --randomly-seed=42 --tb=native -m "$OPTIONS"
@@ -66,6 +66,9 @@ jobs:
6666
run: bash <(sed -i 's/filename=\"/filename=\"strawberryfields\//g' coverage.xml)
6767

6868
- name: Upload coverage to Codecov
69-
uses: codecov/codecov-action@v1
69+
uses: codecov/codecov-action@v5
7070
with:
71-
file: ./coverage.xml
71+
# token: ${{ secrets.CODECOV_TOKEN }} # we currently do not have a token for SF
72+
files: ./coverage.xml
73+
disable_search: true
74+
fail_ci_if_error: false

.readthedocs.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ sphinx:
44
configuration: doc/conf.py
55

66
python:
7-
version: 3.8
8-
install:
9-
- requirements: doc/requirements.txt
10-
- method: pip
11-
path: .
12-
system_packages: true
7+
install:
8+
- requirements: doc/requirements.txt
9+
- method: pip
10+
path: .
1311

1412
build:
15-
image: latest
13+
os: ubuntu-22.04
14+
tools:
15+
python: "3.8"

doc/requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ jinja2==3.0.3
55
sphinx==2.2.2
66
m2r2==0.3.1
77
mistune==0.8.4
8-
numba==0.53.1
8+
numba==0.56.4
99
networkx==2.6.3
1010
numpy==1.19.2
1111
plotly==4.4.1
1212
protobuf<4.21.0 # remove when fix is released
1313
quantum-blackbird==0.4.0
14+
quantum-xir>=0.1.1
1415
scipy==1.7.1
1516
scikit-learn==1.0.2
1617
sphinx-autodoc-typehints==1.10.3
1718
sphinx-copybutton==0.4.0
1819
sphinx-automodapi==0.13
1920
sphinxcontrib-bibtex==0.4.2
2021
tensorflow==2.6.3
21-
thewalrus==0.18.0
22+
thewalrus==0.19.0
2223
toml==0.10.2
2324
xanadu-sphinx-theme==0.1.0
25+
xanadu-cloud-client>=0.2.1

requirements-ci.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ tensorboard
66
networkx
77
quantum-blackbird
88
python-dateutil
9-
thewalrus>=0.17.0
9+
thewalrus>=0.22.0
1010
toml
1111
numba
1212
requests
13+
setuptools
1314
urllib3
1415
plotly

requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
networkx==2.7.1
22
numba==0.55.1
3-
numpy==1.21.5
3+
numpy==1.26.4
44
plotly==5.6.0
55
python-dateutil==2.8.2
66
quantum-blackbird==0.4.0
77
requests==2.27.1
8-
scipy==1.8.0
8+
scipy==1.14.0
99
sympy==1.10
1010
tensorflow==2.8.0
1111
tensorboard==2.8.0
12-
thewalrus==0.19.0
12+
thewalrus==0.22.0
1313
toml==0.10.2
1414
typing-extensions==4.1.1
1515
urllib3==1.26.8

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"python-dateutil>=2.8.0",
2626
"quantum-blackbird>=0.4.0",
2727
"requests>=2.22.0",
28-
"scipy>=1.0.0",
28+
"scipy>=1.8.0",
2929
"sympy>=1.5",
3030
"thewalrus>=0.18.0",
3131
"toml",

strawberryfields/apps/data/sample.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def _data_filename(self) -> str:
4848
``scipy.sparse.csr_matrix`` saved in ``.npz`` format.
4949
5050
For ``_data_filename = "example"``, the corresponding samples should be stored as
51-
``./sample_data/example.npz`` and the adjacency matrix as ``./sample_data/example_A.npz``."""
51+
``./sample_data/example.npz`` and the adjacency matrix as ``./sample_data/example_A.npz``.
52+
"""
5253
pass
5354

5455
def __init__(self):

strawberryfields/apps/train/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
<br>
9393
9494
"""
95+
9596
from strawberryfields.apps.train.cost import KL, Stochastic
9697
from strawberryfields.apps.train.embed import Exp, ExpFeatures
9798
from strawberryfields.apps.train.param import (

0 commit comments

Comments
 (0)