-
Notifications
You must be signed in to change notification settings - Fork 373
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
API examples overhaul & roundtrip tests #3204
Changes from 13 commits
af1e87d
bc4a39e
a09a24a
92722cd
d7e5197
02b3301
68590be
6ab75ee
29eaa41
824248c
3ef82c8
cf8c513
06f10da
0841efa
bd54ea9
b4d608e
3d6ebc5
101fea7
41660ac
b04f8a8
fa9d2d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ screenshot*.png | |
web_demo | ||
|
||
.nox/ | ||
out.rrd | ||
*.rrd |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
|
||
# Setup builds for examples | ||
file(GLOB sources_list true ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) | ||
|
||
add_custom_target(doc_examples) | ||
|
||
foreach(SOURCE_PATH ${sources_list}) | ||
get_filename_component(SOURCE_NAME ${SOURCE_PATH} NAME_WLE) | ||
|
||
if(${SOURCE_NAME} STREQUAL "CMakeFiles") | ||
CONTINUE() | ||
endif() | ||
|
||
set(EXAMPLE_TARGET doc_example_${SOURCE_NAME}) | ||
|
||
add_executable(${EXAMPLE_TARGET} ${SOURCE_PATH}) | ||
|
||
set_default_warning_settings(rerun_example) | ||
target_link_libraries(${EXAMPLE_TARGET} PRIVATE rerun_sdk) | ||
|
||
add_dependencies(doc_examples ${EXAMPLE_TARGET}) | ||
endforeach() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# API Examples | ||
|
||
These examples showcase common usage of each individual Rerun `Archetype`s. | ||
teh-cmc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Most of these example are automatically used as docstrings for the `Archetype` APIs in their respective SDKs. | ||
teh-cmc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Usage | ||
|
||
You can run each example individually using the following: | ||
|
||
- **Python**: `python <example_name>.py`, e.g. `python point3d_random.py`. | ||
- **Rust**: `cargo r -p code_examples --bin <example_name`, e.g. | ||
teh-cmc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
`cargo r -p code_examples --bin point3d_random`. | ||
- **C++**: | ||
- `./docs/code-examples/build_all.sh` to compile all examples | ||
- start a Rerun Viewer listening on the default port: `rerun` | ||
- `./build/docs/code-examples/doc_example_<example_name>` to run, e.g. `./build/docs/code-examples/doc_example_point3d_random` | ||
teh-cmc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
teh-cmc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## Roundtrips | ||
|
||
All API examples support cross-language roundtrip tests. | ||
|
||
These tests check that A) all of our SDKs yield the exact same data when used the same way and B) act as regression tests, relying on the fact that it is extremely unlikely that all supported languages break in the exact same way at the exact same time. | ||
|
||
See `./docs/code-examples/roundtrips.py --help`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙈
Really all of our sink APIs should uniformly return a
RecordingStreamResult
. Having connect actually fail if it can't talk to the server with an option for our current "keep retrying in a background thread" behavior would be a more predictable user experience.