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

Test with python 3.10 #215

Merged
merged 3 commits into from
Dec 8, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
51 changes: 35 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
parameters:
dimod-version:
type: string
networkx-version:
type: string
python-version:
type: string

Expand All @@ -18,7 +20,7 @@ jobs:
- checkout

- restore_cache: &restore-cache-env
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}

- run: &create-venv-install-deps
name: Create virtual environment and install dependencies
Expand All @@ -30,15 +32,16 @@ jobs:
pip install -r requirements.txt -r tests/requirements.txt

- run:
name: Install specified dimod version
name: Install dependencies
command: |
. env/bin/activate
pip install --upgrade 'dimod<< parameters.dimod-version >>'
pip install --upgrade 'networkx<< parameters.networkx-version >>'

- save_cache: &save-cache-env
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
key: pip-{{ checksum "requirements.txt" }}-{{ checksum "tests/requirements.txt" }}-{{ .Environment.CIRCLE_JOB }}
paths:
- env
- ~/.cache/pip

- run: &run-tests
name: Run unittests
Expand All @@ -58,7 +61,7 @@ jobs:
type: string

macos:
xcode: "12.2.0"
xcode: "13.2.0"

environment:
HOMEBREW_NO_AUTO_UPDATE: 1
Expand All @@ -72,27 +75,42 @@ jobs:
brew install pyenv

- restore_cache: &restore-cache-pyenv
key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.2.0
key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-13.2.0

- when:
# see https://github.com/pyenv/pyenv/issues/1643. We use an intermediate
# file so we can use the --skip-existing without raising errors from curl
condition:
equal: [3.6.8, << parameters.python-version >>]
steps:
- run:
name: Install Python 3.6 with a patch
command: |
curl -sSL https://github.com/python/cpython/commit/8ea6353.patch > tmp.txt
pyenv install -s --patch 3.6.8 < tmp.txt

- run:
name: Install python
command: |
pyenv install << parameters.python-version>> -s

- run:
name: Set system python
command: |
pyenv global << parameters.python-version >>
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile

- save_cache: &save-cache-pyenv
key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-12.2.0
key: v1-pyenv-{{ .Environment.CIRCLE_JOB }}-xcode-13.2.0
paths:
- ~/.pyenv

- restore_cache: *restore-cache-env

- run: *create-venv-install-deps
- run:
name: Create virtualenv and install dependencies
command: |
eval "$(pyenv init --path)"
pyenv local << parameters.python-version >>
python -m venv env
. env/bin/activate
python --version
pip install pip --upgrade
pip install -r requirements.txt -r tests/requirements.txt

- save_cache: *save-cache-env

Expand Down Expand Up @@ -207,8 +225,9 @@ workflows:
- test-linux:
matrix:
parameters:
python-version: &python-versions [3.6.8, 3.7.9, 3.8.9, 3.9.4]
dimod-version: [==0.8.0, <0.9, <0.10, <0.11]
python-version: &python-versions [3.6.8, 3.7.9, 3.8.9, 3.9.4, 3.10.0]
dimod-version: [==0.10.8, ~=0.10.0]
networkx-version: [==2.4, <3.0]
- test-osx:
matrix:
parameters:
Expand Down
7 changes: 2 additions & 5 deletions dwave_networkx/algorithms/markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
# limitations under the License.

import dimod
try:
from dwave.preprocessing import FixVariablesComposite
except ImportError:
# fall back on dimod (<0.10) if dwave.preprocessing not installed
from dimod import FixedVariableComposite as FixVariablesComposite

from dwave.preprocessing import FixVariablesComposite

from dwave_networkx.utils import binary_quadratic_model_sampler

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
networkx==2.4
dimod==0.8.0
dimod==0.10.8
dwave-preprocessing==0.3.2
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
'dwave_networkx.generators',
]

install_requires = ['networkx>=2.0,<3.0',
'dimod>=0.8.0,!=0.10.0,!=0.10.1,!=0.10.2,!=0.10.3,!=0.10.4',
install_requires = ['networkx>=2.4,<3.0',
'dimod>=0.10.8,<0.11.0',
'dwave-preprocessing>=0.3.2,<0.4.0'
]

python_requires = ">=3.6"
Expand All @@ -43,6 +44,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
]

setup(
Expand Down