Skip to content

Commit

Permalink
Merge pull request #457 from OpenGATE/py3.12
Browse files Browse the repository at this point in the history
Remove support for python 3.8 and add support for python 3.12
  • Loading branch information
tbaudier authored Sep 19, 2024
2 parents b58137e + 0159719 commit f93ac2e
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 37 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.9, '3.10', '3.11', '3.12']

env:
GEANT4_VERSION: 'v11.2.1'
Expand Down Expand Up @@ -81,14 +81,14 @@ jobs:
- name: Create opengate_core Wheel Linux
if: matrix.os == 'ubuntu-latest'
run: |
if [ ${{ matrix.python-version }} == "3.8" ]; then
export PYTHONFOLDER="cp38-cp38"
elif [ ${{ matrix.python-version }} == "3.9" ]; then
if [ ${{ matrix.python-version }} == "3.9" ]; then
export PYTHONFOLDER="cp39-cp39"
elif [ ${{ matrix.python-version }} == "3.10" ]; then
export PYTHONFOLDER="cp310-cp310"
elif [ ${{ matrix.python-version }} == "3.11" ]; then
export PYTHONFOLDER="cp311-cp311"
elif [ ${{ matrix.python-version }} == "3.12" ]; then
export PYTHONFOLDER="cp312-cp312"
fi
mkdir -p $HOME/software
docker run --rm -e "PYTHONFOLDER=${PYTHONFOLDER}" -v $GITHUB_WORKSPACE:/home tbaudier/opengate_core:${{ env.GEANT4_VERSION }} /home/.github/workflows/createWheelLinux.sh
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
python --version
export PATH="/usr/local/miniconda/envs/opengate_core/bin/:$PATH"
pip install wheel wget colored
pip install cibuildwheel==2.12.0
pip install cibuildwheel==2.21.1
which pip
mkdir -p $HOME/software
if [ "${{ steps.cache_opengate_core_dependencies.outputs.cache-hit }}" != 'true' ]; then
Expand Down Expand Up @@ -236,14 +236,14 @@ jobs:
source $HOME/software/geant4/bin/geant4make.sh
export CMAKE_PREFIX_PATH=$HOME/software/geant4/bin:$HOME/software/itk/bin/:${CMAKE_PREFIX_PATH}
cd core
if [[ ${{ matrix.python-version }} == "3.8" ]]; then
export CIBW_BUILD="cp38-win_amd64"
elif [[ ${{ matrix.python-version }} == "3.9" ]]; then
if [[ ${{ matrix.python-version }} == "3.9" ]]; then
export CIBW_BUILD="cp39-win_amd64"
elif [[ ${{ matrix.python-version }} == "3.10" ]]; then
export CIBW_BUILD="cp310-win_amd64"
elif [[ ${{ matrix.python-version }} == "3.11" ]]; then
export CIBW_BUILD="cp311-win_amd64"
elif [[ ${{ matrix.python-version }} == "3.12" ]]; then
export CIBW_BUILD="cp312-win_amd64"
fi
find $HOME/software/geant4/bin/ -iname "*.dll"
ls $HOME/software/geant4/bin/BuildProducts/Release/bin
Expand Down Expand Up @@ -349,7 +349,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-12, windows-latest]
python-version: [3.8, 3.9, '3.10', '3.11']
python-version: [3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/download-artifact@v4
with:
Expand All @@ -364,16 +364,14 @@ jobs:
- name: Run tests
shell: bash {0}
run: |
if [[ ${{ matrix.python-version }} == "3.8" ]]; then
export PYTHONFOLDER="cp38-cp38"
elif [[ ${{ matrix.python-version }} == "3.9" ]]; then
if [[ ${{ matrix.python-version }} == "3.9" ]]; then
export PYTHONFOLDER="cp39-cp39"
elif [[ ${{ matrix.python-version }} == "3.10" ]]; then
export PYTHONFOLDER="cp310-cp310"
pip install --pre itk
elif [[ ${{ matrix.python-version }} == "3.11" ]]; then
export PYTHONFOLDER="cp311-cp311"
pip install --pre itk
elif [[ ${{ matrix.python-version }} == "3.12" ]]; then
export PYTHONFOLDER="cp312-cp312"
fi
if [[ ${{ matrix.os }} == "ubuntu-latest" ]]; then
export OSNAME="manylinux"
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See the [User Guide](https://opengate-python.readthedocs.io/en/latest/user_guide

### How to install (short version)

*Compatible with Python 3.8, 3.9, 3.10, 3.11. Not available for Python 3.12 yet. On Windows multithreading, Qt visualization and the "spawn new subprocess" are not (yet) available.*
*Compatible with Python 3.9, 3.10, 3.11, 3.12. On Windows multithreading, Qt visualization and the "spawn new subprocess" are not (yet) available.*

First, create an environment (not mandatory but highly advised)

Expand Down Expand Up @@ -70,4 +70,3 @@ See the documentation: https://opengate-python.readthedocs.io/en/latest/develope
- https://github.com/pybind/pybind11
- https://github.com/fmtlib/fmt
- https://github.com/p-ranav/indicators

6 changes: 1 addition & 5 deletions core/opengate_core/testsDataSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
from pathlib import Path
from .g4DataSetup import *

try:
color_error = colored.fg("red") + colored.attr("bold")
except AttributeError:
# new syntax in colored>=1.5
color_error = colored.fore("red") + colored.style("bold")
color_error = colored.fore("red") + colored.style("bold")


# Check and download opengate tests data if not present:
Expand Down
4 changes: 2 additions & 2 deletions core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ def build_extension(self, ext):
packages=find_packages(),
package_data=package_data,
zip_safe=False,
python_requires=">=3.8",
python_requires=">=3.9",
include_package_data=True,
classifiers=(
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
),
install_requires=["wget", "colored", "requests"],
install_requires=["wget", "colored>1.5", "requests"],
)
4 changes: 2 additions & 2 deletions opengate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
print(
colored.stylize(
f"Importing opengate (thread " f"{threading.get_native_id()}) ... ",
colored.fg("dark_gray"),
colored.fore("dark_gray"),
),
end="",
flush=True,
Expand Down Expand Up @@ -54,4 +54,4 @@
from opengate.utility import g4_units


print(colored.stylize("done", colored.fg("dark_gray")))
print(colored.stylize("done", colored.fore("dark_gray")))
12 changes: 3 additions & 9 deletions opengate/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ class GateImplementationError(Exception):
"""


try:
color_error = colored.fg("red") + colored.attr("bold")
color_warning = colored.fg("orange_1")
color_ok = colored.fg("green")
except AttributeError:
# new syntax in colored>=1.5
color_error = colored.fore("red") + colored.style("bold")
color_warning = colored.fore("orange_1")
color_ok = colored.fore("green")
color_error = colored.fore("red") + colored.style("bold")
color_warning = colored.fore("orange_1")
color_ok = colored.fore("green")


def fatal(s):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ description = "Simulation for Medical Physics"
license = { file = "LICENSE.md" }
classifiers = [
"Programming Language :: Python",
"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",
"Programming Language :: Python :: Implementation :: PyPy",
"Operating System :: OS Independent",
]
requires-python = ">=3.8"
requires-python = ">=3.9"

[project.scripts]
opengate_tests = "opengate.bin.opengate_tests:go"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setup(
install_requires=[
"colored",
"colored>1.5",
"opengate_core==" + version,
"gatetools",
"click",
Expand Down

0 comments on commit f93ac2e

Please sign in to comment.