Skip to content

Commit af09ed2

Browse files
Release v0.7.0.dev6 (#746)
* Release v0.7.0.dev6 * Make gurobi class attr conditional on gurobipy existing, to enable pypi builds
1 parent a76ca45 commit af09ed2

File tree

8 files changed

+48
-22
lines changed

8 files changed

+48
-22
lines changed

.github/workflows/commit-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
- name: Install jupyter kernel
4545
run: python -m ipykernel install --user --name calliope
4646

47-
- name: run tests without coverage
47+
- name: run tests without coverage and without time intensive tests
4848
if: github.ref != 'refs/heads/main'
49-
run: pytest
49+
run: pytest --no-cov -m 'not time_intensive' -m 'not needs_gurobi_license'
5050

5151
- name: run tests with coverage
5252
if: github.ref == 'refs/heads/main'

.github/workflows/pr-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969

7070
- name: run tests without coverage
7171
if: matrix.os != 'ubuntu-latest' || matrix.py3version != '12'
72-
run: pytest
72+
run: pytest --no-cov
7373

7474
- name: Upload coverage reports to Codecov
7575
uses: codecov/codecov-action@v4

CHANGELOG.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
## 0.7.0.dev6
1+
## 0.7.0.dev6 (2025-03-24)
22

33
### User-facing changes
44

5-
|new| working SPORES mode, upgraded from v0.6 to include a selection of scoring algorithms.
5+
|new| working SPORES mode, upgraded from v0.6 to include a selection of scoring algorithms (#716).
66

7-
|new| backend `set_objective` method, to switch between pre-defined objectives.
7+
|new| backend `set_objective` method, to switch between pre-defined objectives (#716).
88

9-
|changed| coin-or-cbc is now available cross-platform on conda-forge and so is the recommended open-source solver to install a user environment with.
9+
|changed| |backwards-incompatible| `from` and `to` parameters (to define start and end point of a transmission link) are now `link_from` and `link_to` (#717).
1010

11-
|changed| Upper bound pins for dependencies removed where possible, to minimise clashes when using calliope as a dependency in a project.
11+
|changed| |backwards-incompatible| `operate` and `spores` mode configuration options are now nested within the main configuration (e.g., `build.operate_window` is now `build.operate.window` and `solve.spores_number` is now `solve.spores.number`) (#704).
1212

13-
## 0.7.0.dev5 (2024-12-04)
13+
|changed| coin-or-cbc is now available cross-platform on conda-forge and so is the recommended open-source solver to install a user environment with (#744).
1414

15-
### User-facing changes
15+
|changed| Upper bound pins for dependencies removed where possible, to minimise clashes when using calliope as a dependency in a project (#744).
16+
17+
|changed| |backwards-incompatible| to ensure the model configuration always remains in sync with the results, `kwargs` in `model.build()` and `model.solve()` now directly affect `model.config` (#704)
18+
19+
|changed| `template:` can now be used anywhere within YAML definition files, not just in the `nodes`, `techs` and `data_tables` sections (#719).
20+
21+
|changed| Removed `inheritance` math helper function since we use `base_tech` for abstract base technologies and templates are now applied too early to be available later (#719).
22+
To refer to template inheritance, set a parameter within a template as all children will share the same value.
23+
24+
### Internal changes
25+
26+
|changed| Moved to using `pydantic` to document and validate our configuration, rather than JSON schema (#704, #717).
27+
28+
|changed| As with base dependencies, moved to pinning lower bound only for development dependencies (#744).
1629

17-
|changed| to ensure the model configuration always remains in sync with the results, `kwargs` in `model.build()` and `model.solve()` now directly affect `model.config`
30+
|changed| Curtailed `calliope.AttrDict` relevance, with I/O moved to `calliope.io` and attribute access moved to `pydantic` models.
31+
`AttrDict` is still used to merge overrides and templates into the model definition dictionary, before creating the `pydantic` models.
1832

19-
|changed| `template:` can now be used anywhere within YAML definition files, not just in the `nodes`, `techs` and `data_tables` sections.
33+
## 0.7.0.dev5 (2024-12-04)
34+
35+
### User-facing changes
2036

2137
|changed| "An overview of the Calliope terminology" information admonition to remove self-references and improve understandability.
2238
Now also includes a visual depiction of how the different defined components connect together (#699).

src/calliope/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.7.0.dev5"
1+
__version__ = "0.7.0.dev6"

src/calliope/backend/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
ALLOWED_MATH_FILE_FORMATS,
1010
LatexBackendModel,
1111
)
12-
from calliope.backend.parsing import ParsedBackendComponent
1312
from calliope.backend.pyomo_backend_model import PyomoBackendModel
1413
from calliope.exceptions import BackendError
1514
from calliope.preprocess import CalliopeMath

src/calliope/backend/gurobi_backend_model.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,22 @@
4242
class GurobiBackendModel(backend_model.BackendModel):
4343
"""gurobipy-specific backend functionality."""
4444

45-
OBJECTIVE_SENSE_DICT = {
46-
"minimize": gurobipy.GRB.MINIMIZE,
47-
"minimise": gurobipy.GRB.MINIMIZE,
48-
"maximize": gurobipy.GRB.MAXIMIZE,
49-
"maximise": gurobipy.GRB.MAXIMIZE,
50-
}
45+
OBJECTIVE_SENSE_DICT: dict[str, int]
46+
if importlib.util.find_spec("gurobipy") is not None:
47+
OBJECTIVE_SENSE_DICT = {
48+
"minimize": gurobipy.GRB.MINIMIZE,
49+
"minimise": gurobipy.GRB.MINIMIZE,
50+
"maximize": gurobipy.GRB.MAXIMIZE,
51+
"maximise": gurobipy.GRB.MAXIMIZE,
52+
}
53+
else:
54+
# As of Gurobi v11, these are the correct integer values for the above constants
55+
OBJECTIVE_SENSE_DICT = {
56+
"minimize": 1,
57+
"minimise": 1,
58+
"maximize": -1,
59+
"maximise": -1,
60+
}
5161

5262
def __init__(
5363
self, inputs: xr.Dataset, math: CalliopeMath, build_config: config_schema.Build

tests/test_backend_general.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import xarray as xr
77

88
import calliope
9+
import calliope.backend
910

1011
from .common.util import build_test_model as build_model
1112
from .common.util import check_error_or_warning

tests/test_example_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ def _example_tester(solver="cbc", solver_io=None):
7171
model = request.getfixturevalue(request.param)
7272

7373
solve_kwargs = {"solver": solver}
74-
if solver_io:
75-
solve_kwargs["solver_io"] = solver_io
74+
solve_kwargs["solver_io"] = solver_io
7675

7776
model.solve(force=True, **solve_kwargs)
7877

@@ -480,6 +479,7 @@ def test_milp_example_results(self):
480479

481480
assert float(model.results.cost.sum()) == approx(540.780779)
482481

482+
@pytest.mark.time_intensive
483483
def test_operate_example_results(self):
484484
model = calliope.examples.operate(time_subset=["2005-07-01", "2005-07-04"])
485485

0 commit comments

Comments
 (0)