diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61434d629..f7f18c846 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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' @@ -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 @@ -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 @@ -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 @@ -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: @@ -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" diff --git a/README.md b/README.md index 0d2194395..bd37c4d42 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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 - diff --git a/core/opengate_core/testsDataSetup.py b/core/opengate_core/testsDataSetup.py index 2928e8693..daf925713 100644 --- a/core/opengate_core/testsDataSetup.py +++ b/core/opengate_core/testsDataSetup.py @@ -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: diff --git a/core/setup.py b/core/setup.py index 3d0b02892..dd65abcaa 100755 --- a/core/setup.py +++ b/core/setup.py @@ -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"], ) diff --git a/opengate/__init__.py b/opengate/__init__.py index 6b5afb89a..53e30a72c 100644 --- a/opengate/__init__.py +++ b/opengate/__init__.py @@ -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, @@ -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"))) diff --git a/opengate/exception.py b/opengate/exception.py index dc2cb8f24..cd9641d31 100644 --- a/opengate/exception.py +++ b/opengate/exception.py @@ -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): diff --git a/pyproject.toml b/pyproject.toml index e8555e0ce..701fd4394 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/setup.py b/setup.py index 2524d8217..bc0a8372f 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( install_requires=[ - "colored", + "colored>1.5", "opengate_core==" + version, "gatetools", "click",