Skip to content

Commit

Permalink
deps(pybind11): bump pybind11 version to 2.11.1 and add initial Pytho…
Browse files Browse the repository at this point in the history
…n 3.12 support (#78)
  • Loading branch information
XuehaiPan authored Sep 18, 2023
1 parent 4dbdcb6 commit f64a86c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
fail-fast: false
timeout-minutes: 30
steps:
Expand All @@ -103,6 +103,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
update-environment: true
allow-prereleases: true

- name: Upgrade pip
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Bump `pybind11` version to 2.11.1 and add initial Python 3.12 support by [@XuehaiPan](https://github.com/XuehaiPan) in [#78](https://github.com/metaopt/optree/pull/78).
- Bump `abseil-cpp` version to 20230802.0 by [@XuehaiPan](https://github.com/XuehaiPan) in [#79](https://github.com/metaopt/optree/pull/79).

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ cmake_minimum_required(VERSION 3.11) # for FetchContent
project(optree LANGUAGES CXX)

include(FetchContent)
set(PYBIND11_VERSION v2.10.4)
set(PYBIND11_VERSION v2.11.1)
set(ABSEIL_CPP_VERSION 20230802.0)
set(THIRD_PARTY_DIR "${CMAKE_SOURCE_DIR}/third-party")

Expand Down Expand Up @@ -125,7 +125,7 @@ endif()

system(
STRIP OUTPUT_VARIABLE PYTHON_VERSION
COMMAND "${PYTHON_EXECUTABLE}" -c "print(__import__('platform').python_version())"
COMMAND "${PYTHON_EXECUTABLE}" -c "print('.'.join(map(str, __import__('sys').version_info[:3])))"
)

message(STATUS "Use Python version: ${PYTHON_VERSION}")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS",
Expand Down
12 changes: 6 additions & 6 deletions tests/test_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,16 +907,16 @@ def test_tree_sum():


def test_tree_max():
with pytest.raises(ValueError, match=re.escape('max() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_max({})
assert optree.tree_max({}, default=0) == 0
assert optree.tree_max({'x': 0, 'y': (2, 1)}) == 2
assert optree.tree_max({'x': 0, 'y': (2, 1)}, key=lambda x: -x) == 0
with pytest.raises(ValueError, match=re.escape('max() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_max({'a': None})
assert optree.tree_max({'a': None}, default=0) == 0
assert optree.tree_max({'a': None}, none_is_leaf=True) is None
with pytest.raises(ValueError, match=re.escape('max() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_max(None)
assert optree.tree_max(None, default=0) == 0
assert optree.tree_max(None, none_is_leaf=True) is None
Expand All @@ -926,16 +926,16 @@ def test_tree_max():


def test_tree_min():
with pytest.raises(ValueError, match=re.escape('min() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_min({})
assert optree.tree_min({}, default=0) == 0
assert optree.tree_min({'x': 0, 'y': (2, 1)}) == 0
assert optree.tree_min({'x': 0, 'y': (2, 1)}, key=lambda x: -x) == 2
with pytest.raises(ValueError, match=re.escape('min() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_min({'a': None})
assert optree.tree_min({'a': None}, default=0) == 0
assert optree.tree_min({'a': None}, none_is_leaf=True) is None
with pytest.raises(ValueError, match=re.escape('min() arg is an empty sequence')):
with pytest.raises(ValueError, match='empty'):
optree.tree_min(None)
assert optree.tree_min(None, default=0) == 0
assert optree.tree_min(None, none_is_leaf=True) is None
Expand Down

0 comments on commit f64a86c

Please sign in to comment.