Ouster Developer Scripts¶
The Developer Scripts library (scripts/dev_script_library/) is the public,
cross-platform developer toolchain for the Ouster SDK. It is invoked through
the thin wrapper scripts/dev.py (or scripts/dev.sh on POSIX systems)
and exposes a structured Click CLI
organised into the command groups described below.
Note
Every command supports the --help flag. Run
python scripts/dev.py <group> <command> --help for the full option
listing of any individual command.
Environment variables follow the pattern
OSDK_DEV_CLI_<OPTION_NAME_UPPER_SNAKE> and can be used in place of any
CLI flag (e.g. OSDK_DEV_CLI_THREADS=8).
Prerequisites¶
Install the Python dependencies declared in scripts/requirements.txt
before using any Dev Script command:
$ python3 -m pip install -r scripts/requirements.txt
The dev.py entry-point will also auto-install missing dependencies on
first run, but only when a virtual environment is active. Outside a venv it
will print an error and exit rather than modifying the system Python.
Entry Point¶
# Linux / macOS
$ ./scripts/dev.sh <group> <command> [OPTIONS]
# Windows (PowerShell or Command Prompt)
> scripts\dev.bat <group> <command> [OPTIONS]
# Cross-platform (all platforms)
$ python scripts/dev.py <group> <command> [OPTIONS]
Top-level --help:
$ python scripts/dev.py --help
Shell Completion¶
The Dev Script CLI supports tab-completion for commands, sub-commands, and
options. Completion is powered by Click’s built-in machinery and calls back
into dev.py at completion time, so it is always in sync with the live
command tree — no regeneration needed when new commands are added.
The CLI detects completion callbacks early and skips all heavy initialisation (vcpkg probing, directory creation, etc.), so tab-completion is fast.
Bash¶
Add to ~/.bashrc (or ~/.bash_profile on macOS):
eval "$(_DEV_COMPLETE=bash_source <Path to dev.sh>)"
Then reload:
$ source ~/.bashrc
Zsh¶
Add to ~/.zshrc:
eval "$(_DEV_COMPLETE=zsh_source <Path to dev.sh>)"
Then reload:
$ source ~/.zshrc
Fish¶
Add to ~/.config/fish/config.fish:
_DEV_COMPLETE=fish_source <Path to dev.sh> | source
Then reload:
$ source ~/.config/fish/config.fish
PowerShell¶
PowerShell requires a static script (Click has no built-in PowerShell support). Generate it once and source it from your profile:
# Generate the script
python scripts/dev.py completions generate --shell powershell --output-dir ~
# Add to your $PROFILE (run once)
Add-Content $PROFILE ". $HOME\dev_completions.ps1"
Re-run completions generate --shell powershell after adding new commands.
Adjusting the invocation name¶
The eval snippets above assume a dev binary is on your PATH. If
you invoke the script directly, adjust the variable name to match:
# Invoked as: python scripts/dev.py
eval "$(_DEV_PY_COMPLETE=bash_source python scripts/dev.py)"
# Invoked as: ./scripts/dev.sh
eval "$(_DEV_SH_COMPLETE=bash_source ./scripts/dev.sh)"
Interactive setup instructions¶
The completions setup command prints the correct one-liner for your
current shell:
$ python scripts/dev.py completions setup
To generate static completion files for distribution:
$ python scripts/dev.py completions generate --shell bash
$ python scripts/dev.py completions generate --shell zsh
$ python scripts/dev.py completions generate --shell fish
$ python scripts/dev.py completions generate # all shells
Command Groups¶
build¶
Commands that compile SDK components or generate SDK documentation.
build cpp¶
Build the C++ SDK using CMake and vcpkg.
$ python scripts/dev.py build cpp [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Enable shared-library (package) build. |
|
|
Path to an alternative CMake binary. |
|
auto-detected |
Path to the vcpkg toolchain file. |
|
auto-detected |
vcpkg triplet (e.g. |
|
|
Use system libraries instead of vcpkg. |
|
|
Parallel build threads. |
|
|
CMake build type. |
|
|
Disable vcpkg manifest mode. |
|
|
Skip building examples. |
|
|
Skip building tests. |
|
artifacts dir |
Installation prefix for the built SDK. |
|
(multiple) |
Extra tokens forwarded to the CMake configure step. |
|
|
Enable build profiling (requires |
|
|
Instrument the build for code-coverage (Linux only). |
Examples
# Standard release build
$ python scripts/dev.py build cpp
# Debug build with system libraries
$ python scripts/dev.py build cpp --build-type Debug --use-system-libs
# Package build (shared library + CPack archive)
$ python scripts/dev.py build cpp --package --install-dir /tmp/sdk-install
# Pass extra CMake flags
$ python scripts/dev.py build cpp --cmake-arg -DBUILD_VIZ=OFF
build python¶
Build the Python SDK wheel or install it in editable mode.
$ python scripts/dev.py build python [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Build mode: install in-place or produce a |
|
auto-detected |
Path to the vcpkg toolchain file. |
|
auto-detected |
vcpkg triplet. |
|
|
Use system libraries instead of vcpkg. |
|
|
Parallel build threads. |
|
|
CMake build type. |
|
|
Disable vcpkg manifest mode. |
|
|
Enable build profiling. |
|
|
Enable coverage instrumentation (Linux only). |
|
|
Preserve build directories after building. |
Examples
# Editable install (fastest for development)
$ python scripts/dev.py build python
# Produce a distributable wheel
$ python scripts/dev.py build python --output-type wheel
build compile-commands¶
Generate compile_commands.json for IDE integration (clangd, etc.).
$ python scripts/dev.py build compile-commands [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Destination path for the generated file. |
|
|
Path to an alternative CMake binary. |
|
auto-detected |
Path to the vcpkg toolchain file. |
|
auto-detected |
vcpkg triplet. |
|
|
Use system libraries instead of vcpkg. |
|
|
Disable vcpkg manifest mode. |
|
|
Parallel build threads. |
build doxygen¶
Generate Doxygen HTML documentation and check for undocumented parameters.
$ python scripts/dev.py build doxygen [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Path to an alternative |
|
docs build dir |
Doxygen output directory. |
|
(none) |
Write parameter-direction warnings to this file. |
|
|
Do not fail on Doxygen warnings. |
|
output-dir/warning_log.log |
Path for the Doxygen warning log. |
|
|
Skip the inline |
Note
The CI-pinned Doxygen version is 1.11.0. Using a different version may produce different output.
Warning
This command is not supported on Windows. Running it on Windows will
exit immediately with the error not supported on windows yet.
Examples
$ python scripts/dev.py build doxygen
$ python scripts/dev.py build doxygen --no-werror --output-dir /tmp/doxy
build docs¶
Generate the full SDK documentation site (Sphinx + Doxygen) for a given
version. This command is provided by the sdk-extensions plugin
(dev_docs_sdkx.py) and is only available when the sdk-extensions
submodule is present.
$ python scripts/dev.py build docs [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Version label to embed in the generated docs (e.g. |
|
|
Directory where the generated HTML is written. |
|
|
Skip C++ API generation (Doxygen, Exhale, Breathe). |
|
|
Skip Python API generation ( |
|
|
Skip |
Warning
This command is not supported on Windows. Running it on Windows will
exit immediately with the error not supported on windows yet.
Examples
$ python scripts/dev.py build docs --version latest --html-destination-dir artifacts
$ python scripts/dev.py build docs --version 0.16.0 --no-python-build
test¶
Commands that execute test suites.
test cpp¶
Run the C++ test suite via ctest.
$ python scripts/dev.py test cpp [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Parallel test threads passed to |
|
cmake build dir |
Run |
|
|
Run tests against the shared-library build. |
|
(none) |
Path to the shared libraries used when |
|
|
Path to an alternative |
|
|
Build configuration to test. |
Examples
$ python scripts/dev.py test cpp
$ python scripts/dev.py test cpp --threads 4 --build-type Debug
test python¶
Run the Python test suite via pytest.
$ python scripts/dev.py test python [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
env: TEST_DATA_DIR |
Directory containing test data for integration tests. |
|
|
Parallel pytest workers ( |
|
|
Skip integration tests even when |
Examples
$ python scripts/dev.py test python
$ python scripts/dev.py test python --test-data-dir /data/sdk-test-data
test self-tests¶
Run the Dev Script library’s own unit tests (scripts/dev_script_tests/).
$ python scripts/dev.py test self-tests [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Parallel pytest workers. |
Examples
$ python scripts/dev.py test self-tests
$ python scripts/dev.py test self-tests --threads 1
test docs¶
Run documentation tests (CLI pytest and optional C++/Python snippet tests).
This command is provided by the sdk-extensions plugin (dev_docs_tests.py)
and is only available when the sdk-extensions submodule is present.
$ python scripts/dev.py test docs [OPTIONS]
Examples
$ python scripts/dev.py test docs --no-cpp-api --no-python-api
lint¶
Commands that enforce code quality.
lint flake8¶
Run the flake8 Python linter over the SDK source tree.
$ python scripts/dev.py lint flake8 [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Alternative flake8 configuration file. |
|
(stdout) |
Write results in JUnit-XML format to this file. |
lint mypy¶
Run the mypy static type checker over the SDK source tree.
$ python scripts/dev.py lint mypy [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
(stdout) |
Write results in JUnit-XML format to this file. |
lint mypy-stubs¶
Validate the mypy stub file for the C++ bindings module.
$ python scripts/dev.py lint mypy-stubs
lint clang-format¶
Run clang-format over all tracked C/C++ source files.
$ python scripts/dev.py lint clang-format [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Path to an alternative |
|
|
Apply automatic formatting fixes (prompts for confirmation). |
|
(all cores) |
Parallel formatting threads. |
lint clang-tidy¶
Run clang-tidy (or clangd-tidy) static analysis over C++ sources.
$ python scripts/dev.py lint clang-tidy [OPTIONS] [PATHS]...
Options
Option |
Default |
Description |
|---|---|---|
|
auto-detected |
Path to |
|
|
Used when |
|
|
Apply automatic fixes (requires confirmation). |
|
build dir |
Write raw tidy output to this file. |
|
build dir |
Write structured JSON output to this file. |
|
build dir |
Write a summary JSON (issue category counts) to this file. |
|
build dir |
Write per-check timing data ( |
|
|
Suppress stdout diagnostic messages. |
|
|
Path to an alternative CMake binary. |
|
auto-detected |
Path to the vcpkg toolchain file. |
|
auto-detected |
vcpkg triplet. |
|
|
Use system libraries instead of vcpkg. |
|
|
Parallel analysis threads. |
|
|
Disable vcpkg manifest mode. |
|
(none) |
Git ref (e.g. |
|
all ouster_* dirs |
One or more files or directories to analyse. |
Examples
# Analyse the whole SDK
$ python scripts/dev.py lint clang-tidy
# Checkin gate: only fail on new warnings relative to develop
$ python scripts/dev.py lint clang-tidy --diff-against origin/develop
# Analyse a single file
$ python scripts/dev.py lint clang-tidy ouster_core/src/types.cpp
lint check-cpp-exports¶
Verify that every public C++ symbol in the shared-library headers carries the
correct OUSTER_API_CLASS / OUSTER_API_FUNCTION annotation.
$ python scripts/dev.py lint check-cpp-exports [OPTIONS] [PATHS]...
Options (same vcpkg / cmake flags as lint clang-tidy plus):
Option |
Default |
Description |
|---|---|---|
|
|
Print each processed file. |
|
all public include dirs |
Header directories or files to check. |
lint infer-cpp-static-analysis¶
Run Facebook Infer static analysis over the C++ sources.
$ python scripts/dev.py lint infer-cpp-static-analysis [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Path to the |
|
artifacts dir |
Directory for the |
|
|
Path to an alternative CMake binary. |
|
auto-detected |
Path to the vcpkg toolchain file. |
|
auto-detected |
vcpkg triplet. |
|
|
Use system libraries instead of vcpkg. |
|
|
Parallel analysis threads. |
|
|
Disable vcpkg manifest mode. |
lint python-ignores¶
Audit # type: ignore and # noqa suppression comments in the Python
source tree and emit a JSON report.
$ python scripts/dev.py lint python-ignores [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Suppress JSON output to stdout. |
|
cwd |
Directory for the output file. |
|
|
Output filename. |
cleanup¶
Commands that remove generated artefacts.
cleanup build¶
Remove the CMake and Python build directories.
$ python scripts/dev.py cleanup build
cleanup artifacts¶
Remove the SDK artifacts directory.
$ python scripts/dev.py cleanup artifacts
cleanup all¶
Remove all directories created by the Dev Script context: build,
artifacts, and the persistent vcpkg directory (~/.osdkv2 by default).
$ python scripts/dev.py cleanup all
utils¶
Utility commands for setting up the development environment.
utils enable-local-vcpkg¶
Clone and bootstrap a local vcpkg repository under ~/.osdkv2/vcpkg.
$ python scripts/dev.py utils enable-local-vcpkg [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Delete the existing vcpkg directory and re-clone from scratch. |
utils install-system-packages¶
Install the system-level C++ build dependencies using the platform package
manager (apt-get on Debian/Ubuntu, brew on macOS).
$ python scripts/dev.py utils install-system-packages [OPTIONS]
Options
Option |
Default |
Description |
|---|---|---|
|
|
Also install Doxygen 1.11.0. |
|
|
Also install |
utils install-vcpkg-package-requirements¶
Install the OS-level packages required by vcpkg itself (e.g. flex,
bison, libxinerama-dev on Ubuntu).
$ python scripts/dev.py utils install-vcpkg-package-requirements
Note
This command is a no-op on Windows; vcpkg has no additional system dependencies there.
Library Internals¶
The following modules are consumed by the commands above. They are not intended to be called directly by end-users but are documented here for contributors.
build_libs.py¶
Core helper classes shared by all commands:
RunCommand – thin wrapper around
subprocess.Popenwith timing, TTY-passthrough, and error-propagation support.Python – manages a
venvand delegates touv pipfor fast, reproducible dependency installation.CMake – drives CMake configure / build / install / package steps.
Doxygen – generates and validates Doxygen output from a template
Doxyfile.ClangThrowMap – walks a C++ AST to map functions to the exception types they throw.
Standalone helper functions:
check_for_python_lib(lib)– assert a Python package is importable.check_for_tool(tool)– assert a binary is onPATH.parse_version(sdk_path)– read the SDK version fromCMakeLists.txt.initialize_vcpkg(vcpkg_dir)– clone / update the vcpkg repository.generate_compile_commands(...)– producecompile_commands.json.perf_json_combine(jsons, output)– merge Chrome-trace JSON files.get_env_from_sourced_shell(script)– capture the environment exported by a shell script.
context.py¶
ClickContext is the shared state object passed through the Click context
(ctx.obj) to every command. It exposes:
Computed paths:
sdk_dir,cmake_build_dir,docs_build_dir,python_build_dir,sdk_artifact_dir,vcpkg_dir.BuildOptions – centralises vcpkg / CMake argument processing and auto-detects the correct vcpkg triplet for the current platform.
add_module(file)– dynamically load a Dev Script plugin module.finalize()– callfinalize()on all loaded plugins.
Environment Variables¶
The following environment variables influence Dev Script behaviour:
Variable |
Description |
|---|---|
|
Override the default persistent directory ( |
|
Fallback vcpkg root when |
|
Binary caching source string forwarded to CMake. |
|
Default test-data directory for |
|
When set and |
|
Any CLI option can be set via this pattern
(e.g. |
Running the Self-Tests¶
The Dev Script library ships its own test suite under
scripts/dev_script_tests/. Run it with:
$ python scripts/dev.py test self-tests
Or directly with pytest:
$ python -m pytest scripts/dev_script_tests/ -v
Adding a New Command¶
Create a new module
scripts/dev_script_library/dev_<feature>.py.Define your Click commands and implement
import_module(click_context)to register them on the appropriate group (click_context.build_group,click_context.lint_group, etc.).Implement a no-op
finalize(click_context)function.Register the module in
scripts/dev.pyviactx.add_module(...).Add corresponding tests under
scripts/dev_script_tests/.Document the new command in this file.