PyPSA
A free software toolbox for simulating and optimizing modern power systems that include features such as conventional generators with unit commitment, variable wind and solar generation, storage units, coupling to other energy sectors, and mixed alternating and direct current networks.
https://github.com/PyPSA/PyPSA
Category: Energy Systems
Sub Category: Energy System Modeling Frameworks
Keywords
capacity-expansion-planning clean-energy climate-change electrical-engineering electricity energy energy-system energy-system-model energy-system-modelling energy-systems loadflow optimal-power-flow optimisation power-flow power-systems power-systems-analysis powerflow python renewable-energy renewables
Keywords from Contributors
pypsa linopy pyomo energy-data energy-modelling power-grids transmission-network sector-coupling energy-system-analysis europe
Last synced: about 7 hours ago
JSON representation
Repository metadata
PyPSA: Python for Power System Analysis
- Host: GitHub
- URL: https://github.com/PyPSA/PyPSA
- Owner: PyPSA
- License: mit
- Created: 2016-01-11T09:04:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2026-08-10T16:08:02.000Z (5 days ago)
- Last Synced: 2026-08-10T17:37:02.537Z (5 days ago)
- Topics: capacity-expansion-planning, clean-energy, climate-change, electrical-engineering, electricity, energy, energy-system, energy-system-model, energy-system-modelling, energy-systems, loadflow, optimal-power-flow, optimisation, power-flow, power-systems, power-systems-analysis, powerflow, python, renewable-energy, renewables
- Language: Python
- Homepage: https://docs.pypsa.org
- Size: 70.7 MB
- Stars: 2,101
- Watchers: 68
- Forks: 678
- Open Issues: 146
- Releases: 90
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Security: docs/SECURITY.md
README.md
PyPSA - Python for Power System Analysis
PyPSA stands for Python for Power System Analysis. It is pronounced
pipes-ah.
PyPSA is an open-source Python framework for optimising and simulating modern
power and energy systems that include features such as conventional generators
with unit commitment, variable wind and solar generation, hydro-electricity,
inter-temporal storage, coupling to other energy sectors, elastic demands, and
linearised power flow with loss approximations in DC and AC networks. PyPSA is
designed to scale well with large networks and long time series. It is made for
researchers, planners and utilities with basic coding aptitude who need a fast,
easy-to-use and transparent tool for power and energy system analysis.
[!NOTE]
PyPSA has many contributors, with the maintenance led by the Department of Digital Transformation in
Energy Systems at the Technical University of
Berlin. The project is currently supported by the
German Research Foundation
(grant number528775426).
Previous versions were developed at the Karlsruhe
Institute of Technology funded by the
Helmholtz Association, and
at FIAS funded by the German Federal
Ministry for Education and Research (BMBF).
Features
-
Economic Dispatch (ED): Models short-term market-based dispatch including
unit commitment, renewable availability, short-duration and seasonal storage
including hydro reservoirs with inflow and spillage dynamics, elastic demands,
load shedding and conversion between energy carriers, using either perfect
operational foresight or rolling horizon time resolution. -
Linear Optimal Power Flow (LOPF): Extends economic dispatch to determine
the least-cost dispatch while respecting network constraints in meshed AC-DC
networks, using a linearised representation of power flow (KVL, KCL) with
optional loss approximations. -
Security-Constrained LOPF (SCLOPF): Extends LOPF by accounting for line
outage contingencies to ensure system reliability under $N-1$ conditions. -
Capacity Expansion Planning (CEP): Supports least-cost
long-term system planning with investment decisions for generation, storage,
conversion, and transmission infrastructure. Handles both single and multiple
investment periods. Continuous and discrete investments are supported. -
Pathway Planning: Supports co-optimisation of multiple investment periods to
plan energy system transitions over time with perfect planning foresight. -
Stochastic Optimisation: Implements two-stage stochastic programming
framework with scenario-weighted uncertain inputs, with investments as
first-stage decisions and dispatch as recourse decisions. -
Modelling-to-Generate-Alternatives (MGA): Explores near-optimal decision
spaces to provide insight into the range of feasible system configurations with
similar costs. -
Sector-Coupling: Modelling integrated energy systems with multiple energy
carriers (electricity, heat, hydrogen, etc.) and conversion between them.
Flexible representation of technologies such as heat pumps, electrolysers,
battery electric vehicles (BEVs), direct air capture (DAC), and synthetic
fuels production. -
Static Power Flow Analysis: Computes both full non-linear and linearised
load flows for meshed AC and DC grids using Newton-Raphson method.
Documentation
PyPSA has extensive documentation with tutorials, user guides, examples and an API reference.
Installation
pip:
pip install pypsa
conda/mamba:
conda install -c conda-forge pypsa
uv:
uv add pypsa
Usage
import pypsa
# create a new network
n = pypsa.Network()
n.add("Bus", "mybus")
n.add("Load", "myload", bus="mybus", p_set=100)
n.add("Generator", "mygen", bus="mybus", p_nom=100, marginal_cost=20)
# load an example network
n = pypsa.examples.ac_dc_meshed()
# run the optimisation
n.optimize()
# plot results
n.generators_t.p.plot()
n.plot()
# get statistics
n.statistics()
n.statistics.energy_balance()
Dependencies
PyPSA relies heavily on other open-source Python packages. Some of them are:
- pandas for storing data about components and time series
- numpy and scipy for linear algebra and matrix calculations
- linopy for preparing optimisation problems
- matplotlib, seaborn and plotly for static and interactive plotting
- networkx for network calculations
- pytest for unit testing
Find the full list of dependencies in the pyproject.toml file.
PyPSA can be used with different solvers. For instance, the free solvers
HiGHS (installed by default), GLPK and
CBC or commercial solvers like
Gurobi or FICO Xpress for which free academic licenses are available.
Contributing and Support
We strongly welcome anyone interested in contributing to this project. If you have any ideas, suggestions or encounter problems, feel invited to file issues or make pull requests on GitHub.
- To discuss with other PyPSA users, organise projects, share news, and get in touch with the community you can use the Discord server.
- For bugs and feature requests, please open an issue.
- For troubleshooting and support, please check the troubleshooting and support sections in the documentation.
Detailed guidelines can be found in the Contributing guidelines of our documentation.
Code of Conduct
Please respect our Code of Conduct.
Citing PyPSA
If you use PyPSA for your research, we would appreciate it if you would
cite the following paper:
- T. Brown, J. Hörsch, D. Schlachtberger, PyPSA: Python for Power
System Analysis, 2018, Journal
of Open Research
Software, 6(1),
arXiv:1707.09913,
DOI:10.5334/jors.188
Please use the following BibTeX:
@article{PyPSA,
author = {T. Brown and J. H\"orsch and D. Schlachtberger},
title = {{PyPSA: Python for Power System Analysis}},
journal = {Journal of Open Research Software},
volume = {6},
issue = {1},
number = {4},
year = {2018},
eprint = {1707.09913},
url = {https://doi.org/10.5334/jors.188},
doi = {10.5334/jors.188}
}
If you want to cite a specific PyPSA version, each release of PyPSA is archived
on Zenodo with a release-specific DOI:
Licence
Copyright PyPSA Contributors
PyPSA is licensed under the open source MIT License.
The documentation is licensed under CC-BY-4.0.
The repository uses REUSE to expose the licenses of its files.
Citation (CITATION.cff)
# SPDX-FileCopyrightText: PyPSA Contributors
#
# SPDX-License-Identifier: MIT
cff-version: 1.2.0
message: "If you use this package, please cite the corresponding manuscript in Journal of Open Research Software."
title: "PyPSA: Python for Power System Analysis"
repository: https://github.com/pypsa/pypsa
license: MIT
journal: Journal of Open Research Software
doi: 10.5334/jors.188
authors:
- family-names: Brown
given-names: Tom
orcid: https://orcid.org/0000-0001-5898-1911
- family-names: Hörsch
given-names: Jonas
orcid: https://orcid.org/0000-0001-9438-767X
- family-names: Schlachtberger
given-names: David
orcid: https://orcid.org/0000-0002-8167-8213
Owner metadata
- Name: PyPSA
- Login: PyPSA
- Email:
- Kind: organization
- Description: Python for Power System Analysis
- Website: www.pypsa.org
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/32890768?v=4
- Repositories: 29
- Last ynced at: 2024-03-26T13:25:46.062Z
- Profile URL: https://github.com/PyPSA
GitHub Events
Total
- Release event: 12
- Delete event: 336
- Pull request event: 395
- Fork event: 125
- Discussion event: 1
- Issues event: 178
- Watch event: 450
- Issue comment event: 351
- Push event: 995
- Pull request review comment event: 238
- Pull request review event: 314
- Create event: 151
Last Year
- Release event: 3
- Delete event: 59
- Pull request event: 99
- Fork event: 36
- Discussion event: 1
- Issues event: 88
- Watch event: 127
- Issue comment event: 138
- Push event: 414
- Pull request review comment event: 100
- Pull request review event: 98
- Create event: 62
Committers metadata
Last synced: 1 day ago
Total Commits: 2,705
Total Committers: 121
Avg Commits per committer: 22.355
Development Distribution Score (DDS): 0.821
Commits in past year: 353
Committers in past year: 45
Avg Commits per committer in past year: 7.844
Development Distribution Score (DDS) in past year: 0.589
| Name | Commits | |
|---|---|---|
| Fabian | f****f@g****e | 483 |
| Tom Brown | b****n@f****e | 412 |
| Fabian Neumann | f****n@o****e | 388 |
| Lukas Trippe | l****p@p****e | 312 |
| pre-commit-ci[bot] | 6****] | 239 |
| Jonas Hoersch | j****s@c****t | 231 |
| Philipp Glaum | p****m@t****e | 70 |
| Max Parzen | m****n@e****k | 51 |
| lisazeyen | l****n@w****e | 35 |
| dependabot[bot] | 4****] | 34 |
| Iegor Riepin | i****n@g****m | 33 |
| martacki | m****i@k****u | 28 |
| Koen van Greevenbroek | k****k@u****o | 27 |
| energyls | l****m@o****e | 20 |
| Markus Groissböck | m****k@g****t | 20 |
| euronion | 4****n | 18 |
| Russell Smith | r****h@e****m | 18 |
| JulianGeis | J****s@g****t | 14 |
| Enrico Giglio | 1****o@g****m | 13 |
| Matthew Dumlao | d****4@k****p | 12 |
| Nis Martensen | n****n@w****e | 10 |
| Bobby Xiong | 3****g | 10 |
| gailin-p | g****e@g****m | 9 |
| Ben Elliston | b****e@a****u | 9 |
| ekatef | e****a@g****m | 7 |
| Jess | 1****n | 7 |
| Heinz-Alexander Fuetterer | 3****r | 7 |
| Matěj | m****y | 6 |
| PeterKlein11 | 8****1 | 6 |
| ksyranid | k****d@g****m | 6 |
| and 91 more... | ||
Committer domains:
- tu-berlin.de: 3
- fias.uni-frankfurt.de: 2
- posteo.de: 2
- iee-extern.fraunhofer.de: 1
- cern.ch: 1
- witte.sh: 1
- air.net.au: 1
- kyoto-u.jp: 1
- gmx.net: 1
- edisonenergy.com: 1
- gmx.at: 1
- oth-regensburg.de: 1
- uit.no: 1
- kit.edu: 1
- ed.ac.uk: 1
- chaoflow.net: 1
- pm.me: 1
- outlook.de: 1
- gmx.de: 1
- informatik.uni-freiburg.de: 1
- transnetbw.de: 1
- rte-france.com: 1
- energynautics.com: 1
- tuhh.de: 1
- gridmatic.com: 1
- engie.com: 1
- iai-esm003.iai.kit.edu: 1
- planit.institute: 1
- esciencecenter.nl: 1
- agora-energiewende.de: 1
- pik-potsdam.de: 1
- uliege.be: 1
- eng.au.dk: 1
- climateanalytics.org: 1
- hs-flensburg.de: 1
- fh-aachen.de: 1
- yahoo.de: 1
Issue and Pull Request metadata
Last synced: 1 day ago
Total issues: 534
Total pull requests: 1,400
Average time to close issues: 7 months
Average time to close pull requests: 19 days
Total issue authors: 191
Total pull request authors: 135
Average comments per issue: 1.82
Average comments per pull request: 1.33
Merged pull request: 1,084
Bot issues: 0
Bot pull requests: 162
Past year issues: 121
Past year pull requests: 258
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 8 days
Past year issue authors: 45
Past year pull request authors: 51
Past year average comments per issue: 1.66
Past year average comments per pull request: 1.2
Past year merged pull request: 152
Past year bot issues: 0
Past year bot pull requests: 46
Top Issue Authors
- fneum (71)
- FabianHofmann (63)
- lkstrp (18)
- euronion (16)
- nworbmot (14)
- Cellophil (13)
- brynpickering (12)
- lisazeyen (12)
- fhg-isi (12)
- pz-max (9)
- loongmxbt (8)
- PeterKlein11 (7)
- coroa (7)
- MaykThewessen (7)
- davide-f (6)
Top Pull Request Authors
- lkstrp (317)
- FabianHofmann (246)
- fneum (192)
- pre-commit-ci[bot] (100)
- dependabot[bot] (51)
- p-glaum (39)
- coroa (30)
- lisazeyen (25)
- Irieo (23)
- koen-vg (23)
- gincrement (22)
- pz-max (16)
- martacki (15)
- nworbmot (12)
- afuetterer (12)
Top Issue Labels
- bug (136)
- enhancement (96)
- needs triage (54)
- gap (29)
- optimization (29)
- help wanted (20)
- needs discussion (17)
- wontfix (12)
- IO (11)
- high priority (9)
- operational realism (8)
- data validation (8)
- question (6)
- high-priority (6)
- components API (6)
- feature (6)
- good first issue (5)
- discussion (5)
- analysis (5)
- investments (4)
- AC power flow (4)
- docs (3)
- workflow (3)
- model-building (3)
- breaking (3)
- documentation (2)
- market modelling (2)
- reliability & uncertainty (2)
- needs info (2)
- beginner-friendly (2)
Top Pull Request Labels
- dependencies (51)
- python:uv (33)
- enhancement (15)
- github_actions (13)
- new-opt (8)
- feature (8)
- new-docs (4)
- bug (4)
- agent (4)
- stacked (2)
- gap (2)
- optimization (1)
- market modelling (1)
- documentation (1)
- high-priority (1)
- needs revision (1)
Package metadata
- Total packages: 4
-
Total downloads:
- conda: 214,557 total
- pypi: 87,936 last-month
- Total docker downloads: 204
- Total dependent packages: 8 (may contain duplicates)
- Total dependent repositories: 46 (may contain duplicates)
- Total versions: 284
- Total maintainers: 3
pypi.org: pypsa
Python for Power Systems Analysis
- Homepage: https://github.com/PyPSA/PyPSA
- Documentation: https://docs.pypsa.org
- Licenses: MIT License
- Latest release: 1.2.4 (published about 2 months ago)
- Last Synced: 2026-08-14T08:32:04.780Z (1 day ago)
- Versions: 90
- Dependent Packages: 8
- Dependent Repositories: 32
- Downloads: 87,936 Last month
- Docker Downloads: 204
-
Rankings:
- Dependent packages count: 1.256%
- Stargazers count: 2.075%
- Dependent repos count: 2.6%
- Forks count: 2.716%
- Average: 2.756%
- Docker downloads count: 3.144%
- Downloads: 4.747%
- Maintainers (3)
proxy.golang.org: github.com/pypsa/pypsa
- Homepage:
- Documentation: https://pkg.go.dev/github.com/pypsa/pypsa#section-documentation
- Licenses: mit
- Latest release: v1.2.4 (published about 2 months ago)
- Last Synced: 2026-08-14T08:01:29.276Z (1 day ago)
- Versions: 89
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent repos count: 1.622%
- Average: 4.057%
- Dependent packages count: 6.492%
proxy.golang.org: github.com/PyPSA/PyPSA
- Homepage:
- Documentation: https://pkg.go.dev/github.com/PyPSA/PyPSA#section-documentation
- Licenses: mit
- Latest release: v1.2.4 (published about 2 months ago)
- Last Synced: 2026-08-14T09:18:26.520Z (1 day ago)
- Versions: 89
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
conda-forge.org: pypsa
PyPSA is a free software toolbox for simulating and optimising modern power systems that include features such as conventional generators with unit commitment, variable wind and solar generation, storage units, coupling to other energy sectors, and mixed alternating and direct current networks. PyPSA is designed to scale well with large networks and long time series.
- Homepage: https://pypsa.org/
- Licenses: MIT
- Latest release: 0.21.1 (published almost 4 years ago)
- Last Synced: 2026-04-01T13:29:02.478Z (5 months ago)
- Versions: 16
- Dependent Packages: 0
- Dependent Repositories: 14
- Downloads: 214,557 Total
-
Rankings:
- Forks count: 9.274%
- Dependent repos count: 9.349%
- Stargazers count: 14.05%
- Average: 21.053%
- Dependent packages count: 51.54%
Dependencies
- actions/cache 55cc8345863c7cc4c66a329aec7e433d2d1c52a9 composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
- actions/upload-artifact 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a composite
- dorny/paths-filter 7b450fff21473bca461d4b92ce414b9d0420d706 composite
- prefix-dev/setup-pixi a09b6247153796b190642a2b53fac4241043cf6f composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
- actions/download-artifact 3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c composite
- actions/setup-python 5fda3b95a4ea91299a34e894583c3862153e4b97 composite
- hynek/build-and-inspect-python-package 2abe76da66d0a6a4a227101f9348ee855797cfa5 composite
- pypa/gh-action-pypi-publish dc37677b2e1c63e2034f94d8a5b11f265b73ba33 composite
- softprops/action-gh-release 3d0d9888cb7fd7b750713d6e236d1fcb99157228 composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
- actions/setup-python 5fda3b95a4ea91299a34e894583c3862153e4b97 composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
- actions/download-artifact 3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c composite
- actions/setup-python 5fda3b95a4ea91299a34e894583c3862153e4b97 composite
- actions/upload-artifact 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a composite
- codecov/codecov-action fb8b3582c8e4def4969c97caa2f19720cb33a72f composite
- codecov/test-results-action 0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 composite
- hynek/build-and-inspect-python-package 2abe76da66d0a6a4a227101f9348ee855797cfa5 composite
- lycheeverse/lychee-action e7477775783ea5526144ba13e8db5eec57747ce8 composite
- actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 composite
- github/codeql-action/analyze f205ea1c3313d32999d8d6a48b4f6530d4437b38 composite
- github/codeql-action/init f205ea1c3313d32999d8d6a48b4f6530d4437b38 composite
- 242 dependencies
Score: 25.133837509205172