How to validate code#
You can interact with navground through C++, Python, and YAML. While C++ is statically typed and therefore the compiler helps to (partially) validate the code, we suggest to use the following tools to validate Python and YAML too.
Python#
Packages navground.core
and navground.sim
have type hints. For the pybind11 parts, we provide stub files, while Python code is fully annotated with types. Therefore you can use tools such as mypy, to check you code.
To check the packages themselves, you can run
$ mypy -p navground.core --strict
Success: no issues found in 19 source files
and
$ mypy -p navground.core --strict
Success: no issues found in 19 source files
To check your package, you can run
$ mypy <path>
YAML#
YAML representations in navground are compatible with JSON and we provide JSON-schemas to validate YAML. You can get the full schema of navground_{core|sim}
as a YAML string using
$ navground_py schema {core|sim}
...
To validate your YAML code, you can use any tool supporting JSON-schema, like command validate that uses python-jsonschema:
$ navground_py validate experiment install/share/navground_examples_yaml/experiment/cross.yaml
which will complain if the file does not corresponds to the schema of an experiment.