vyra_base package

Subpackages

Module contents

vyra_base.extract_interfaces(target_path)[Quellcode]

Copy VYRA interface config files and build files from the pip-installed library.

Only copies JSON/YAML/XML metadata files from the config/ directory and the ROS2 build scaffolding files (package.xml, CMakeLists.template.txt).

Interface files (.msg, .srv, .action, .proto) are NOT copied — they are generated on demand by InterfaceGenerator (interfaces/tools/generate_interfaces.py) from the config metadata.

Parameter:

target_path (str | Path) – Path to the target interface package directory.

Rückgabe:

None

Rückgabetyp:

None

vyra_base.get_reserved_list()[Quellcode]

Get the list of reserved usernames.

Rückgabe:

List of reserved usernames.

Rückgabetyp:

dict[str, Any]

vyra_base.get_vyra_base_config_files()[Quellcode]

Return the set of config file names shipped with vyra_base.

Used by setup_interfaces.py to distinguish module-specific config files (which must be validated against the RESERVED list) from files that were copied from vyra_base itself.

Rückgabe:

Set of file names (basename only) present in the vyra_base interfaces/config/ directory.

Rückgabetyp:

set[str]

vyra_base.validate_config_schema(config_files, schema_path=None)[Quellcode]

Validate interface config JSON files against the VYRA interface_config.json schema.

Each file in config_files is loaded as JSON and validated against the bundled assets/schemas/interface_config.json schema (or a custom schema_path). Files that are not valid JSON or fail schema validation are collected in the invalid_files return value so the caller can log warnings and exclude them from interface generation.

Requires the jsonschema package (automatically installed as a vyra_base dependency). If jsonschema is unexpectedly missing the function logs a warning and returns all files as valid so the build pipeline continues without interruption.

Example usage in setup_interfaces.py:

import vyra_base
valid, invalid = vyra_base.validate_config_schema(
    list(config_path.glob("*_meta.json"))
)
for bad_file, reason in invalid:
    logging.warning("Schema violation in %s: %s", bad_file.name, reason)
Parameter:
  • config_files (list) – Iterable of pathlib.Path objects (or path strings) pointing to *_meta.json files to validate.

  • schema_path (Path | None) – Path to a custom JSON Schema file. When None the bundled schema at vyra_base/assets/schemas/interface_config.json is used automatically.

Rückgabe:

A two-element tuple (valid_files, invalid_files) where valid_files is the subset of config_files that passed validation and invalid_files is a list of (Path, reason: str) pairs for every file that failed.

Rückgabetyp:

tuple[list[Path], list[tuple[Path, str]]]