Skip to content

Commit

Permalink
Python SDK (#18)
Browse files Browse the repository at this point in the history
* Add crates/re_sdk_comms

* Initial Python SDK

* Bug fix: handle 2D scenes with zero-size bounding box

* Implement logging of OpenCV images

* Fix cargo build on Mac

* Create a python library wrapping the rust python sdk

* cleanup

* cargo deny: add "Apache-2.0 WITH LLVM-exception"

* Add CI step for maturin

* Move test.py

* Fix connection problem

* Fix .vscode/launch.json after recent package renaming

* Even more clippy lints

* tweaks
  • Loading branch information
emilk authored Jul 26, 2022
1 parent 9231b9d commit b96d7b6
Show file tree
Hide file tree
Showing 32 changed files with 879 additions and 76 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,70 @@ jobs:
- run: rustup target add wasm32-unknown-unknown
- run: ./crates/re_viewer/setup_web.sh
- run: ./crates/re_viewer/wasm_bindgen_check.sh

maturin-linux:
name: Maturin Linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: messense/maturin-action@v1
with:
manylinux: auto
maturin-version: "0.12.20"
command: build
args: -m crates/re_sdk_python/Cargo.toml --release -o dist
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

maturin-windows:
name: Maturin Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: messense/maturin-action@v1
with:
maturin-version: "0.12.20"
command: build
args: -m crates/re_sdk_python/Cargo.toml --release --no-sdist -o dist
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

maturin-macos:
name: Maturin MacOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: messense/maturin-action@v1
with:
maturin-version: "0.12.20"
command: build
args: -m crates/re_sdk_python/Cargo.toml --release --no-sdist -o dist --universal2
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

maturin-release:
name: Maturin Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [maturin-macos, maturin-windows, maturin-linux]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
- name: Publish to PyPI
uses: messense/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
maturin-version: "0.12.20"
command: upload
args: -m crates/re_sdk_python/Cargo.toml --skip-existing *
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.DS_Store

# Rust compile target directory:
**/target

# python virtual environment:
/env

/media
/objectron/dataset
24 changes: 3 additions & 21 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug 'viewer' recording.rrd",
"name": "Debug 're_viewer' recording.rrd",
"type": "lldb",
"request": "launch",
"cargo": {
"args": [
"build",
"--package=viewer"
"--package=re_viewer"
],
"filter": {
"name": "viewer",
"name": "re_viewer",
"kind": "bin"
}
},
Expand Down Expand Up @@ -61,23 +61,5 @@
],
"cwd": "${workspaceFolder}"
},
{
"name": "Debug 'prototype' tests",
"type": "lldb",
"request": "launch",
"cargo": {
"args": [
"test",
"--no-run",
"--package=prototype"
],
"filter": {
"name": "prototype",
"kind": "lib"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
]
}
153 changes: 153 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ resolver = "2"
members = [
"crates/re_data_store",
"crates/re_log_types",
"crates/re_sdk_comms",
"crates/re_sdk_python",
"crates/re_string_interner",
"crates/re_viewer",
"crates/re_web_server",
Expand Down
2 changes: 2 additions & 0 deletions Cranky.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ warn = [
"clippy::todo",
"clippy::trailing_empty_array",
"clippy::trait_duplication_in_bounds",
"clippy::undocumented_unsafe_blocks",
"clippy::unimplemented",
"clippy::unnecessary_wraps",
"clippy::unnested_or_patterns",
Expand All @@ -95,6 +96,7 @@ warn = [
"rust_2018_idioms",
"rust_2021_prelude_collisions",
"rustdoc::missing_crate_level_docs",
"rustdoc::unsafe_op_in_unsafe_fn",
"semicolon_in_expressions_from_macros",
"trivial_numeric_casts",
"unused_extern_crates",
Expand Down
6 changes: 6 additions & 0 deletions crates/re_log_types/src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ fn test_encode_decode() {
"snake",
1337.0,
)),
LogMsg::from(data_msg(
&time_point,
ObjPathBuilder::from("badger") / "mushroom",
"pos",
Data::Vec3([1.0, 2.5, 3.0]),
)),
];

let mut file = vec![];
Expand Down
Loading

0 comments on commit b96d7b6

Please sign in to comment.