MESQUAL
Modular Energy Scenario Comparison Library for Quantitative and Qualitative Analysis
mesqual is a Python framework for multi-scenario analysis of energy market simulations.
mesqual is made for humans and agents alike: its API lets anyone understand, navigate and analyze a study. The describe methods (StudyManager.describe_study(), Dataset.describe_flags(), Dataset.flag_info()) show what a study holds and load no time series data. So people and agents write study code against one documented API, not new pandas code for each study.
Why mesqual
- Scenarios and comparisons are objects. A study holds scenarios and the comparisons between them. One
fetchcall gives a variable (a flag) for all scenarios (study.scen), all comparisons (study.comp) or both (study.scen_comp). - One API and framework over any simulation platform. A platform package maps the output of one modeling tool to flags. Each flag has a description, a schema and, where it applies, a unit. Study code asks for flags, not for files.
- KPIs, maps and dashboards. KPI collections, interactive Folium maps and HTML dashboards use the same flags.
- Energy logic, written once. Units, volume-weighted area prices, area and border accounting, and time series granularity conversion are part of the package. A study does not write them again.
- Extension in layers. Platform packages extend mesqual. A study extends its platform with its own flags, interpreter overrides and area layers, and does not change the platform code.
Installation
pip install mesqual
mesqual needs Python 3.11 or later. Optional extras:
color: colored log output ofConsoleLogging, for examplepip install "mesqual[color]"screenshot: map screenshots withFoliumScreenshotter(needs Chrome)
To work on mesqual itself, clone the repository and run uv sync --all-extras. The AGENTS.md of the repository gives the rules for changes and the checks, which include the docs build. To preview the docs, run uv run mkdocs serve.
Quickstart on synthetic data
mesqual.testing is a synthetic platform: it generates small scenarios of a network with countries, nodes, lines, generators and demands. It needs no data files. The comments say what each call returns.
from mesqual.testing import make_dummy_study
study = make_dummy_study() # scenarios base, high_demand, without_N4, short; comparisons against base
study.describe_study() # dict: scenarios, comparisons and their flags
study.scen.flag_info('Node.Results.price') # FlagInfo: description, unit and schema of one flag
prices = study.scen.fetch('Node.Results.price') # all scenarios: columns dataset, Node
price_deltas = study.comp.fetch('Node.Results.price') # all comparisons: variation minus reference
The full runnable example, examples/quickstart.py, builds the synthetic study, describes it and saves a tabbed HTML dashboard.
Documentation
- Guides, step by step on the synthetic platform:
- Use mesqual in a study: set up a study, find the flags, fetch, KPIs, a map and a dashboard.
- Extend a platform in a study: study flags, interpreter overrides, area layers and custom variables.
- Build a platform package: connect mesqual to a modeling tool.
- Use mesqual with agents: install the skill with
python -m mesqual.skills install ., and add the snippet to theAGENTS.mdof your project. - Architecture: the parts of mesqual, its principles and its contracts.
- API reference: the classes and functions of each module, from
StudyManageron.- Logging: console output with
ConsoleLogging; otherwise the logging setup of your application applies.
- Logging: console output with
mesqual 0.x and its packages
mesqual-pypsa and mesqual-vanilla-studies are deprecated. Deprecated packages work only with mesqual 0.x. For mesqual 2, start with the quickstart and guides at docs.mesqual.io, which run on the synthetic platform mesqual.testing.
Attribution and Licenses
This project is licensed under the GNU Lesser General Public License v3.0 or later. See LICENSES/LGPL-3.0-or-later.txt.
Third-party assets
countries.geojson: Made with Natural Earth
Contact
For questions or feedback, don't hesitate to open an issue or reach out via LinkedIn.
Metadata
Release files for mesqual 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mesqual-2.0.0.tar.gz | 1.5 MB | With provenance | Details for mesqual-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mesqual-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for mesqual-2.0.0-py3-none-any.whl |
Total release size: 3.0 MB
Release files / mesqual-2.0.0.tar.gz
| Download URL | mesqual-2.0.0.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2ceb8b584267fe9a2de88887b975af6c8f3010e26797832c40d6baee5987045
|
|
BLAKE2b-256 checksum How to use checksums |
7736c94107c6a235175c229610b2112cf1ae703dd29bc208620a4b2bda93452d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / mesqual-2.0.0-py3-none-any.whl
| Download URL | mesqual-2.0.0-py3-none-any.whl |
|---|---|
| Size | 1.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b387c0c1832175c5eb2d542124248c7a8d4c02fd218ea51a3963551f25691fea
|
|
BLAKE2b-256 checksum How to use checksums |
74daf87c4bb959ec47d5a98899f35bd44afd1815e32184aedf0a712f8693df21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for mesqual 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mesqual-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.