Skip to content

Commit c68174a

Browse files
feat: Drop support for Python 3.8, update dependencies (#1782)
--------- Co-authored-by: jselig-rigetti <[email protected]>
1 parent c78c5a9 commit c68174a

File tree

120 files changed

+3431
-3962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+3431
-3962
lines changed

.github/workflows/test.yml

+34-19
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v2
16-
- name: Set up Python 3.8
17-
uses: actions/setup-python@v2
16+
- name: Set up Python 3.9
17+
uses: actions/setup-python@v4
1818
with:
19-
python-version: '3.8'
19+
python-version: '3.9'
2020
- uses: actions/cache@v2
2121
with:
2222
path: .venv
@@ -33,10 +33,10 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v2
36-
- name: Set up Python 3.8
37-
uses: actions/setup-python@v2
36+
- name: Set up Python 3.9
37+
uses: actions/setup-python@v4
3838
with:
39-
python-version: '3.8'
39+
python-version: '3.9'
4040
- uses: actions/cache@v2
4141
with:
4242
path: .venv
@@ -52,10 +52,10 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454
- uses: actions/checkout@v2
55-
- name: Set up Python 3.8
56-
uses: actions/setup-python@v2
55+
- name: Set up Python 3.9
56+
uses: actions/setup-python@v4
5757
with:
58-
python-version: '3.8'
58+
python-version: '3.9'
5959
- uses: actions/cache@v2
6060
with:
6161
path: .venv
@@ -71,10 +71,10 @@ jobs:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- uses: actions/checkout@v2
74-
- name: Set up Python 3.8
75-
uses: actions/setup-python@v2
74+
- name: Set up Python 3.9
75+
uses: actions/setup-python@v4
7676
with:
77-
python-version: '3.8'
77+
python-version: '3.9'
7878
- uses: actions/cache@v2
7979
with:
8080
path: .venv
@@ -85,12 +85,27 @@ jobs:
8585
. scripts/ci_install_deps
8686
poetry run make check-types
8787
88+
check-dependencies:
89+
90+
name: Check dependencies for vulnerabilities
91+
runs-on: ubuntu-latest
92+
steps:
93+
- uses: actions/checkout@v2
94+
- name: Set up Go
95+
uses: actions/setup-go@v5
96+
- name: Install OSV scanner
97+
run: |
98+
go install github.com/google/osv-scanner/cmd/osv-scanner@latest
99+
- name: Run OSV scanner
100+
run: |
101+
osv-scanner --lockfile=./poetry.lock
102+
88103
test-doctest:
89104
name: Run Doctests
90105
runs-on: ubuntu-latest
91106
strategy:
92107
matrix:
93-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
108+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-beta.1"]
94109
steps:
95110
- uses: actions/checkout@v2
96111
- name: Set up Python ${{ matrix.python-version }}
@@ -118,7 +133,7 @@ jobs:
118133
pull-requests: write # allows coverage bot to comment
119134
strategy:
120135
matrix:
121-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
136+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-beta.1"]
122137
steps:
123138
- uses: actions/checkout@v2
124139
- name: Set up Python ${{ matrix.python-version }}
@@ -147,19 +162,19 @@ jobs:
147162
token: ${{ secrets.GITHUB_TOKEN }}
148163

149164
check-docker-image:
150-
name: Check types
165+
name: Check docker image
151166
runs-on: ubuntu-latest
152167
steps:
153168
- uses: actions/checkout@v2
154-
- name: Set up Python 3.8
169+
- name: Set up Python 3.9
155170
uses: actions/setup-python@v2
156171
with:
157-
python-version: '3.8'
172+
python-version: '3.9'
158173
- uses: actions/cache@v2
159174
with:
160175
path: .venv
161176
key: poetry-${{ hashFiles('poetry.lock') }}
162-
- name: Check types
177+
- name: Check wheel installation
163178
run: |
164179
sudo apt update
165180
pip wheel . -w wheels
@@ -179,7 +194,7 @@ jobs:
179194
runs-on: ubuntu-latest
180195
strategy:
181196
matrix:
182-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
197+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13.0-beta.1"]
183198
steps:
184199
- uses: actions/checkout@v2
185200
- name: Set up Python ${{ matrix.python-version }}

CONTRIBUTING.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,14 @@ poetry install
107107

108108
### Style Guidelines
109109

110-
We use [Black](https://black.readthedocs.io/en/stable/index.html) and `flake8` to automatically
111-
lint the code and enforce style requirements as part of the CI pipeline. You can run these style
112-
tests yourself locally by running `make check-style` (to check for violations of the `flake8` rules)
113-
and `make check-format` (to see if `black` would reformat the code) in the top-level directory of
114-
the repository. If you aren't presented with any errors, then that means your code is good enough
115-
for the linter (`flake8`) and formatter (`black`). If `make check-format` fails, it will present
116-
you with a diff, which you can resolve by running `make format`. Black is very opinionated, but
117-
saves a lot of time by removing the need for style nitpicks in PR review. We only deviate from its
118-
default behavior in one category: we choose to use a line length of 100 rather than the Black
119-
default of 88 (this is configured in the [`pyproject.toml`](pyproject.toml) file). As for `flake8`,
120-
we ignore a couple of its rules (all for good reasons), and the specific configuration can be
121-
found in the [`.flake8`](.flake8) file.
110+
We use [ruff](https://docs.astral.sh/ruff/) to enforce lint and formatting requirements as part of CI. You can run these
111+
tests yourself locally by running `make check-style` (to check for violations of the linting rules)
112+
and `make check-format` (to see if `ruff` would reformat the code) in the top-level directory of
113+
the repository. If you aren't presented with any errors, then that means your code satisfies all
114+
the linting and formatting requirements. If `make check-format` fails, it will present you with a
115+
diff, which you can resolve by running `make format`. The ruff formatter is opinionated, but
116+
saves a lot of time by removing the need for style nitpicks in PR review. The configuration for
117+
`ruff` can be found in `pyproject.toml`.
122118

123119
In addition to linting and formatting, we use type hints for all parameters and return values,
124120
following the [PEP 484 syntax][pep-484]. This is enforced as part of the CI via the command

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# use multi-stage builds to independently pull dependency versions
22
ARG quilc_version=1.20.0
33
ARG qvm_version=1.17.1
4-
ARG python_version=3.8
4+
ARG python_version=3.9
55

66
# use multi-stage builds to independently pull dependency versions
77
FROM rigetti/quilc:$quilc_version as quilc

Dockerfile.test

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# use multi-stage builds to independently pull dependency versions
22
ARG quilc_version=1.20.0
33
ARG qvm_version=1.17.1
4-
ARG python_version=3.8
4+
ARG python_version=3.9
55

66
# use multi-stage builds to independently pull dependency versions
77
FROM rigetti/quilc:$quilc_version as quilc

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ check-all: check-format check-types check-style
1111

1212
.PHONY: check-format
1313
check-format:
14-
black --check --diff pyquil
14+
ruff format --check --diff pyquil
1515

1616
.PHONY: check-types
1717
check-types:
1818
mypy pyquil
1919

2020
.PHONY: check-style
2121
check-style:
22-
flake8 pyquil
22+
ruff check pyquil
2323

2424
.PHONY: clean
2525
clean:
@@ -55,7 +55,7 @@ docker: Dockerfile
5555

5656
.PHONY: format
5757
format:
58-
black $(if $(format_file), $(format_file), pyquil)
58+
ruff format $(if $(format_file), $(format_file), pyquil)
5959

6060
.PHONY: info
6161
info:

docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS = -W # treat warnings as errors
5+
SPHINXOPTS =
66
SPHINXBUILD = sphinx-build
77
SOURCEDIR = source
88
BUILDDIR = build

docs/source/conf.py

+17-7
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
# -- Project information -----------------------------------------------------
77
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
88

9+
import os
10+
import subprocess
11+
912
import sphinx_rtd_theme
1013
from sphinx.ext.doctest import doctest
11-
from pyquil import __version__
1214

13-
import subprocess
14-
import os
15+
from pyquil import __version__
1516

1617
project = "pyQuil"
1718
copyright = "2021, Rigetti Computing"
@@ -37,7 +38,7 @@
3738
"sphinx.ext.viewcode",
3839
"sphinxcontrib.jquery",
3940
"nbsphinx",
40-
"recommonmark",
41+
"myst_parser",
4142
]
4243

4344
templates_path = ["_templates"]
@@ -119,7 +120,6 @@
119120

120121
dirname = os.path.dirname(__file__)
121122

122-
123123
def builder_inited_handler(app):
124124
import pandoc
125125

@@ -129,16 +129,26 @@ def builder_inited_handler(app):
129129
input = pandoc.read(source=None, file=infile, format="markdown")
130130
pandoc.write(input, file=outfile, format="rst")
131131

132-
subprocess.call(
132+
result = subprocess.run(
133133
[
134134
"sphinx-apidoc",
135135
"--module-first",
136136
"--force",
137+
"--append-syspath",
137138
"--separate",
138139
f"--output-dir={dirname}/apidocs",
139140
f"{dirname}/../../pyquil",
140-
]
141+
],
142+
stdout=subprocess.PIPE,
143+
stderr=subprocess.PIPE,
144+
text=True
141145
)
146+
if result.returncode == 0:
147+
print("sphinx-apidoc ran successfully.")
148+
else:
149+
print(f"sphinx-apidoc failed with return code {result.returncode}.")
150+
print("STDOUT:", result.stdout)
151+
print("STDERR:", result.stderr)
142152

143153

144154
def setup(app):

docs/source/getting_started.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ If you would like to stay up to date with the latest changes and bug fixes, you
4040

4141
.. note::
4242

43-
pyQuil requires Python 3.8 or later.
43+
pyQuil requires Python 3.9 or later.
4444

4545
.. testcode:: verify-min-version
4646
:hide:
@@ -58,7 +58,7 @@ If you would like to stay up to date with the latest changes and bug fixes, you
5858
.. testoutput:: verify-min-version
5959
:hide:
6060

61-
^3.8...
61+
^3.9...
6262

6363
.. note::
6464

mypy.ini

-5
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,3 @@ ignore_errors = True
3737
# Ignore errors in the conftest.py file
3838
[mypy-conftest]
3939
ignore_errors = True
40-
41-
# Ignore errors in the pyquil/parser.py file
42-
# TODO(notmgsk): Add types
43-
[mypy-pyquil.parser]
44-
ignore_errors = True

0 commit comments

Comments
 (0)