Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test with the earliest and the latest python versions supported
python-version: ["3.9", "3.13"]
python-version: ["3.11", "3.14"]

steps:
- uses: actions/checkout@v6
Expand All @@ -40,7 +40,7 @@ jobs:
--cov-report=xml

- name: Upload coverage to Codecov
if: success() && (github.event_name == 'push' && runner.os == 'Linux' && matrix.python-version == 3.9)
if: success() && (github.event_name == 'push' && runner.os == 'Linux' && matrix.python-version == '3.11')
uses: codecov/codecov-action@v6
with:
fail_ci_if_error: true
Expand All @@ -59,7 +59,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test with the earliest and the latest python versions supported
python-version: ["3.9", "3.13"]
python-version: ["3.11", "3.14"]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.13
python-version: "3.14"
- name: Install dependencies
run: |
sudo apt update -y
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ["3.9"]
python-version: ["3.11"]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Test with the earliest and the latest python versions supported
python-version: ["3.9", "3.13"]
python-version: ["3.11", "3.14"]

steps:
- uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.9"
python: "3.11"
apt_packages:
- graphviz
- pandoc
Expand Down
30 changes: 15 additions & 15 deletions docs/installation/pipx-based.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipx-based installation
To help you installing MUSE in your system we will follow these steps:

- `Launching a terminal`_: Needed to both install and run MUSE.
- `Installing a compatible Python version`_: MUSE works with Python 3.9 to 3.13.
- `Installing a compatible Python version`_: MUSE works with Python 3.11 to 3.14.
- `Installing pipx`_: A Python application manager that facilitates installing, keeping applications updated and run them in their own isolated environments.
- `Installing MUSE itself`_

Expand All @@ -22,8 +22,8 @@ In the following sections, we will guide you step by step in configuring your sy

.. code-block::

pyenv install 3.9.13
pyenv shell 3.9.13
pyenv install 3.11.0
pyenv shell 3.11.0
python -m pip install pipx
python -m pipx ensurepath
python -m pipx install muse-os
Expand Down Expand Up @@ -67,7 +67,7 @@ Once you have launched the Terminal, the window that opens will show the command
Installing a compatible Python version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

MUSE needs Python to run and it works with versions 3.9 to 3.13, so the next step is to install a suitable version of Python.
MUSE needs Python to run and it works with versions 3.11 to 3.14, so the next step is to install a suitable version of Python.

.. note::

Expand All @@ -92,7 +92,7 @@ The first thing will be to check if you already have a suitable python version i

python --version

If the output is ``Python 3.Y.X`` or ``Python 3.Y.X``, where ``X`` is any number and ``Y`` is 9, 10, 11 or 12, then **you have a version of Python compatible with MUSE and you can skip this section altogether**. Move to `Installing pipx`_. In any other case, keep reading.
If the output is ``Python 3.Y.X``, where ``X`` is any number and ``Y`` is 11, 12, 13 or 14, then **you have a version of Python compatible with MUSE and you can skip this section altogether**. Move to `Installing pipx`_. In any other case, keep reading.

There are multiple ways of installing Python, as well as multiple distributions. Here we have opted for the one that we believe is simplest, requires the smallest downloads and gives the maximum flexibility: using ``pyenv``.

Expand Down Expand Up @@ -189,38 +189,38 @@ With ``pyenv`` installed and correctly configured, it is now easy to install any

pyenv install -l

You should see a long list of versions to choose from. Let's install one of the later versions of the 3.9 family:
You should see a long list of versions to choose from. Let's install 3.11.0 as an example:

.. code-block:: bash

pyenv install 3.9.13
pyenv install 3.11.0

The command will take a minute or two to complete, depending on your internet connection, and show an output similar to the following (this is an example from Windows):

.. code-block:: output

:: [Info] :: Mirror: https://www.python.org/ftp/python
:: [Downloading] :: 3.9.13 ...
:: [Downloading] :: From https://www.python.org/ftp/python/3.9.13/python-3.9.13-amd64.exe
:: [Downloading] :: To C:\Users\your_username\.pyenv\pyenv-win\install_cache\python-3.9.13-amd64.exe
:: [Installing] :: 3.9.13 ...
:: [Info] :: completed! 3.9.13
:: [Downloading] :: 3.11.0 ...
:: [Downloading] :: From https://www.python.org/ftp/python/3.11.0/python-3.11.0-amd64.exe
:: [Downloading] :: To C:\Users\your_username\.pyenv\pyenv-win\install_cache\python-3.11.0-amd64.exe
:: [Installing] :: 3.11.0 ...
:: [Info] :: completed! 3.11.0

Now, we have a new Python version in our system, but it is still not available (if you run ``python --version`` you will get the same result as before). There are two options moving forward:

- If you want to set it as the global python version, available system wide (only do this if you really want to set is as your main Python!) run:

.. code-block:: bash

pyenv global 3.9.13
pyenv global 3.11.0

- If you just want it momentarily to install MUSE run instead the following command:

.. code-block:: bash

pyenv shell 3.9.13
pyenv shell 3.11.0

In both cases, if you run ``python --version`` afterwards, you should get ``Python 3.9.13``.
In both cases, if you run ``python --version`` afterwards, you should get ``Python 3.11.0``.

Installing ``pipx``
~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions docs/installation/virtual-env-based.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To create an environment called ``muse_env`` run:

.. code-block:: bash

conda create -n muse_env python=3.9
conda create -n muse_env python=3.11

Now, you can activate the environment with:

Expand Down Expand Up @@ -95,7 +95,7 @@ Creating a virtual environment with ``pyenv + venv``

Alternatively to creating virtual environments in ``conda``, you can also make use of two well-tested and maintained libraries.
We met the first one, ``pyenv``, already in the :ref:`pipx-based <pipx-based>` under the section :ref:`Installing pyenv <pipx-based-installing-pyenv>` and the installation procedure is exactly the same.
If you go down that route, please follow the steps outlined there and chose a recent version ``Python``, say 3.9.
If you go down that route, please follow the steps outlined there and choose a recent version ``Python``, say 3.13.

The second package we need to create virtual environments for any specific ``Python`` version is called
``venv``, and it ships with ``Python`` by default. To create such an environment, we first need to ensure that the
Expand Down
15 changes: 7 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ name = "MUSE_OS"
description = "Energy System Model"
readme = "README.md"
license = {file = "LICENSE"}
requires-python = ">= 3.9, <3.14"
requires-python = ">= 3.11, <3.15"
keywords = ["energy", "modelling"]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Intended Audience :: Science/Research",
"Intended Audience :: Other Audience",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)"
]
dependencies = [
"numpy>=2.0",
"scipy>=1.13",
"pandas>=2.2,<3.0",
"xarray>=2024.6,<=2024.11",
"bottleneck>=1.4",
"numpy>=2.4,<3.0",
"scipy>=1.17,<2.0",
"pandas>=3.0,<4.0",
"xarray>=2026.2,<2027.0",
"bottleneck>=1.4,<2.0",
"coloredlogs",
"toml",
"xlrd",
Expand Down
2 changes: 0 additions & 2 deletions src/muse/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""MUSE model."""

from __future__ import annotations

import os
from contextlib import suppress
from importlib.metadata import PackageNotFoundError, version
Expand Down
2 changes: 0 additions & 2 deletions src/muse/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Makes MUSE executable."""

from __future__ import annotations

import pathlib
from argparse import ArgumentParser

Expand Down
2 changes: 0 additions & 2 deletions src/muse/agents/agent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Holds all building agents."""

from __future__ import annotations

from abc import ABC, abstractmethod
from typing import Callable

Expand Down
2 changes: 0 additions & 2 deletions src/muse/agents/factories.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Holds all building agents."""

from __future__ import annotations

from collections.abc import Mapping, Sequence
from pathlib import Path
from typing import Any, Callable
Expand Down
2 changes: 0 additions & 2 deletions src/muse/carbon_budget.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

from collections.abc import MutableMapping, Sequence
from logging import getLogger
from typing import Callable
Expand Down
2 changes: 0 additions & 2 deletions src/muse/commodities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Methods and types around commodities."""

from __future__ import annotations

from collections.abc import Sequence
from enum import IntFlag, auto
from pathlib import Path
Expand Down
2 changes: 0 additions & 2 deletions src/muse/constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ def constraints(
Any other parameter.
"""

from __future__ import annotations

from collections.abc import Mapping, MutableMapping, Sequence
from enum import Enum, auto
from typing import (
Expand Down
2 changes: 0 additions & 2 deletions src/muse/costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@

"""

from __future__ import annotations

from functools import wraps

import numpy as np
Expand Down
2 changes: 0 additions & 2 deletions src/muse/decisions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ def weighted_sum(objectives: Dataset, parameters: Any, **kwargs) -> DataArray:
A data array with ranked replacement technologies.
"""

from __future__ import annotations

__all__ = [
"epsilon_constraints",
"factory",
Expand Down
2 changes: 0 additions & 2 deletions src/muse/demand_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
solve these constrained problems one way or another.
"""

from __future__ import annotations

__all__ = ["demand_matching"]


Expand Down
2 changes: 0 additions & 2 deletions src/muse/demand_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def demand_share(
A DataArray of demand shares.
"""

from __future__ import annotations

from collections.abc import Hashable, MutableMapping, Sequence
from functools import wraps
from logging import getLogger
Expand Down
2 changes: 0 additions & 2 deletions src/muse/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ def production(
A `xr.DataArray` with the amount produced for each good from each asset.
"""

from __future__ import annotations

__all__ = [
"PRODUCTION_SIGNATURE",
"dispatch_by_merit_order",
Expand Down
2 changes: 0 additions & 2 deletions src/muse/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
model.run()
"""

from __future__ import annotations

from logging import getLogger
from os import mkdir
from pathlib import Path
Expand Down
10 changes: 3 additions & 7 deletions src/muse/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ def search_space_initializer(
An initial search space
"""

from __future__ import annotations

__all__ = [
"compress",
"currently_existing_tech",
Expand Down Expand Up @@ -489,9 +487,7 @@ def initialize_from_assets(
if "asset" not in agent.assets.dims or len(agent.assets.asset) == 0:
return replacement

assets = (
xr.ones_like(reduce_assets(agent.assets.asset, coords=coords), dtype=bool)
.rename(technology="asset")
.set_index()
)
assets = xr.ones_like(
reduce_assets(agent.assets.asset, coords=coords), dtype=bool
).set_index(asset="technology")
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. This is functionally equivalent to before so not introducing any new bugs at least. This function doesn't seem to be used anyway in any of the examples, so may be able to delete

return (assets * replacement).transpose("asset", "replacement")
2 changes: 0 additions & 2 deletions src/muse/hooks.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Pre and post hooks on agents."""

from __future__ import annotations

__all__ = [
"asset_merge_factory",
"clean",
Expand Down
2 changes: 0 additions & 2 deletions src/muse/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
arguments and returns nothing. It is expected to modify the agents in-place.
"""

from __future__ import annotations

__all__ = [
"factory",
"new_to_retro_net",
Expand Down
2 changes: 0 additions & 2 deletions src/muse/investments.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ def investment(
of newly invested capacity.
"""

from __future__ import annotations

__all__ = [
"INVESTMENT_SIGNATURE",
"adhoc_match_demand",
Expand Down
5 changes: 2 additions & 3 deletions src/muse/lp_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from the format required by scipy's linear programming solver.
"""

from __future__ import annotations

from dataclasses import dataclass
from typing import Self

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -160,7 +159,7 @@ def from_muse_data(
constraints: list,
commodities: list[str],
timeslice_level: str | None = None,
) -> ScipyAdapter:
) -> Self:
"""Creates a ScipyAdapter from MUSE data structures."""
# Calculate costs for the linear problem
lpcosts = lp_costs(capacity_costs, commodities, timeslice_level)
Expand Down
Loading
Loading