To install Python 3.12 environment, use:
python3.12 -m venv env
To activate Python environment, use:
Linux and macOS:
source env/bin/activate
Windows - PowerShell
env\Scripts\Activate.ps1
Windows - Command Prompt
env\Scripts\activate
To deactivate the Python environment, use:
deactivate
pip install pru --upgrade
pru -r requirements-latest.txt
python3
from matpowerpip.downloader import download_matpower, copy_init
download_matpower(matpower_version='7.1')
copy_init()
pip install -e ."[dev]"
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
pre-commit install
pre-commit run --all-files
-
Use
nb-clean
to clean the notebook.pip install nb-clean nb-clean add-filter
for single run:
nb-clean clean PATH
-
Make sure to make the example compatible with
google-colab==1.0.0
. You can use below commands (optional).# install octave !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 from pkg_resources import get_distribution os.system( f"pip install -qq" f" ipykernel=={get_distribution('ipykernel').version}" f" ipython=={get_distribution('ipython').version}" f" tornado=={get_distribution('tornado').version}" f" oct2py" ) # install packages !pip install -qq matpower matpowercaseframes
NOTE
If using
octave
, make sure to delete the output of the installation cell. -
Print
matpower
version. If used, also print the version ofoct2py
.import oct2py import matpower print(f"oct2py version: {oct2py.__version__}") print(f"matpower version: {matpower.__version__}")
Use pandoc and wkhtmltopdf to create README.pdf
pandoc --pdf-engine=wkhtmltopdf README.md -o README.pdf
cd ../oct2py && pip install -e ".[test]" && cd -