Skip to content

Commit

Permalink
Merge pull request #285 from randomir/add-py311-support-take2
Browse files Browse the repository at this point in the history
Add py311 support  🎬 2️⃣
  • Loading branch information
randomir authored Dec 23, 2022
2 parents 507e36e + f5edb6e commit 6d4f584
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 44 deletions.
23 changes: 0 additions & 23 deletions .appveyor.yml

This file was deleted.

107 changes: 93 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
version: 2.1

parameters:
cache-generation:
type: integer
default: 1

orbs:
win: circleci/windows@2.2

environment:
PIP_PROGRESS_BAR: 'off'

jobs:
test-linux:
parameters:
Expand All @@ -9,13 +20,13 @@ jobs:
type: string

docker:
- image: circleci/python:<< parameters.python-version >>
- image: cimg/python:<< parameters.python-version >>

steps:
- checkout

- restore_cache: &restore-cache-env
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: v<< pipeline.parameters.cache-generation >>-pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}

- run: &create-virtualenv
name: Create virtual environment
Expand All @@ -32,7 +43,7 @@ jobs:
pip install wheel twine
- save_cache: &save-cache-env
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: v<< pipeline.parameters.cache-generation >>-pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env

Expand Down Expand Up @@ -62,6 +73,7 @@ jobs:
type: string
xcode:
type: string
default: "13.2.0"

macos:
xcode: << parameters.xcode >>
Expand All @@ -70,13 +82,23 @@ jobs:
- checkout

# install `python-version` and cache it
- when:
condition:
matches:
pattern: "^3\\.[123][123456789].*$"
value: << parameters.python-version >>
steps:
- run:
name: Update brew to get latest pyenv
command: brew update

- run: &brew-install-pyenv
name: Install pyenv
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install pyenv

- restore_cache: &restore-cache-pyenv
keys:
- v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-<< parameters.xcode >>
- v<< pipeline.parameters.cache-generation >>-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-<< parameters.xcode >>

- run: &pyenv-install-python
name: Install python
Expand All @@ -91,7 +113,7 @@ jobs:
pyenv global << parameters.python-version >>
- save_cache: &save-cache-pyenv
key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-<< parameters.xcode >>
key: v<< pipeline.parameters.cache-generation >>-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-<< parameters.xcode >>
paths:
- ~/.pyenv

Expand All @@ -110,15 +132,60 @@ jobs:

- run: *run-python-tests

test-windows:
parameters:
python-version:
type: string

executor:
name: win/default

steps:
- checkout

- restore_cache:
keys:
- v<< pipeline.parameters.cache-generation >>-nuget-python-<< parameters.python-version >>-{{ .Environment.CIRCLE_JOB }}

- run:
name: Install python and create virtualenv
command: |
nuget install python -Version << parameters.python-version >>
python.<< parameters.python-version >>\tools\python -m venv env
- save_cache:
key: v<< pipeline.parameters.cache-generation >>-nuget-python-<< parameters.python-version >>-{{ .Environment.CIRCLE_JOB }}
paths:
- python.<< parameters.python-version >>

- run:
name: Install requirements
command: |
env\Scripts\activate.ps1
pip install -U pip
pip install -r requirements.txt -r tests\requirements.txt
- run:
name: Install package
command: |
env\Scripts\activate.ps1
pip install .
- run:
name: Run tests
command: |
env\Scripts\activate.ps1
coverage run -m unittest discover
test-docs:
docker:
- image: circleci/python:3.7
- image: cimg/python:3.7

steps:
- checkout

- restore_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: v<< pipeline.parameters.cache-generation >>-pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}

- run: *create-virtualenv

Expand All @@ -129,7 +196,7 @@ jobs:
command: env/bin/pip install -r docs/requirements.txt

- save_cache:
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: v<< pipeline.parameters.cache-generation >>-pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ checksum "docs/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env

Expand Down Expand Up @@ -158,7 +225,7 @@ jobs:
pypi-deploy:
docker:
- image: circleci/python:3.9
- image: cimg/python:3.9

steps:
- checkout
Expand Down Expand Up @@ -188,18 +255,30 @@ workflows:
name: test-linux-<< matrix.python-version >> | << matrix.pip-constraints >>
matrix:
parameters:
python-version: &python-versions ["3.7.9", "3.8.6", "3.9.0", "3.10.0"]
python-version: &python-versions ["3.7.9", "3.8.6", "3.9.0", "3.10.0", "3.11.0"]
pip-constraints:
- "dimod==0.10.13"
- "dimod~=0.10.0 dwave-system~=1.0"
- "dimod==0.11.0 dwave-preprocessing==0.4.0 dwave-system~=1.0"
- "dimod~=0.10.0 dwave-preprocessing~=0.3.0 dwave-system~=1.0"
- "dimod~=0.11.0 dwave-preprocessing~=0.4.0 dwave-system~=1.0"
- "dimod~=0.12.0 dwave-preprocessing~=0.5.0 dwave-system~=1.0"
exclude:
# dimod < 0.12 not supported on py311+
- python-version: "3.11.0"
pip-constraints: "dimod==0.10.13"
- python-version: "3.11.0"
pip-constraints: "dimod~=0.10.0 dwave-preprocessing~=0.3.0 dwave-system~=1.0"
- python-version: "3.11.0"
pip-constraints: "dimod~=0.11.0 dwave-preprocessing~=0.4.0 dwave-system~=1.0"

- test-macos:
name: test-macos-<< matrix.python-version >>
matrix:
parameters:
python-version: *python-versions
xcode: ["13.2.0"]

- test-windows:
matrix:
parameters:
python-version: *python-versions

- test-docs

Expand Down
28 changes: 21 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
dimod==0.10.13
# the big split on 3.11 is required due to dwave-samplers switch, and hard
# dependency on narrow dimod version range (also dwave-preprocessing)
# see :pr:284

dimod==0.10.13; python_version<"3.11"
dimod==0.12.3; python_version>="3.11"
dwave-preprocessing==0.3.2; python_version<"3.11"
dwave-preprocessing==0.5.4; python_version>="3.11"
numpy>=1.19.1
minorminer==0.2.7
dwave-system==1.13.0
dwave-neal==0.5.9
dwave-tabu==0.4.3
dwave-greedy==0.2.3
dwave-preprocessing==0.3.2

dwave-neal==0.5.9; python_version<"3.11"
dwave-neal>=0.6.0; python_version>="3.11"
dwave-tabu==0.4.5; python_version<"3.11"
dwave-tabu>=0.5.0; python_version>="3.11"
dwave-greedy==0.2.5; python_version<"3.11"
dwave-greedy>=0.3.0; python_version>="3.11"

minorminer==0.2.7; python_version<"3.11"
minorminer==0.2.10; python_version>="3.11"
dwave-system==1.13.0; python_version<"3.11"
dwave-system==1.18.0; python_version>="3.11"

networkx
dwave-networkx==0.8.10
click
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
]

setup(
Expand Down

0 comments on commit 6d4f584

Please sign in to comment.