Feat/diff - #521
Conversation
There was a problem hiding this comment.
It is in "exporters" folder but it is not an exporter, or?
There was a problem hiding this comment.
Good catch, I've just moved it to the parent directory.
| |---|---|---| | ||
| | `model_snapshot.vspec` | The full model tree | Yes | | ||
| | `structs_snapshot.vspec` | Custom struct type definitions | Only when `--types` is given | | ||
| | `units_snapshot.yaml` | Resolved units | Only when units are provided | |
There was a problem hiding this comment.
A bit unsure on how to interpret "Only when units are provided". File also produced when using default unit file, see example below
.venv-vss) erik@vbox:~/vehicle_signal_specification$ vspec compose -s spec/VehicleSignalSpecification.vspec -o tmp
[15:06:58] INFO Loaded 'VSSQuantity', file=/home/erik/vehicle_signal_specification/spec/quantities.yaml, elements=30 units_quantities.py:34
INFO Loaded 'VSSUnit', file=/home/erik/vehicle_signal_specification/spec/units.yaml, elements=69 units_quantities.py:34
INFO VSpecs loaded, amount=91 vspec.py:130
[15:06:59] INFO Composing vspec model into tmp... compose.py:124
INFO VSpecs loaded, amount=91 vspec.py:130
INFO Signal tree written to tmp/model_snapshot.vspec compose.py:135
INFO Loaded 'VSSUnit', file=/home/erik/vehicle_signal_specification/spec/units.yaml, elements=69 units_quantities.py:34
INFO Units written to tmp/units_snapshot.yaml compose.py:160
INFO Loaded 'VSSQuantity', file=/home/erik/vehicle_signal_specification/spec/quantities.yaml, elements=30 units_quantities.py:34
INFO Quantities written to tmp/quantities_snapshot.yaml
There was a problem hiding this comment.
True. The reason for that is because the vss-tools have a fallback behavior if no units or quantity are explicitly passed. They read the default expected location for units and quantities. I updated the docs.
|
MoM:
|
| @click.group(context_settings={"auto_envvar_prefix": "vss_tools"}, invoke_without_command=True) | ||
| @click.group( | ||
| cls=LazyGroup, | ||
| lazy_subcommands={ |
There was a problem hiding this comment.
I don't think we need the lazy annotations here. Just make the commands "normal" ones by using @cli.command annotations for them
| # output remains a valid, re-parseable vspec. | ||
| SNAPSHOT_EXCLUDE_FIELDS = ["delete", "fqn", "is_instance"] | ||
|
|
||
| MODEL_SNAPSHOT_FILENAME = "model_snapshot.vspec" |
There was a problem hiding this comment.
I would get rid of _snapshot
| QUANTITIES_SNAPSHOT_FILENAME = "quantities_snapshot.yaml" | ||
|
|
||
|
|
||
| def _filter_raw_node(attrs: dict[str, Any], exclude_fields: list[str]) -> dict[str, Any]: |
There was a problem hiding this comment.
|
|
||
|
|
||
| def load_flat_yaml(path: Path) -> dict[str, Any]: | ||
| """Load a flat snapshot YAML file. Returns empty dict when file is absent.""" |
| out_text = json.dumps(result, indent=2, ensure_ascii=False) | ||
|
|
||
| if output: | ||
| output.write_text(out_text, encoding="utf-8") |
There was a problem hiding this comment.
shouldn't we do a json.dump here?
|
MoM:
|
|
|
||
| ## What it does | ||
|
|
||
| A vspec model is typically spread across many files: a main `.vspec`, optional `#include` files, overlays, a units file, and a quantities file. `vspec compose` collapses all of that into a single **self-contained folder** (a _snapshot_) that any downstream `vspec export` command can consume without needing the original source tree. |
There was a problem hiding this comment.
Maybe worth stating the differences compared to the "vspec export yaml" command, because they have some similarities, right? Like long term, do we need both?
|
MoM:
|
|
MoM:
|
|
COnflicts |
|
Any updates on the status of this one @jdacoello |
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…itities Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
…irst-run mode support Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
… logic Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
|
What is the current status @jdacoello |
|
MoM:
|
Signed-off-by: JD Alvarez <8550265+jdacoello@users.noreply.github.com>
It implements two main things:
composecommand to take a snapshot of the model to persist a stand alone immutable statediffcommand to compare and report the differences between two snapshots