Skip to content

Commit

Permalink
Version 0.7.4 (#62)
Browse files Browse the repository at this point in the history
* some improvements

* some improvements

* try to compile for M1 and M2 apple using cibuildwheel

* try to compile for M1 and M2 apple using cibuildwheel

* still trying to build lightsim for M1 chip

* still trying to build lightsim for M1 chip

* still trying to build lightsim for M1 chip

* still trying to build lightsim for M1 chip

* still trying to build lightsim for M1 chip

* still trying to build lightsim for M1 chip

* trying to cross compile on macos for M1

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* trying to cross compile on macos for M1 / M2 chip

* re evaluating the full ci pipeline again

* bump to  actions/upload-artifact@v3 [skip ci]

* ready for version 0.7.4

* small modification to fix issue spotted in sim2real in grid2op
  • Loading branch information
BDonnot authored Aug 24, 2023
1 parent 39ba541 commit 311dfba
Show file tree
Hide file tree
Showing 8 changed files with 200 additions and 51 deletions.
189 changes: 152 additions & 37 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
manylinux_build:
# build wheels for some linux
name: Build linux ${{ matrix.python.name }} wheel
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
Expand Down Expand Up @@ -44,7 +45,7 @@ jobs:
steps:

- name: Checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: true

Expand All @@ -65,6 +66,10 @@ jobs:
python3 setup.py bdist_wheel
auditwheel repair dist/*.whl
- name: Build source archive
if: matrix.python.name == 'cp311'
run: python setup.py sdist

- name: Install wheel
run: pip3 install wheelhouse/*.whl --user

Expand All @@ -85,25 +90,24 @@ jobs:
python3 -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
- name: Upload wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: lightsim2grid-wheel-linux-${{ matrix.python.name }}
path: wheelhouse/*.whl

macos_windows_build:
name: Build ${{ matrix.config.name }} ${{ matrix.python.name }} wheel
runs-on: ${{ matrix.config.os }}
- name: Upload source archive
uses: actions/upload-artifact@v3
if: matrix.python.name == 'cp311'
with:
name: lightsim2grid-sources
path: dist/*.tar.gz

windows_build:
# build wheels for windows
name: Build windows ${{ matrix.python.name }} wheel
runs-on: windows-2019
strategy:
matrix:
config:
- {
name: darwin,
os: macos-latest,
}
- {
name: windows,
os: windows-2019,
}
python:
- {
name: cp37,
Expand All @@ -125,16 +129,19 @@ jobs:
name: cp311,
version: '3.11',
}
env:
RUNNER_OS: windows-2019
PYTHON_VERSION: ${{ matrix.python.version }}

steps:

- name: Checkout sources
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}

Expand All @@ -143,15 +150,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Compile SuiteSparse make
if: matrix.config.name == 'darwin'
run: |
make
export __O3_OPTIM=1
python3 setup.py build
- name: Compile SuiteSparse cmake
if: matrix.config.name == 'windows'
run: |
cd build_cmake
python generate_c_files.py
Expand All @@ -168,10 +167,6 @@ jobs:
- name: Build wheel
run: python setup.py bdist_wheel

- name: Build source archive
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp39'
run: python setup.py sdist

- name: Install wheel
shell: bash
run: python -m pip install dist/*.whl --user
Expand All @@ -189,31 +184,151 @@ jobs:
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
- name: Upload wheel
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: lightsim2grid-wheel-${{ matrix.config.name }}-${{ matrix.python.name }}
path: dist/*.whl

- name: Upload source archive
uses: actions/upload-artifact@v2
if: matrix.config.name == 'darwin' && matrix.python.name == 'cp39'
macos_build_37:
# build wheel for python 3.7 for macos
name: Build macos ${{ matrix.python.name }} wheel
runs-on: macos-latest
strategy:
matrix:
python:
- {
name: cp37,
version: '3.7',
}
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
name: lightsim2grid-sources
path: dist/*.tar.gz
submodules: true

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Compile SuiteSparse make
run: |
make
export __O3_OPTIM=1
python3 setup.py build
- name: Build wheel
run: python setup.py bdist_wheel

- name: Install wheel
shell: bash
run: python -m pip install dist/*.whl --user

- name: Check package can be imported
run: |
python -c "import lightsim2grid"
python -c "from lightsim2grid import *"
python -c "from lightsim2grid.newtonpf import newtonpf"
- name: Check LightSimBackend can be imported
run: |
python -m pip install grid2op
python -c "from lightsim2grid import LightSimBackend"
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: lightsim2grid-wheel-darwin-${{ matrix.python.name }}
path: dist/*.whl

macos_build_38_:
# build wheel for python 3.8 and above for macos
name: Build darwin ${{ matrix.python.name }} wheel
runs-on: macos-latest
strategy:
matrix:
python:
- {
name: cp38,
version: '3.8',
}
- {
name: cp39,
version: '3.9',
}
- {
name: cp310,
version: '3.10',
}
- {
name: cp311,
version: '3.11',
}
env:
RUNNER_OS: macos-latest
PYTHON_VERSION: ${{ matrix.python.version }}

steps:

- name: Checkout sources
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}

- name: Set Additional Envs
shell: bash
run: |
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
echo "DEPLOY=$( [[ $GITHUB_EVENT_NAME == 'push' && $GITHUB_REF == 'refs/tags'* ]] && echo 'True' || echo 'False' )" >> $GITHUB_ENV
- name: Compile with cibuildwheel
uses: pypa/cibuildwheel@v2.15.0
env:
CIBW_BUILD: "cp3${{env.PYTHON_SUBVERSION}}-*" # see https://github.com/cvxpy/cvxpy/blob/master/.github/workflows/build.yml
CIBW_ARCHS_LINUX: auto aarch64 # not used I believe
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ENVIRONMENT: __O3_OPTIM=1
CIBW_BEFORE_BUILD: make clean && make # and not CIBW_BEFORE_ALL !
CIBW_TEST_REQUIRES: grid2op pandapower
CIBW_TEST_SKIP: "*-macosx_arm64" # to silence warning "While arm64 wheels can be built on x86_64, they cannot be tested."
CIBW_TEST_COMMAND: >
python -c "import lightsim2grid" &&
python -c "from lightsim2grid import *" &&
python -c "from lightsim2grid.newtonpf import newtonpf" &&
python -c "from lightsim2grid.solver import KLUSolver" &&
python -c "from lightsim2grid import LightSimBackend" &&
python -c "from lightsim2grid import LightSimBackend; import grid2op; env = grid2op.make('l2rpn_case14_sandbox', test=True, backend=LightSimBackend())"
- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: wheels-darwin-${{ matrix.python.name }}
path: ./wheelhouse/*.whl

package:
name: Package wheels
runs-on: ubuntu-latest
needs: [manylinux_build, macos_windows_build]
needs: [manylinux_build, windows_build, macos_build_37, macos_build_38_]

steps:
- name: Download wheels
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
path: download

- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: lightsim2grid-wheels
path: |
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ Change Log
- easier building (get rid of the "make" part)
- code NR with dense matrices

[0.7.3] 2023-07-xx
[0.7.3] 2023-08-24
--------------------
- [FIXED] a bug where, when you disconnect a load (or gen), the next action cannot be performed
if it modifies the load (or gen), because you "cannot change the value of a disconnected load (or gen)"
- [FIXED] read-the-docs template is not compatible with latest sphinx version (7.0.0)
see https://github.com/readthedocs/sphinx_rtd_theme/issues/1463
- [IMPROVED] initialize the underlying "PandaPowerBackend" without numba
- [IMPROVED] grid2op import to be more compliant with renaming of
- [IMPROVED] grid2op import to be more compliant with renaming of uppercased file names
- [IMPROVED] decoupling of the PandapowerBackend class and the class "internally" used by LightSimBackend
when loading the grid. This caused some issue, *eg* https://github.com/rte-france/Grid2Op/issues/508

[0.7.2] 2023-06-06
--------------------
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ Pypi packages are available for linux, windows and macos with python versions:
- 3.8
- 3.9
- 3.10 (lightsim2grid >= 0.6.1)
- 3.11 (lightsim2grid >= 0.7.1)

**NB** on some version of MacOs (thanks Apple !), especially the one using M1 or M2 chip, lightsim2grid is only available
on pypi starting from version 0.7.3

## Installation (from source, for more advanced user)

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Benjamin DONNOT'

# The full version, including alpha/beta/rc tags
release = "0.7.3"
release = "0.7.4"
version = '0.7'

# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lightsim2grid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import faulthandler
faulthandler.enable()

__version__ = "0.7.3"
__version__ = "0.7.4"

__all__ = ["newtonpf", "SolverType", "ErrorType", "solver"]

Expand Down
11 changes: 11 additions & 0 deletions lightsim2grid/_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# this class is defined to avoid circular references when using grid2op -> pandapower -> lightsim2grid -> grid2op
# this module is lazily imported by the LightSimBackend and should not be used anywhere else,
# as the name states
try:
from grid2op.Backend import PandaPowerBackend
class _DoNotUseAnywherePandaPowerBackend(PandaPowerBackend):
"""used to duplicate the class attributes of PandaPowerBackend"""
pass
except ImportError as exc_:
# grid2op is not installed, we do not use it.
pass
Loading

0 comments on commit 311dfba

Please sign in to comment.