Skip to content

Commit d544d65

Browse files
authored
Merge pull request #917 from EnergySystemsModellingLab/make-v2.0.0-release
Add `CITATION.cff` and prepare for v2.0.0 release
2 parents 6c2a12f + bebeee5 commit d544d65

File tree

9 files changed

+130
-14
lines changed

9 files changed

+130
-14
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@
9191
"ideas",
9292
"doc"
9393
]
94+
},
95+
{
96+
"login": "Aurashk",
97+
"name": "Aurash Karimi",
98+
"avatar_url": "https://avatars.githubusercontent.com/u/9390150?v=4",
99+
"profile": "https://github.com/Aurashk",
100+
"contributions": [
101+
"code"
102+
]
94103
}
95104
],
96105
"contributorsPerLine": 7,

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,7 @@ repos:
6969
- id: codespell
7070
args: [--ignore-words, .codespell_ignore.txt]
7171
exclude: \.svg$
72+
- repo: https://github.com/citation-file-format/cffconvert
73+
rev: b6045d78aac9e02b039703b030588d54d53262ac
74+
hooks:
75+
- id: validate-cff

CITATION.cff

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
cff-version: 1.2.0
2+
message: |
3+
If you cite this software, please cite it as below.
4+
5+
This work was supported via the Climate Compatible Growth (CCG) programme and the EPSRC-funded
6+
HI-ACT project (EP/X038823/2). CCG is funded by UK Aid from the UK government. However, the views
7+
expressed herein do not necessarily reflect the UK government’s official policies.
8+
title: MUSE2
9+
version: 2.0.0
10+
date-released: 2025-10-13
11+
authors:
12+
- family-names: Dewar
13+
given-names: Alex
14+
orcid: https://orcid.org/0000-0002-2432-5964
15+
- family-names: Bland
16+
given-names: Tom
17+
orcid: https://orcid.org/0000-0001-6677-8817
18+
- family-names: Raja
19+
given-names: Sahil
20+
- family-names: Alonso Álvarez
21+
given-names: Diego
22+
orcid: https://orcid.org/0000-0002-0060-9495
23+
- family-names: D'Alessandro
24+
given-names: Adrian
25+
orcid: https://orcid.org/0009-0002-9503-5777
26+
- family-names: Smith
27+
given-names: Ryan
28+
orcid: https://orcid.org/0009-0007-7270-6853
29+
- family-names: Scharpf
30+
given-names: Benjamin
31+
- family-names: Karimi
32+
given-names: Aurash
33+
- family-names: Hawkes
34+
given-names: Adam
35+
orcid: https://orcid.org/0000-0001-9720-332X
36+
license: GPL-3.0-only
37+
repository-code: https://github.com/EnergySystemsModellingLab/MUSE2

Cargo.lock

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "muse2"
3-
version = "2.0.0-dev1"
3+
version = "2.0.0"
44
authors = ["Hawkes Research Group @ Chemical Engineering, Imperial College London <a.hawkes@imperial.ac.uk>", "Imperial College London RSE Team <ict-rse-team@imperial.ac.uk>"]
55
edition = "2024"
66
description = "A tool for running simulations of energy systems"
@@ -41,6 +41,7 @@ edit = "0.1.5"
4141
[dev-dependencies]
4242
map-macro = "0.3.0"
4343
rstest = {version = "0.26.1", default-features = false, features = ["crate-name"]}
44+
yaml-rust2 = {version = "0.10.4", default-features = false}
4445

4546
[build-dependencies]
4647
built = {version = "0.8.0", features = ["chrono", "git2"]}

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- markdownlint-disable MD041 -->
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55
[![Build and test](https://github.com/EnergySystemsModellingLab/MUSE2/actions/workflows/cargo-test.yml/badge.svg)](https://github.com/EnergySystemsModellingLab/MUSE2/actions/workflows/cargo-test.yml)
66
[![codecov](https://codecov.io/github/EnergySystemsModellingLab/MUSE2/graph/badge.svg?token=nV8gp1NCh8)](https://codecov.io/github/EnergySystemsModellingLab/MUSE2)
@@ -16,8 +16,13 @@ It is the successor to [MUSE], which is written in Python. It was developed foll
1616
MUSE to address a range of legacy issues that are challenging to address via upgrades to the
1717
existing MUSE framework, and to implement the framework in the high-performance Rust language.
1818

19-
:construction: **Please note that this code is under heavy development and is not yet suitable for
20-
end users. Watch this space!** :construction:
19+
Please note that MUSE2 currently only works with simple models and is not yet suitable for use in
20+
research.
21+
22+
To download the latest version of MUSE2 for your platform, please visit [the releases page].
23+
24+
[MUSE]: https://github.com/EnergySystemsModellingLab/MUSE_OS
25+
[the releases page]: https://github.com/EnergySystemsModellingLab/MUSE2/releases
2126

2227
## Model Overview
2328

@@ -34,7 +39,6 @@ foresight, reacting only to information available in the current time period. Th
3439
intertemporal optimisation modelling frameworks (such as [TIMES] and [MESSAGEix]) which have perfect
3540
foresight over the whole modelled time horizon.
3641

37-
[MUSE]: https://github.com/EnergySystemsModellingLab/MUSE_OS
3842
[Integrated Assessment Modelling]: https://unfccc.int/topics/mitigation/workstreams/response-measures/modelling-tools-to-assess-the-impact-of-the-implementation-of-response-measures/integrated-assessment-models-iams-and-energy-environment-economy-e3-models
3943
[TIMES]: https://iea-etsap.org/index.php/etsap-tools/model-generators/times
4044
[MESSAGEix]: https://docs.messageix.org/en/latest
@@ -68,6 +72,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
6872
<tr>
6973
<td align="center" valign="top" width="14.28%"><a href="https://github.com/HarmonicReflux"><img src="https://avatars.githubusercontent.com/u/16504600?v=4?s=100" width="100px;" alt="Benjamin Scharpf"/><br /><sub><b>Benjamin Scharpf</b></sub></a><br /><a href="https://github.com/EnergySystemsModellingLab/MUSE2/commits?author=HarmonicReflux" title="Code">💻</a></td>
7074
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ahawkes"><img src="https://avatars.githubusercontent.com/u/12055725?v=4?s=100" width="100px;" alt="Adam Hawkes"/><br /><sub><b>Adam Hawkes</b></sub></a><br /><a href="#ideas-ahawkes" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/EnergySystemsModellingLab/MUSE2/commits?author=ahawkes" title="Documentation">📖</a></td>
75+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Aurashk"><img src="https://avatars.githubusercontent.com/u/9390150?v=4?s=100" width="100px;" alt="Aurash Karimi"/><br /><sub><b>Aurash Karimi</b></sub></a><br /><a href="https://github.com/EnergySystemsModellingLab/MUSE2/commits?author=Aurashk" title="Code">💻</a></td>
7176
</tr>
7277
</tbody>
7378
<tfoot>

src/cli.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ pub fn run_cli() -> Result<()> {
115115
return Ok(());
116116
}
117117

118-
let Some(command) = cli.command else {
119-
// Output program help in markdown format
120-
let help_str = Cli::command().render_long_help().to_string();
121-
println!("{help_str}");
122-
return Ok(());
123-
};
118+
if let Some(command) = cli.command {
119+
command.execute()?;
120+
} else {
121+
// No command provided. Show help.
122+
Cli::command().print_long_help()?;
123+
}
124124

125-
command.execute()
125+
Ok(())
126126
}
127127

128128
/// Handle the `run` command.
@@ -166,6 +166,8 @@ pub fn handle_run_command(
166166
// Initialise program logger
167167
log::init(&settings.log_level, Some(output_path)).context("Failed to initialise logging.")?;
168168

169+
info!("Starting MUSE2 v{}", env!("CARGO_PKG_VERSION"));
170+
169171
// Load the model to run
170172
let (model, assets) = load_model(model_path).context("Failed to load model.")?;
171173
info!("Loaded model from {}", model_path.display());

src/cli/example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn handle_example_info_command(name: &str) -> Result<()> {
7171
.contents_utf8()
7272
.expect("README.txt is not UTF-8 encoded");
7373

74-
println!("{readme}");
74+
print!("{readme}");
7575

7676
Ok(())
7777
}

tests/citation_cff.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//! Check the CITATION.cff file
2+
use anyhow::{Context, Result};
3+
use std::fs;
4+
use yaml_rust2::{Yaml, YamlLoader};
5+
6+
fn get_version_from_citation_cff() -> Result<String> {
7+
let citation = fs::read_to_string("CITATION.cff")?;
8+
let yaml = YamlLoader::load_from_str(&citation)?;
9+
let yaml = yaml
10+
.iter()
11+
.next()
12+
.context("Empty YAML file")?
13+
.as_hash()
14+
.context("Not YAML object")?;
15+
let version = yaml
16+
.get(&Yaml::from_str("version"))
17+
.context("version key not found")?
18+
.as_str()
19+
.context("version should be string")?;
20+
21+
Ok(version.to_string())
22+
}
23+
24+
#[test]
25+
fn test_citation_cff_version() {
26+
assert_eq!(
27+
env!("CARGO_PKG_VERSION"),
28+
get_version_from_citation_cff().unwrap(),
29+
"Software version in Cargo.toml and CITATION.cff must match. If you are making a new \
30+
release, please also update the CITATION.cff file."
31+
)
32+
}

0 commit comments

Comments
 (0)