Energy system optimization with linopy — progressive modeling, from simple to complex.
Project description
fluxopt
Energy system optimization with linopy — detailed dispatch, scaled to multi period planning.
Early development — the API may change between releases. Planned features and progress are tracked in Issues.
Installation
pip install fluxopt
Includes the HiGHS solver out of the box.
Quick Start
# A gas boiler covers a heat demand, minimizing fuel cost
from datetime import datetime
from fluxopt import Carrier, Converter, Effect, Flow, Port, optimize
result = optimize(
timesteps=[datetime(2024, 1, 1, h) for h in range(4)],
carriers=[Carrier('gas'), Carrier('heat')],
effects=[Effect('cost')],
ports=[
Port('grid', imports=[
Flow('gas', size=500, effects_per_flow_hour={'cost': 0.04})
]),
Port('demand', exports=[
Flow('heat', size=100, fixed_relative_profile=[0.4, 0.7, 0.5, 0.6])
])
],
converters=[
Converter.boiler(
'boiler',
thermal_efficiency=0.9,
fuel_flow=Flow('gas', size=300),
thermal_flow=Flow('heat', size=200)
)
],
objective_effects='cost',
)
print(f"Total cost: {result.objective:.2f}")
print(result.flow_rates)
Roadmap
fluxopt is evolving into a family of packages with a lean core and optional companions:
┌──────────────┐
│ fluxopt │ core: model building, solving, results, IO
└──────┬───────┘
┌──────────────┬─────────┼──────────────┬──────────────┐
│ │ │ │ │
fluxopt-plot fluxopt-yaml fluxopt-tsam fluxopt-marimo (examples)
plotting YAML+CSV time series interactive cross-package
(plotly) loader aggregation apps notebooks
Companion packages depend on core — core has no knowledge of companions.
Companion packages
| Package | Role | Versioning · Tier | fluxopt pin |
Status |
|---|---|---|---|---|
fluxopt-plot |
Result visualization (Plotly) | Semver · Experimental — method signatures may change | Tight (>=A.B,<A.C), validated per release |
Scaffolded — docs · #51 |
fluxopt-yaml |
Declarative model loader (YAML + CSV → Elements) |
Semver · Experimental — YAML schema may change | Tight (>=A.B,<A.C), validated per release |
Scaffolded — docs · #52 |
fluxopt-tsam |
Time series aggregation — input pre-processing, possibly result disaggregation | Semver · Experimental — round-trip schema may evolve | Undecided — depends on whether representative-period primitives live in core (→ loose) or in this package (→ tight) | Planned |
fluxopt-marimo |
Interactive exploration & dashboards (marimo apps) | CalVer (YYYY.MM.PATCH) · Experimental — apps are templates |
Tight (>=A.B,<A.C), validated per release |
Planned |
Tight-pinned companions release on every fluxopt minor; validation is
automated via scheduled CI. fluxopt-tsam's pin policy is blocked on an
architectural decision — if representative-period primitives live in core, tsam stays
a thin adapter (loose pin); if they live in tsam, the package owns deep
round-trip behavior (tight pin).
Milestones
Cross-cutting work not tied to a single companion package:
| Milestone | Description | Status | Issue |
|---|---|---|---|
Result.stats accessor |
Cached xarray properties for post-processing | Planned | #49 |
.plot stub on Result |
Discoverable property, helpful error if plot package absent | Planned | #50 |
| ReadTheDocs migration | Automatic versioned docs from git tags | Planned | #53 |
| Remove plotly from core | Keep core lean — plotting deps in fluxopt-plot only |
Planned | #54 |
Stability Tiers
| Component | Tier | Policy |
|---|---|---|
| Core modeling API | Stable | Semver. Deprecation warnings before removal. |
| Stats accessor | Semi-stable | Breaking changes allowed between minor versions with changelog entry. |
Companion packages have their own stability policies — see the table above.
See #47 for the full architecture discussion.
Development
Requires uv and Python >= 3.12.
uv sync --group dev # Install deps
uv run pytest -v # Run tests
uv run ruff check . # Lint
uv run ruff format . # Format
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fluxopt-0.0.8.tar.gz.
File metadata
- Download URL: fluxopt-0.0.8.tar.gz
- Upload date:
- Size: 53.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b44a5a008e506ef696a74a1257739deb6c16f8aeb0f6158a3ce7ae2a2b337b6
|
|
| MD5 |
a0a729ac5a3affe6a3c8f8e83a48f427
|
|
| BLAKE2b-256 |
80cd8ead448d0a94640131fdd5a7bbfbc24d72aba7af9353b9c4a42b8bdaca17
|
Provenance
The following attestation bundles were made for fluxopt-0.0.8.tar.gz:
Publisher:
publish.yaml on FBumann/fluxopt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluxopt-0.0.8.tar.gz -
Subject digest:
4b44a5a008e506ef696a74a1257739deb6c16f8aeb0f6158a3ce7ae2a2b337b6 - Sigstore transparency entry: 1683991712
- Sigstore integration time:
-
Permalink:
FBumann/fluxopt@0a3966a4eb2eed68639f675ab343097d0feb7aa1 -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/FBumann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0a3966a4eb2eed68639f675ab343097d0feb7aa1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fluxopt-0.0.8-py3-none-any.whl.
File metadata
- Download URL: fluxopt-0.0.8-py3-none-any.whl
- Upload date:
- Size: 59.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9d51de8587ee67010a6c9377d7775a726399ea085c5d8a1e0b2c92ed66ec380
|
|
| MD5 |
23aa555aaa04675434f69c8cf2b1e895
|
|
| BLAKE2b-256 |
4395291371e90a240dd517e17ebabf75591f90fae302f37ddd49553f5de9f9a6
|
Provenance
The following attestation bundles were made for fluxopt-0.0.8-py3-none-any.whl:
Publisher:
publish.yaml on FBumann/fluxopt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fluxopt-0.0.8-py3-none-any.whl -
Subject digest:
b9d51de8587ee67010a6c9377d7775a726399ea085c5d8a1e0b2c92ed66ec380 - Sigstore transparency entry: 1683991875
- Sigstore integration time:
-
Permalink:
FBumann/fluxopt@0a3966a4eb2eed68639f675ab343097d0feb7aa1 -
Branch / Tag:
refs/tags/v0.0.8 - Owner: https://github.com/FBumann
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@0a3966a4eb2eed68639f675ab343097d0feb7aa1 -
Trigger Event:
push
-
Statement type: