Skip to content

Commit

Permalink
Produce a wheel for python 3.12
Browse files Browse the repository at this point in the history
- test now on 3.9 and 3.12
- beware to some dependencies conflicts that make
   - install pygame 2.1.3 not compatible with python 3.12 (=> we enforce
     pygame >=2.5 in tests
   - install cffi 1.15.0 instead of more recent versions that are
     adapted for poython 3.12 (=> we enforce cffi>=1.17 in tests)
- up-tamer depends on pytamer not available for macos x86_64 + python >
  3.11 (was already not available on macos amd64)
- random.randint() must use real integers

We also update minizinc binary used in tests to 2.8.5.
  • Loading branch information
nhuet authored and fteicht committed Sep 23, 2024
1 parent 958eab1 commit 1743340
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ jobs:
run: |
from os import environ
python_version_build = ["3.9", "3.10", "3.11"]
python_version_test = ["3.9", "3.11"]
python_version_build = ["3.9", "3.10", "3.11", "3.12"]
python_version_test = ["3.9", "3.12"]
test = ["macos-12", "macos-latest", "ubuntu-latest", "windows-latest"]
build_doc = "true"
Expand All @@ -87,6 +87,7 @@ jobs:
to_bool = lambda s: True if s == "true" else False
python_filter = {
'3.11': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.11]') }}"),
'3.12': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.12]') }}"),
'3.9': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.9]') }}"),
'3.10': to_bool("${{ contains(github.event.head_commit.message, '[ci: python-3.10]') }}"),
}
Expand Down Expand Up @@ -509,7 +510,7 @@ jobs:
env:
minizinc_config_cmdline: export PATH=$PATH:~/AppData/Local/Programs/MiniZinc
minizinc_cache_path: ~/AppData/Local/Programs/MiniZinc
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled-setup-win64.exe
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled-setup-win64.exe
minizinc_downloaded_filepath: minizinc_setup.exe
minizinc_install_cmdline: cmd //c "minizinc_setup.exe /verysilent /currentuser /norestart /suppressmsgboxes /sp"

Expand Down Expand Up @@ -562,7 +563,11 @@ jobs:
pip install ray[rllib]>=2.20
python_version=${{ matrix.python-version }}
wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*win*.whl)
pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna
if [ "$python_version" = "3.12" ]; then
pip install ${wheelfile}[all] pytest "pygame>=2.5" optuna "cffi>=1.17"
else
pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna
fi
- name: Test with pytest
run: |
Expand Down Expand Up @@ -594,7 +599,7 @@ jobs:
env:
minizinc_config_cmdline: export PATH=$PATH:$(pwd)/bin/MiniZincIDE.app/Contents/Resources
minizinc_cache_path: $(pwd)/bin/MiniZincIDE.app
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-bundled.dmg
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-bundled.dmg
minizinc_downloaded_filepath: bin/minizinc.dmg
minizinc_install_cmdline: sudo hdiutil attach bin/minizinc.dmg; sudo cp -R /Volumes/MiniZinc*/MiniZincIDE.app bin/.

Expand Down Expand Up @@ -656,7 +661,11 @@ jobs:
python_version=${{ matrix.python-version }}
arch=$(uname -m)
wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*macos*${arch}.whl)
pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna
if [ "$python_version" = "3.12" ]; then
pip install ${wheelfile}[all] pytest "pygame>=2.5" optuna "cffi>=1.17"
else
pip install ${wheelfile}[all] pytest gymnasium[classic-control] optuna
fi
- name: Test with pytest
run: |
Expand Down Expand Up @@ -688,10 +697,10 @@ jobs:
env:
minizinc_config_cmdline: export PATH=$PATH:$(pwd)/bin/squashfs-root/usr/bin; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/bin/squashfs-root/usr/lib
minizinc_cache_path: $(pwd)/bin/squashfs-root
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.6.3/MiniZincIDE-2.6.3-x86_64.AppImage
minizinc_url: https://github.com/MiniZinc/MiniZincIDE/releases/download/2.8.5/MiniZincIDE-2.8.5-x86_64.AppImage
minizinc_downloaded_filepath: bin/minizinc.AppImage
minizinc_install_cmdline: cd bin; sudo chmod +x minizinc.AppImage; sudo ./minizinc.AppImage --appimage-extract; cd ..

minizinc_prerequisites_cmdline: sudo apt update && sudo apt install libegl1 -y

steps:
- uses: actions/checkout@v4
Expand All @@ -716,6 +725,10 @@ jobs:
- name: Create bin/
run: mkdir -p bin

- name: Minizinc prerequisites
run: |
${{ env.minizinc_prerequisites_cmdline }}
- name: get MininZinc path to cache
id: get-mzn-cache-path
run: |
Expand Down Expand Up @@ -747,7 +760,11 @@ jobs:
run: |
python_version=${{ matrix.python-version }}
wheelfile=$(ls ./wheels/scikit_decide*-cp${python_version/\./}-*manylinux*.whl)
pip install ${wheelfile}[all] pytest gymnasium[classic-control] docopt commonmark optuna
if [ "$python_version" = "3.12" ]; then
pip install ${wheelfile}[all] pytest "pygame>=2.5" "cffi>=1.17" docopt commonmark optuna
else
pip install ${wheelfile}[all] pytest gymnasium[classic-control] docopt commonmark optuna
fi
- name: Test with pytest
run: |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ discrete-optimization = { version = ">=0.3.2", optional = true }
openap = { version = ">=1.5", python = ">=3.9", optional = true }
pygeodesy = { version = ">=23.6.12", optional = true }
unified-planning = { version = ">=1.1.0", python = ">=3.10", optional = true }
up-tamer = { version = ">=1.1.2", python = ">=3.10", markers = "platform_machine == 'x86_64'", optional = true }
up-tamer = { version = ">=1.1.2", python = ">=3.10, <3.12", markers = "platform_machine == 'x86_64'", optional = true }
up-fast-downward = { version = ">=0.4.1", python = ">=3.10", optional = true }
up-enhsp = { version = ">=0.0.25", python = ">=3.10", optional = true }
up-pyperplan = { version = ">=1.1.0", python = ">=3.10", optional = true }
Expand Down
16 changes: 9 additions & 7 deletions skdecide/hub/solver/cgp/pycgp/cgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,16 @@ def mutate_per_gene(self, mutation_rate_nodes, mutation_rate_outputs):
# mutate connection
self.genome[index] = rnd.randint(
0,
min(
self.max_graph_length + self.num_inputs - 1,
(
self.num_inputs
+ (int(index / (self.max_arity + 1)) - 1)
* self.num_rows
int(
min(
self.max_graph_length + self.num_inputs - 1,
(
self.num_inputs
+ (int(index / (self.max_arity + 1)) - 1)
* self.num_rows
)
* self.recurrency_distance,
)
* self.recurrency_distance,
),
)
# self.genome[index] = rnd.randint(0, self.num_inputs + (int(index / (self.max_arity + 1)) - 1) * self.num_rows)
Expand Down

0 comments on commit 1743340

Please sign in to comment.