Open Sustainable Technology

A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Browse accepted projects | Review proposed projects | Propose new project | Open Issues

PyPowSyBl

A Python library for modelling and simulating power grids by providing bindings to the powsybl Java framework.
https://github.com/powsybl/pypowsybl

cgmes load-flow loadflow power-flow power-system power-system-analysis power-system-simulation powerflow python

Last synced: about 10 hours ago
JSON representation

Repository metadata

A PowSyBl and Python integration based on GraalVM native image

README

        

# PyPowSyBl

[![Actions Status](https://github.com/powsybl/pypowsybl/workflows/CI/badge.svg)](https://github.com/powsybl/pypowsybl/actions)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=powsybl_pypowsybl&metric=alert_status)](https://sonarcloud.io/dashboard?id=powsybl_pypowsybl)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=powsybl_pypowsybl&metric=coverage)](https://sonarcloud.io/dashboard?id=powsybl_pypowsybl)
[![PyPI Latest Release](https://img.shields.io/pypi/v/pypowsybl.svg)](https://pypi.org/project/pypowsybl/)
[![Documentation Status](https://readthedocs.org/projects/pypowsybl/badge/?version=latest)](https://pypowsybl.readthedocs.io/en/latest/?badge=latest)
[![MPL-2.0 License](https://img.shields.io/badge/license-MPL_2.0-blue.svg)](https://www.mozilla.org/en-US/MPL/2.0/)
[![Slack](https://img.shields.io/badge/slack-powsybl-blueviolet.svg?logo=slack)](https://join.slack.com/t/powsybl/shared_invite/zt-rzvbuzjk-nxi0boim1RKPS5PjieI0rA)

The PyPowSyBl project gives access PowSyBl Java framework to Python developers. This Python integration relies on
GraalVM to compile Java code to a native library.

## Documentation

Latest version of the documentation with API reference and many code samples is [here](https://pypowsybl.readthedocs.io/).

## Notebooks

Notebooks demonstrating PyPowSyBl features can be found in this [repository](https://github.com/powsybl/pypowsybl-notebooks).

## Installation

PyPowSyBl is released on [PyPi](https://pypi.org/project/pypowsybl/) for Python 3.8 to 3.12, on Linux, Windows and MacOS.

First, make sure you have an up-to-date version of pip and setuptools:
```bash
pip install --upgrade setuptools pip
```

Then you can install PyPowSyBl using pip:
```bash
pip install pypowsybl
```

## Getting started

First, we have to import pypowsybl:
```python
import pypowsybl as pp
```

We can create an IEEE 14 buses network and run a load flow computation:
```python
n = pp.network.create_ieee14()
results = pp.loadflow.run_ac(n)
print(results)
```

```bash
[ComponentResult(connected_component_num=0, synchronous_component_num=0, status=CONVERGED, status_text=CONVERGED, iteration_count=3, reference_bus_id='VL1_0', slack_bus_results=[SlackBusResult(id='VL1_0', active_power_mismatch=-0.006730108618313579)], distributed_active_power=0.0)]
```

We can now get buses data (like any other network elements) as a [Pandas](https://pandas.pydata.org/) dataframe:
```python
buses = n.get_buses()
print(buses)
```

```bash
v_mag v_angle
VL1_0 1.060 0.00
VL2_0 1.045 -4.98
VL3_0 1.010 -12.72
VL4_0 1.019 -10.33
VL5_0 1.020 -8.78
VL6_0 1.070 -14.22
VL7_0 1.062 -13.37
VL8_0 1.090 -13.36
VL9_0 1.056 -14.94
VL10_0 1.051 -15.10
VL11_0 1.057 -14.79
VL12_0 1.055 -15.07
VL13_0 1.050 -15.16
VL14_0 1.036 -16.04
```

This is just a quick appetizer of PyPowSyBl features. PyPowsybl provides a lot more features:
security analysis, sensitivity analysis, handling of multiple file formats (including CGMES),
substation and network diagrams generation, ...
For more details and examples, go to the documentation and Jupyter notebooks.

## Build from sources

That section is intended for developers who wish to build pypowsybl from the sources in this repository.

Requirements:

- Maven >= 3.1
- Cmake >= 3.14
- C++11 compiler
- Python >= 3.8 for Linux, Windows and MacOS (amd64 and arm64)
- [Oracle GraalVM Java 17](https://www.graalvm.org/downloads/)

To build from sources and install PyPowSyBl package:

```bash
git clone --recursive https://github.com/powsybl/pypowsybl.git
export JAVA_HOME=
pip install --upgrade setuptools pip
pip install -r requirements.txt
pip install .
```

While developing, you may find it convenient to use the developer (or editable)
mode of installation:

```bash
pip install -e .
# or, to build the C extension with debug symbols:
python setup.py build --debug develop --user
```

Please refer to pip and setuptools documentations for more information.

To run unit tests:

```bash
pytest tests
```

To run static type checking with `mypy`:
```bash
mypy -p pypowsybl
```

To run linting inspection with `pylint`:
```bash
pylint pypowsybl
```

## Contribute to documentation

To run the tests included in the documentation:

```bash
cd docs/
make doctest
```

And then, to build the documentation:

```bash
make html
```

Web pages are generated in repository _build/html/ for preview before opening a pull request.
You can for example open it with firefox browser:

```bash
firefox _build/html/index.html
```


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 1 day ago

Total Commits: 528
Total Committers: 22
Avg Commits per committer: 24.0
Development Distribution Score (DDS): 0.686

Commits in past year: 109
Committers in past year: 12
Avg Commits per committer in past year: 9.083
Development Distribution Score (DDS) in past year: 0.523

Name Email Commits
Geoffroy Jamgotchian g****n@r****m 166
EtienneLt 3****t 150
Sylvain Leclerc s****c@r****m 100
Coline Piloquet 5****t 22
yichen88 3****8 21
Christian Biasuzzi c****i@s****t 16
Bertrand Rix b****x@g****m 14
Florian Dupuy f****y@r****m 9
Sophie Frasnedo 9****s 6
jeandemanged d****e@a****m 4
OpenSuze 4****e 4
HugoKulesza 9****a 3
DONNOT Benjamin b****t@r****m 3
Nicolas Pierre 1****r 2
Anne Tilloy 4****l 1
HARPER Jon j****7@g****m 1
MartinBelthle 1****e 1
Massimo Ferraro m****o@t****u 1
Mathieu BAGUE m****e@g****m 1
Thomas ADAM 5****0 1
pjeanmarie 7****e 1
Coline PILOQUET c****t@r****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: about 10 hours ago

Total issues: 48
Total pull requests: 178
Average time to close issues: 5 months
Average time to close pull requests: about 1 month
Total issue authors: 16
Total pull request authors: 20
Average comments per issue: 2.38
Average comments per pull request: 0.6
Merged pull request: 142
Bot issues: 0
Bot pull requests: 0

Past year issues: 22
Past year pull requests: 115
Past year average time to close issues: 23 days
Past year average time to close pull requests: 11 days
Past year issue authors: 11
Past year pull request authors: 13
Past year average comments per issue: 1.73
Past year average comments per pull request: 0.55
Past year merged pull request: 98
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/powsybl/pypowsybl

Top Issue Authors

  • sylvlecl (17)
  • BDonnot (8)
  • AnkurArohi (5)
  • EtienneLt (4)
  • annetill (3)
  • bdonon (1)
  • colinepiloquet (1)
  • FredericSabot (1)
  • geofjamg (1)
  • Lisrte (1)
  • LZhangCognite (1)
  • nicolaslhuillier (1)
  • obrix (1)
  • So-Fras (1)
  • tschuppr (1)

Top Pull Request Authors

  • EtienneLt (78)
  • geofjamg (30)
  • colinepiloquet (19)
  • obrix (7)
  • So-Fras (6)
  • OpenSuze (6)
  • jeandemanged (5)
  • flo-dup (5)
  • sylvlecl (4)
  • CBiasuzzi (3)
  • HugoKulesza (3)
  • pjeanmarie (2)
  • Lisrte (2)
  • nicolas-pierr (2)
  • jlbouchot (1)

Top Issue Labels

  • bug (11)
  • enhancement (6)
  • status: needs-design (2)
  • status: in-progress (2)
  • help wanted (1)

Top Pull Request Labels

  • status: ready to be merged (63)
  • status: ready-for-review (22)
  • breaking change (7)
  • documentation (7)
  • PR: next-release (7)
  • bug (6)
  • status: in-progress (5)
  • do not merge (2)
  • enhancement (1)
  • status: does not compile (1)
  • status: conflict with main (1)
  • status: needs-design (1)

Package metadata

pypi.org: pypowsybl

A PowSyBl Python API

  • Homepage: https://github.com/powsybl/pypowsybl
  • Documentation: https://pypowsybl.readthedocs.io/
  • Licenses: Mozilla Public License 2.0 (MPL 2.0)
  • Latest release: 1.3.0 (published 13 days ago)
  • Last Synced: 2024-02-28T18:33:47.877Z (about 10 hours ago)
  • Versions: 26
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 3,238 Last month
  • Rankings:
    • Downloads: 6.618%
    • Dependent packages count: 7.303%
    • Stargazers count: 10.458%
    • Average: 11.81%
    • Forks count: 12.604%
    • Dependent repos count: 22.068%
  • Maintainers (2)
repo1.maven.org: com.powsybl:pypowsybl

A C interface to powsybl, for pypowsybl implementation

  • Homepage: https://www.powsybl.org
  • Documentation: https://appdoc.app/artifact/com.powsybl/pypowsybl/
  • Licenses: Mozilla Public License, Version 2.0
  • Latest release: 1.3.0 (published 13 days ago)
  • Last Synced: 2024-02-28T18:33:47.782Z (about 10 hours ago)
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 23.871%
    • Forks count: 29.031%
    • Dependent repos count: 31.98%
    • Average: 33.435%
    • Dependent packages count: 48.86%
pypi.org: pypowsybl_grid2opbackend

  • Homepage:
  • Documentation: https://pypowsybl_grid2opbackend.readthedocs.io/
  • Licenses: mpl-2.0
  • Latest release: 1.0.0 (published 2 months ago)
  • Last Synced: 2024-02-28T18:33:47.776Z (about 10 hours ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 29 Last month
  • Rankings:
    • Dependent packages count: 9.887%
    • Average: 38.848%
    • Dependent repos count: 67.809%
  • Maintainers (2)

Dependencies

java/pom.xml maven
  • ch.qos.logback:logback-classic 1.2.3 compile
  • ch.qos.logback:logback-core 1.2.3 compile
  • com.powsybl:powsybl-ieee-cdf-converter compile
  • com.powsybl:powsybl-dependencies 1.2.0 import
  • org.graalvm.nativeimage:svm 21.3.0 provided
  • org.graalvm.sdk:graal-sdk 21.3.0 provided
  • com.powsybl:powsybl-cgmes-conformity
  • com.powsybl:powsybl-cgmes-conversion
  • com.powsybl:powsybl-cgmes-model
  • com.powsybl:powsybl-config-classic
  • com.powsybl:powsybl-glsk-document-ucte
  • com.powsybl:powsybl-iidm-api
  • com.powsybl:powsybl-iidm-impl
  • com.powsybl:powsybl-iidm-reducer
  • com.powsybl:powsybl-iidm-test
  • com.powsybl:powsybl-iidm-xml-converter
  • com.powsybl:powsybl-loadflow-api
  • com.powsybl:powsybl-math-native 1.2.1
  • com.powsybl:powsybl-matpower-converter
  • com.powsybl:powsybl-network-area-diagram
  • com.powsybl:powsybl-open-loadflow
  • com.powsybl:powsybl-powerfactory-converter
  • com.powsybl:powsybl-powerfactory-dgs
  • com.powsybl:powsybl-psse-converter
  • com.powsybl:powsybl-single-line-diagram-core
  • com.powsybl:powsybl-tools
  • com.powsybl:powsybl-triple-store-impl-rdf4j
  • com.powsybl:powsybl-ucte-converter
  • org.apache.commons:commons-collections4 4.4
  • org.codehaus.janino:janino 3.1.0
  • org.mapdb:mapdb 3.0.8
  • org.slf4j:log4j-over-slf4j 1.7.30
  • com.powsybl:powsybl-commons test
  • com.powsybl:powsybl-math-native test
  • org.assertj:assertj-core 3.11.0 test
  • org.junit.jupiter:junit-jupiter-engine 5.5.2 test
requirements.txt pypi
  • coverage ==5.5
  • matplotlib *
  • mypy ==0.931
  • networkx *
  • pandas ==1.3.5
  • pandas-stubs ==1.2.0.47
  • prettytable ==2.0.0
  • pydata-sphinx-theme ==0.6.3
  • pylint ==2.12.2
  • pytest >=6.2.5
  • sphinx ==4.2.0
  • wheel ==0.37.1
setup.py pypi
  • networkx *
  • pandas *
  • prettytable *
.github/workflows/dev-ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • graalvm/setup-graalvm v1 composite
  • sonarsource/sonarcloud-github-action v1.6 composite
.github/workflows/full-ci.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
  • graalvm/setup-graalvm v1 composite
  • sonarsource/sonarcloud-github-action v1.6 composite

Score: 15.695058657597803