Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core Rework ⚠️ BREAKING CHANGES #382

Merged
merged 22 commits into from
Aug 20, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/buildcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ jobs:
run: |
pip install cyclonedds
cd tests/ddsidl
vspec export ddsidl -u ../vspec/test_units.yaml -s test.vspec -o test.idl
vspec export ddsidl -u ../vspec/test_units.yaml -s test.vspec -o test.idl -q ../vspec/test_quantities.yaml
idlc -l py test.idl
grep -i A.String A/_test.py
2 changes: 1 addition & 1 deletion .github/workflows/check-header.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Get changed files
run: |
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep -v '^obsolete' | tr '\n' ',')" >> $GITHUB_ENV
echo "files=$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} | grep -v '^obsolete' | grep '^tests/.*\.py' |tr '\n' ',')" >> $GITHUB_ENV

- uses: ./.github/actions/verify-headers
with:
Expand Down
80 changes: 80 additions & 0 deletions docs/tree.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Tree Exporter

The `tree` exporter wraps [Anytree RenderTree](https://anytree.readthedocs.io/en/latest/api/anytree.render.html#anytree.render.RenderTree).
Additionally it can include information you are interested in of the `VSSData` of every node.
By default, the rendered tree will only print node names.
The output file specified via `--output/-o` will be a simple text file containing the rendered tree.

Example:
```yaml
Vehicle:
type: branch
description: Vehicle

Vehicle.Door:
type: branch
description: Door
instances:
- Row[1,2]
- Column[1,2]

Vehicle.Door.Row1.Column1:
custom: foo
```

Result:
```
Vehicle
└── Door
├── Row1
│ ├── Column1
│ └── Column2
└── Row2
├── Column1
└── Column2
```

If we also want to see the `description` of every node we can pass `--attr description`.

Result:
```
Vehicle
description='Vehicle'
└── Door
description='Door'
├── Row1
│ description='Door'
│ ├── Column1
│ │ description='Door'
│ └── Column2
│ description='Door'
└── Row2
description='Door'
├── Column1
│ description='Door'
└── Column2
description='Door'
```

If we also want to show the custom attribute `custom` we can add another `-a custom`.

Result:
```
Vehicle
description='Vehicle'
└── Door
description='Door'
├── Row1
│ description='Door'
│ ├── Column1
│ │ description='Door'
│ │ custom='foo'
│ └── Column2
│ description='Door'
└── Row2
description='Door'
├── Column1
│ description='Door'
└── Column2
description='Door'
```
8 changes: 8 additions & 0 deletions docs/vspec.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ vspec export --help
│ jsonschema Export as a jsonschema. │
│ protobuf Export as protobuf. │
│ yaml Export as YAML. │
│ tree Export as Tree. │
sschleemilch marked this conversation as resolved.
Show resolved Hide resolved
╰────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

Expand All @@ -41,6 +42,13 @@ vspec export json --vspec spec/VehicleSignalSpecification.vspec --output vss.jso
INFO Serializing compact JSON... vss2json.py:148

```
## Exporter docs

- [tree](./tree.md)
- [ddsidl](./ddsidl.md)
- [graphql](./graphql.md)
- [id](./id.md)
- [protobuf](./protobuf.md)

## Argument Explanations

Expand Down
204 changes: 169 additions & 35 deletions poetry.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ rdflib = "^6.0.0"
importlib-metadata = "^7.0"
click = "^8.1.7"
rich-click = "^1.8.3"
pydantic = "^2.8.2"

[tool.poetry.group.dev.dependencies]
mypy = "*"
Expand All @@ -30,8 +31,11 @@ pre-commit = "*"


[tool.poetry.scripts]
vspec = "vss_tools.vspec.vspec:cli"
vspec = "vss_tools.vspec.cli:cli"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.mypy]
disable_error_code = "import-untyped"
Loading