Skip to content

Commit

Permalink
Add Python 3.12 and drop 3.8 (#40)
Browse files Browse the repository at this point in the history
Co-authored-by: to24toro <[email protected]>
  • Loading branch information
DanPuzzuoli and to24toro authored Feb 20, 2024
1 parent adbf72f commit 16446bc
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'
- name: Install Deps
run: pip install -U wheel
- name: Build Artifacts
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.
12 changes: 6 additions & 6 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 @@ -19,6 +19,6 @@ matplotlib>=3.3.0
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'
tensorflow-macos; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version<'3.11'
# Tensorflow does not yet have a 3.12 version
tensorflow-cpu; (sys_platform != 'darwin' or platform_machine != 'arm64') and python_version<'3.12'
tensorflow-macos; sys_platform == 'darwin' and platform_machine == 'arm64' and python_version<'3.12'
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))


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

0 comments on commit 16446bc

Please sign in to comment.