Skip to content
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

Add Python 3.12 and drop 3.8 #40

Merged
merged 11 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
steps:
- uses: actions/checkout@v2
Expand All @@ -36,10 +36,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: '3.10'
- name: Pip cache
uses: actions/cache@v2
with:
Expand All @@ -60,10 +60,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: '3.10'
- name: Pip cache
uses: actions/cache@v2
with:
Expand Down
85 changes: 2 additions & 83 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=no-self-use, # disabled as it is too verbose
fixme, # disabled as TODOs would show up as warnings
disable=fixme, # disabled as TODOs would show up as warnings
protected-access, # disabled as we don't follow the public vs private
# convention strictly
duplicate-code, # disabled as it is too verbose
Expand All @@ -70,8 +69,7 @@ disable=no-self-use, # disabled as it is too verbose
unnecessary-pass, # allow for methods with just "pass", for clarity
no-else-return, # relax "elif" after a clause with a return
docstring-first-line-empty, # relax docstring style
import-outside-toplevel,
bad-continuation, bad-whitespace # differences of opinion with black
import-outside-toplevel



Expand All @@ -82,12 +80,6 @@ disable=no-self-use, # disabled as it is too verbose
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]". This option is deprecated
# and it will be removed in Pylint 2.0.
files-output=no

# Tells whether to display a full report or only the messages
reports=yes

Expand Down Expand Up @@ -133,66 +125,6 @@ include-naming-hint=no
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]+$

# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]+$

# Regular expression matching correct function names
function-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for function names
function-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct method names
method-rgx=(([a-z_][a-z0-9_]{2,49})|(assert[A-Z][a-zA-Z0-9]{2,43})|(test_[_a-zA-Z0-9]{2,}))$

# Naming hint for method names
method-name-hint=[a-z_][a-z0-9_]{2,30}$ or camelCase `assert*` in tests.

# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for attribute names
attr-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct argument names
argument-rgx=[a-z_][a-z0-9_]{2,30}|ax|dt$

# Naming hint for argument names
argument-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct variable names
variable-rgx=[a-z_][a-z0-9_]{2,30}$

# Naming hint for variable names
variable-name-hint=[a-z_][a-z0-9_]{2,30}$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
Expand Down Expand Up @@ -220,12 +152,6 @@ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# else.
single-line-if-stmt=no

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

Expand Down Expand Up @@ -416,10 +342,3 @@ known-third-party=enchant
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no


[EXCEPTIONS]

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ build-backend = "setuptools.build_meta"

[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
target-version = ['py39', 'py310', 'py311', 'py312']
4 changes: 4 additions & 0 deletions releasenotes/notes/drop-3.8-add-3.12-2f80020044cc4c6f.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
upgrade:
- |
Support for Python 3.12 has been added, and 3.8 has been dropped.
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
black~=22.0
astroid==2.14.2
pylint==2.16.2
black~=24.1
stestr>=3.0.0
astroid==2.9.3
pylint==2.12.2
qiskit-sphinx-theme~=1.16.0rc1
sphinx-autodoc-typehints
jupyter-sphinx
Expand All @@ -20,5 +20,5 @@ jax; sys_platform == 'darwin' or sys_platform == 'linux'
jaxlib; sys_platform == 'darwin' or sys_platform == 'linux'

# Tensorflow does not yet have a 3.11 version
tensorflow; (sys_platform != 'darwin' or platform_machine != 'arm64') and python_version<'3.11'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is true anymore. https://pypi.org/project/tensorflow/#files has 3.9-3.11

But fine to deal with in a dedicated PR to avoid a can of worms.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to update this here - since this PR is about updating python versions I think it's fine to handle it here.

tensorflow-cpu; (sys_platform != 'darwin' or platform_machine != 'arm64') and python_version<'3.11'
tensorflow-macos; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version<'3.11'
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
],
keywords="array dispatcher qiskit numpy jax tensorflow",
packages=find_packages(exclude=['test*']),
install_requires=REQUIREMENTS,
include_package_data=True,
python_requires=">=3.7",
python_requires=">=3.9",
project_urls={
"Bug Tracker": "https://github.com/Qiskit/arraylias/issues",
"Documentation": "https://qiskit.org/documentation/",
Expand Down
2 changes: 1 addition & 1 deletion test/alias/test_register_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_infer_lib_allow_sequence_nested(self):
self.assertEqual(alias.infer_libs(tuple(nested)), ("int_lib",))
self.assertEqual(alias.infer_libs(tuple(nested), allow_sequence=False), tuple())

def test_register_type__AUTOLIB(self):
def test_register_type_autolib(self):
"""Test automatic inference of lib from base module name"""
alias = Alias()
alias.register_type(complex)
Expand Down
4 changes: 2 additions & 2 deletions test/default_alias/test_default_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def test_eigh(self):
"""
w_usp, v_usp = usp.linalg.eigh(self.arr_2d)
w, v = scipy.linalg.eigh(self.arr_2d)
self.assertTrue(usp.allclose(w, w_usp))
self.assertTrue(usp.allclose(v, v_usp))
self.assertTrue(unp.allclose(w, w_usp))
self.assertTrue(unp.allclose(v, v_usp))
Comment on lines +166 to +167
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code previously used usp instead of unp, but scipy.allclose does not exist (which would be necessary for usp to work). It's possible this was removed in a newer version of scipy since the last time the tests were run; otherwise I'm confused that the code here used to work.

This is also what caused your docs PR to fail.



class TestJaxScipyAlias(JaxBase, TestScipyAlias):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 3.3.0
envlist = py38,py39,py310,py311,lint
envlist = py39,py310,py311,py312,lint
isolated_build = true

[testenv]
Expand Down
Loading