Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support matpower 8 #15

Merged
merged 22 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
Expand All @@ -27,15 +27,15 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
matpower-version: ["7.0", "7.1"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
matpower-version: ["7.0", "7.1", "8.0"]
platform: [octave]

runs-on: ubuntu-latest

steps:
- name: Clone this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -46,24 +46,30 @@ jobs:

- name: Install Octave (Linux)
if: matrix.platform == 'octave'
uses: MATPOWER/action-install-octave-linux@v1
run: |
sudo apt-add-repository -y ppa:ubuntuhandbook1/octave > /dev/null 2>&1
sudo apt -qq update > /dev/null 2>&1
sudo apt -y -qq install liboctave-dev octave > /dev/null 2>&1

- name: Download matpower ${{ matrix.python-version }}
- name: Download matpower ${{ matrix.matpower-version }}
run: |
curl -L https://github.com/MATPOWER/matpower/archive/refs/tags/${{ matrix.matpower-version }}.zip > matpower.zip
unzip matpower.zip -d temps
mv temps/matpower-${{ matrix.matpower-version }} matpower
cp matpowerpip/__init__.py matpower/__init__.py

- name: Install requirements
- name: Upgrade requirements
run: |
pip install -r requirements-dev.txt
pip install pru --upgrade
pru -r requirements-dev.txt

- name: Install requirements
run: pip install -r requirements-dev.txt

- name: Install package
run: |
pip install -e .
run: pip install -e ."[dev]"

- name: Test package
run: |
pip install --upgrade --no-cache-dir --force-reinstall jupyter_client ipykernel ipython tornado
pytest -n auto -rA -c pyproject.toml --cov-report term-missing --cov=matpower --nbmake
pytest -rA -c pyproject.toml --cov-report term-missing --cov=matpower --nbmake
29 changes: 18 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ jobs:
build:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
matpower-version: ["7.0", "7.1"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
matpower-version: ["7.0", "7.1", "8.0"]
platform: [octave]

runs-on: ubuntu-latest

steps:
- name: Clone this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
Expand All @@ -26,26 +26,33 @@ jobs:

- name: Install Octave (Linux)
if: matrix.platform == 'octave'
uses: MATPOWER/action-install-octave-linux@v1
run: |
sudo apt-add-repository -y ppa:ubuntuhandbook1/octave > /dev/null 2>&1
sudo apt -qq update > /dev/null 2>&1
sudo apt -y -qq install liboctave-dev octave > /dev/null 2>&1

- name: Download matpower ${{ matrix.python-version }}
- name: Download matpower ${{ matrix.matpower-version }}
run: |
curl -L https://github.com/MATPOWER/matpower/archive/refs/tags/${{ matrix.matpower-version }}.zip > matpower.zip
unzip matpower.zip -d temps
mv temps/matpower-${{ matrix.matpower-version }} matpower
cp matpowerpip/__init__.py matpower/__init__.py

- name: Install requirements
- name: Upgrade requirements
run: |
pip install -r requirements-dev.txt
pip install pru --upgrade
pru -r requirements-dev.txt

- name: Install requirements
run: pip install -r requirements-dev.txt

- name: Install package
run: |
pip install -e .
run: pip install -e ."[dev]"

- name: Test package
run: |
pytest -n auto -rA -c pyproject.toml --cov-report term-missing --cov=matpower --nbmake
pip install --upgrade --no-cache-dir --force-reinstall jupyter_client ipykernel ipython tornado
pytest -rA -c pyproject.toml --cov-report term-missing --cov=matpower --nbmake

deploy:
needs: build
Expand All @@ -57,7 +64,7 @@ jobs:

steps:
- name: Clone this repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v4
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Acknowledgement
# This template is based on: https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore

# Octave
octave-workspace

# Matpower
matpower7.0/
matpower-7.1/
matpower-8.0/
matpower/
matpower.zip
backups/

# Token
.pypirc

# Playground
# Private
playgrounds/
playground.ipynb
.private/

# Editor
.vscode/
Expand Down
40 changes: 21 additions & 19 deletions COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,28 @@ Place to save some commands related to matpower-pip development, deployment, and

## Download MATPOWER

### Python

Directly use `downloader.py`:

```powershell
cd matpowerpip
py downloader.py
```

With `matpowerpip`:

```python
from matpowerpip.downloader import download_matpower, copy_init

download_matpower(matpower_version='8.0')
copy_init()
```

### Windows (`cmd`)

<!-- TODO: MATPOWER 8.0 -->

MATPOWER 7.1

```plaintext
Expand All @@ -31,25 +51,7 @@ Note: Sometimes it is not working from inside `vscode` terminal, since `vscode`
<!--
TODO:
1. Powershell command for curl and tar
-->

### Python

Directly use `downloader.py`:

```powershell
cd matpowerpip
py downloader.py
```

With `matpowerpip`:

```python
from matpowerpip.downloader import download_matpower, copy_init

download_matpower(matpower_version='8.0b1')
copy_init()
```
-->

## Delete dist

Expand Down
40 changes: 37 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,34 @@ deactivate
## Install requirements

```shell
pip install -r requirements.txt
pip install pru --upgrade
pru -r requirements-latest.txt
```

## Download and copy matpower

```shell
python3
```

```python
from matpowerpip.downloader import download_matpower, copy_init

download_matpower(matpower_version='7.1')
copy_init()
```

## Install in development mode

```shell
pip install -e ."[dev]"
```

## pytest

```shell
pytest -n auto -rA -c pyproject.toml --cov-report term-missing --cov=matpower
pytest -rA -c pyproject.toml --cov-report term-missing --cov=matpower --nbmake
```

## Notebook example
Expand All @@ -59,8 +86,9 @@ pip install -r requirements.txt

```ipython
# install octave
!sudo apt-get -qq update
!sudo apt-get -qq install octave octave-signal liboctave-dev
!sudo apt-add-repository -y ppa:ubuntuhandbook1/octave > /dev/null 2>&1
!sudo apt -qq update > /dev/null 2>&1
!sudo apt -y -qq install liboctave-dev octave > /dev/null 2>&1

# install oct2py that compatible with colab
import os
Expand Down Expand Up @@ -100,3 +128,9 @@ Use pandoc and wkhtmltopdf to create README.pdf
```shell
pandoc --pdf-engine=wkhtmltopdf README.md -o README.pdf
```

## Install oct2py in dev locally

```shell
cd ../oct2py && pip install -e ".[test]" && cd -
```
Loading
Loading