gitronics 0.5.6__tar.gz → 0.5.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitronics-0.5.6 → gitronics-0.5.7}/Cargo.lock +27 -1
- {gitronics-0.5.6 → gitronics-0.5.7}/Cargo.toml +2 -1
- {gitronics-0.5.6 → gitronics-0.5.7}/PKG-INFO +1 -1
- {gitronics-0.5.6 → gitronics-0.5.7}/src/build_model.rs +19 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/project_manager.rs +5 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/tests/test_example_project.rs +41 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/.github/workflows/ci.yml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/.github/workflows/docs.yml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/.github/workflows/release.yml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/.gitignore +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/LICENSE +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/README.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/assets/logo.png +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/best-practices.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/changelog.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/examples.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/getting-started.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/index.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/installation.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/requirements.txt +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/usage/build.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/usage/configuration.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/docs/usage/migrate.md +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/assessment_specific/filler_model_3.mcnp +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/assessment_specific/filler_model_3.metadata +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/assessment_specific/small_override.yaml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/configurations/valid_configuration.yaml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/output/.gitignore +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/fine_mesh.tally +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/materials.mat +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/my_transform.transform +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/volumetric_source.source +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/envelope_structure.mcnp +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/envelope_structure.metadata +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/filler_models/filler_model_1.mcnp +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/filler_models/filler_model_1.metadata +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/filler_models/filler_model_2.mcnp +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/filler_models/filler_model_2.metadata +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/mkdocs.yml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/pyproject.toml +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/python/gitronics/__init__.py +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/python/tests/test_cli_works.py +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/resources/simple_model.mcnp +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/cli.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/lib.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/main.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/migrate_model.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/model_config.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/project_manager/load_metadata.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/project_manager/load_model_config.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/project_manager/load_project_files.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/python.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/types.rs +0 -0
- {gitronics-0.5.6 → gitronics-0.5.7}/src/utils.rs +0 -0
|
@@ -390,7 +390,7 @@ dependencies = [
|
|
|
390
390
|
|
|
391
391
|
[[package]]
|
|
392
392
|
name = "gitronics"
|
|
393
|
-
version = "0.5.
|
|
393
|
+
version = "0.5.7"
|
|
394
394
|
dependencies = [
|
|
395
395
|
"chrono",
|
|
396
396
|
"clap",
|
|
@@ -399,6 +399,7 @@ dependencies = [
|
|
|
399
399
|
"git2",
|
|
400
400
|
"indexmap",
|
|
401
401
|
"log",
|
|
402
|
+
"logtest",
|
|
402
403
|
"migjorn",
|
|
403
404
|
"pyo3",
|
|
404
405
|
"rayon",
|
|
@@ -550,6 +551,12 @@ dependencies = [
|
|
|
550
551
|
"wasm-bindgen",
|
|
551
552
|
]
|
|
552
553
|
|
|
554
|
+
[[package]]
|
|
555
|
+
name = "lazy_static"
|
|
556
|
+
version = "1.5.0"
|
|
557
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
558
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
559
|
+
|
|
553
560
|
[[package]]
|
|
554
561
|
name = "leb128fmt"
|
|
555
562
|
version = "0.1.0"
|
|
@@ -597,6 +604,19 @@ name = "log"
|
|
|
597
604
|
version = "0.4.29"
|
|
598
605
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
599
606
|
checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
|
|
607
|
+
dependencies = [
|
|
608
|
+
"value-bag",
|
|
609
|
+
]
|
|
610
|
+
|
|
611
|
+
[[package]]
|
|
612
|
+
name = "logtest"
|
|
613
|
+
version = "2.0.0"
|
|
614
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
615
|
+
checksum = "eb3e43a8657c1d64516dcc9db8ca03826a4aceaf89d5ce1b37b59f6ff0e43026"
|
|
616
|
+
dependencies = [
|
|
617
|
+
"lazy_static",
|
|
618
|
+
"log",
|
|
619
|
+
]
|
|
600
620
|
|
|
601
621
|
[[package]]
|
|
602
622
|
name = "memchr"
|
|
@@ -1031,6 +1051,12 @@ version = "0.2.2"
|
|
|
1031
1051
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1032
1052
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
|
1033
1053
|
|
|
1054
|
+
[[package]]
|
|
1055
|
+
name = "value-bag"
|
|
1056
|
+
version = "1.12.0"
|
|
1057
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1058
|
+
checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
|
|
1059
|
+
|
|
1034
1060
|
[[package]]
|
|
1035
1061
|
name = "vcpkg"
|
|
1036
1062
|
version = "0.2.15"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "gitronics"
|
|
3
|
-
version = "0.5.
|
|
3
|
+
version = "0.5.7"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
description = "Build MCNP neutronics models from modular components"
|
|
6
6
|
license = "EUPL-1.2"
|
|
@@ -33,3 +33,4 @@ dunce = "1.0.5"
|
|
|
33
33
|
|
|
34
34
|
[dev-dependencies]
|
|
35
35
|
tempfile = "3.0"
|
|
36
|
+
logtest = "2.0"
|
|
@@ -6,6 +6,7 @@ use git2::Repository;
|
|
|
6
6
|
use log::{info, warn};
|
|
7
7
|
use migjorn::{Card, CellCard, CellParam, DataCard, Model, ParamType};
|
|
8
8
|
use regex::Regex;
|
|
9
|
+
use std::collections::HashSet;
|
|
9
10
|
use std::{collections::HashMap, path::Path, sync::LazyLock};
|
|
10
11
|
use std::{env, fs};
|
|
11
12
|
|
|
@@ -82,6 +83,9 @@ fn add_fill_cards_to_envelopes(
|
|
|
82
83
|
universe_ids: &HashMap<FillerName, UniverseId>,
|
|
83
84
|
envelope_structure: &mut Model,
|
|
84
85
|
) -> Result<(), GitronicsError> {
|
|
86
|
+
let mut missing_envelopes_in_file: HashSet<EnvelopeName> =
|
|
87
|
+
project_manager.envelopes_in_config().cloned().collect();
|
|
88
|
+
|
|
85
89
|
for cell in envelope_structure.cells.iter_mut() {
|
|
86
90
|
let original_text = cell.original_text();
|
|
87
91
|
let Some(caps) = ENVELOPE_RE.captures(original_text) else {
|
|
@@ -105,6 +109,9 @@ fn add_fill_cards_to_envelopes(
|
|
|
105
109
|
continue;
|
|
106
110
|
};
|
|
107
111
|
|
|
112
|
+
// Remove the envelope from the set of missing envelopes, as we have found it in the file
|
|
113
|
+
missing_envelopes_in_file.remove(&envelope_name);
|
|
114
|
+
|
|
108
115
|
// Envelope explicitly set to null in config, so we skip it
|
|
109
116
|
let Some(filler_name) = env_config.as_ref() else {
|
|
110
117
|
continue;
|
|
@@ -129,6 +136,18 @@ fn add_fill_cards_to_envelopes(
|
|
|
129
136
|
.map_err(|e| GitronicsError::InvalidFillCard(fill_card_text, e.to_string()))?,
|
|
130
137
|
);
|
|
131
138
|
}
|
|
139
|
+
|
|
140
|
+
if !missing_envelopes_in_file.is_empty() {
|
|
141
|
+
warn!(
|
|
142
|
+
"The following envelopes were defined in the configuration file but not found in the envelope structure file: {}. \
|
|
143
|
+
Please check that the `$ @env:envelope_name` pattern is satisfied.",
|
|
144
|
+
missing_envelopes_in_file
|
|
145
|
+
.into_iter()
|
|
146
|
+
.map(|e| e.to_string())
|
|
147
|
+
.collect::<Vec<_>>()
|
|
148
|
+
.join(", ")
|
|
149
|
+
);
|
|
150
|
+
}
|
|
132
151
|
Ok(())
|
|
133
152
|
}
|
|
134
153
|
|
|
@@ -85,6 +85,11 @@ impl ProjectManager {
|
|
|
85
85
|
.get(envelope_name)
|
|
86
86
|
.and_then(|opt| opt.as_deref()))
|
|
87
87
|
}
|
|
88
|
+
|
|
89
|
+
/// Returns an iterator over the envelope names defined in the configuration.
|
|
90
|
+
pub fn envelopes_in_config(&self) -> impl Iterator<Item = &EnvelopeName> {
|
|
91
|
+
self.model_config.envelopes().keys()
|
|
92
|
+
}
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
/// Indexes project files using roots resolved from a loaded configuration.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
use gitronics::build_model;
|
|
2
|
+
use log::Level;
|
|
3
|
+
use logtest::Logger;
|
|
2
4
|
use std::fs;
|
|
3
5
|
use std::path::{Path, PathBuf};
|
|
4
6
|
use tempfile::tempdir;
|
|
@@ -246,3 +248,42 @@ fn test_filler_first_cell_without_universe_id() {
|
|
|
246
248
|
let msg = result.unwrap_err().to_string();
|
|
247
249
|
assert!(msg.contains("No universe ID found in first cell of filler model"));
|
|
248
250
|
}
|
|
251
|
+
|
|
252
|
+
#[test]
|
|
253
|
+
fn test_envelopes_in_config_that_dont_exist() {
|
|
254
|
+
let mut logger = Logger::start();
|
|
255
|
+
let dir = tempdir().unwrap();
|
|
256
|
+
let example_project_path = PathBuf::from("example_project/");
|
|
257
|
+
copy_dir(&example_project_path, dir.path()).unwrap();
|
|
258
|
+
|
|
259
|
+
fs::write(
|
|
260
|
+
dir.path().join("configurations/valid_configuration.yaml"),
|
|
261
|
+
"project_roots: [..]
|
|
262
|
+
overrides: null
|
|
263
|
+
|
|
264
|
+
envelope_structure: envelope_structure
|
|
265
|
+
source: volumetric_source
|
|
266
|
+
materials: [materials]
|
|
267
|
+
transformations: [my_transform]
|
|
268
|
+
tallies: [fine_mesh]
|
|
269
|
+
envelopes:
|
|
270
|
+
my_envelope_name_1: filler_model_1
|
|
271
|
+
wrong_envelope_name: filler_model_2
|
|
272
|
+
",
|
|
273
|
+
)
|
|
274
|
+
.unwrap();
|
|
275
|
+
|
|
276
|
+
build_model(
|
|
277
|
+
&dir.path().join("configurations/valid_configuration.yaml"),
|
|
278
|
+
dir.path().join("out").as_path(),
|
|
279
|
+
)
|
|
280
|
+
.unwrap();
|
|
281
|
+
|
|
282
|
+
let warn_message = "The following envelopes were defined in the configuration file but not found in the envelope structure file";
|
|
283
|
+
|
|
284
|
+
assert!(
|
|
285
|
+
logger.any(|record| {
|
|
286
|
+
record.level() == Level::Warn && record.args().contains(warn_message)
|
|
287
|
+
})
|
|
288
|
+
);
|
|
289
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gitronics-0.5.6 → gitronics-0.5.7}/example_project/assessment_specific/filler_model_3.metadata
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/fine_mesh.tally
RENAMED
|
File without changes
|
{gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/data_cards/materials.mat
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gitronics-0.5.6 → gitronics-0.5.7}/example_project/reference_model/envelope_structure.metadata
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|