Jeremy Leibs commited on
Commit
344c16f
0 Parent(s):

Initial commit

Browse files
.clang-format ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BasedOnStyle: Google
2
+
3
+ # Make it slightly more similar to Rust.
4
+ # Based loosely on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4
5
+ AccessModifierOffset: -2
6
+ AlignAfterOpenBracket: BlockIndent
7
+ AllowAllArgumentsOnNextLine: false
8
+ AllowShortBlocksOnASingleLine: false
9
+ AllowShortCaseLabelsOnASingleLine: false
10
+ AllowShortFunctionsOnASingleLine: Empty
11
+ AllowShortIfStatementsOnASingleLine: Never
12
+ AlwaysBreakAfterReturnType: None
13
+ AlwaysBreakBeforeMultilineStrings: true
14
+ BinPackArguments: false
15
+ BreakStringLiterals: false
16
+ ColumnLimit: 100
17
+ ContinuationIndentWidth: 4
18
+ DerivePointerAlignment: false
19
+ EmptyLineBeforeAccessModifier: LogicalBlock
20
+ IndentWidth: 4
21
+ IndentWrappedFunctionNames: true
22
+ InsertBraces: true
23
+ InsertTrailingCommas: Wrapped
24
+ MaxEmptyLinesToKeep: 1
25
+ NamespaceIndentation: All
26
+ PointerAlignment: Left
27
+ ReflowComments: false
28
+ SeparateDefinitionBlocks: Always
29
+ SpacesBeforeTrailingComments: 1
30
+
31
+ # Don't change include blocks, we want to control this manually.
32
+ # Sorting headers however is allowed as all our headers should be standalone.
33
+ IncludeBlocks: Preserve
34
+ SortIncludes: CaseInsensitive
.gitattributes ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ * text=auto eol=lf
2
+ Cargo.lock linguist-generated=false
.github/workflows/cpp.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ on: [push, pull_request]
3
+
4
+ name: C++
5
+
6
+ jobs:
7
+ cpp-check:
8
+ name: C++
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - uses: prefix-dev/setup-pixi@v0.5.2
14
+ with:
15
+ pixi-version: v0.19.0
16
+ cache: true
17
+
18
+ - run: pixi run build
19
+
20
+ - run: pixi run cpp-fmt-check
.github/workflows/labels.yml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+
3
+ # https://github.com/marketplace/actions/require-labels
4
+ # Check for existence of labels
5
+ # See all our labels at https://github.com/rerun-io/rerun/issues/labels
6
+
7
+ name: PR Labels
8
+
9
+ on:
10
+ pull_request:
11
+ types:
12
+ - opened
13
+ - synchronize
14
+ - reopened
15
+ - labeled
16
+ - unlabeled
17
+
18
+ jobs:
19
+ label:
20
+ runs-on: ubuntu-latest
21
+ steps:
22
+ - name: Check for a "do-not-merge" label
23
+ uses: mheap/github-action-required-labels@v3
24
+ with:
25
+ mode: exactly
26
+ count: 0
27
+ labels: "do-not-merge"
28
+
29
+ - name: Require label "include in changelog" or "exclude from changelog"
30
+ uses: mheap/github-action-required-labels@v3
31
+ with:
32
+ mode: minimum
33
+ count: 1
34
+ labels: "exclude from changelog, include in changelog"
.github/workflows/links.yml ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ on: [push, pull_request]
3
+
4
+ name: Link checker
5
+
6
+ jobs:
7
+ link-checker:
8
+ name: Check links
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - name: Restore link checker cache
14
+ uses: actions/cache@v3
15
+ with:
16
+ path: .lycheecache
17
+ key: cache-lychee-${{ github.sha }}
18
+ restore-keys: cache-lychee-
19
+
20
+ # Check https://github.com/lycheeverse/lychee on how to run locally.
21
+ - name: Link Checker
22
+ id: lychee
23
+ uses: lycheeverse/lychee-action@v1.9.0
24
+ with:
25
+ fail: true
26
+ lycheeVersion: "0.14.3"
27
+ # When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
28
+ args: |
29
+ --base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
.github/workflows/python.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ on: [push, pull_request]
3
+
4
+ name: C++
5
+
6
+ jobs:
7
+ python-check:
8
+ name: Python
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+
13
+ - uses: prefix-dev/setup-pixi@v0.5.2
14
+ with:
15
+ pixi-version: v0.19.0
16
+ cache: true
17
+
18
+ - run: pixi run py-fmt-check
19
+
20
+ - run: pixi run py-lint
.github/workflows/rust.yml ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ on: [push, pull_request]
3
+
4
+ name: Rust
5
+
6
+ env:
7
+ RUSTFLAGS: -D warnings
8
+ RUSTDOCFLAGS: -D warnings
9
+
10
+ jobs:
11
+ rust-check:
12
+ name: Rust
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: actions-rs/toolchain@v1
18
+ with:
19
+ profile: default
20
+ toolchain: 1.76.0
21
+ override: true
22
+
23
+ - name: Install packages (Linux)
24
+ if: runner.os == 'Linux' && false # TODO: enable if eframe is part of the project, otherwise remove
25
+ uses: awalsh128/cache-apt-pkgs-action@v1.3.0
26
+ with:
27
+ # some deps used by eframe, if that is part of the project
28
+ packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev # libgtk-3-dev is used by rfd
29
+ version: 1.0
30
+ execute_install_scripts: true
31
+
32
+ - name: Set up cargo cache
33
+ uses: Swatinem/rust-cache@v2
34
+
35
+ - name: Rustfmt
36
+ uses: actions-rs/cargo@v1
37
+ with:
38
+ command: fmt
39
+ args: --all -- --check
40
+
41
+ - name: check --all-features
42
+ uses: actions-rs/cargo@v1
43
+ with:
44
+ command: check
45
+ args: --all-features --all-targets
46
+
47
+ - name: check default features
48
+ uses: actions-rs/cargo@v1
49
+ with:
50
+ command: check
51
+ args: --all-targets
52
+
53
+ - name: check --no-default-features
54
+ uses: actions-rs/cargo@v1
55
+ with:
56
+ command: check
57
+ args: --no-default-features --lib --all-targets
58
+
59
+ - name: Test doc-tests
60
+ uses: actions-rs/cargo@v1
61
+ with:
62
+ command: test
63
+ args: --doc --all-features
64
+
65
+ - name: cargo doc --lib
66
+ uses: actions-rs/cargo@v1
67
+ with:
68
+ command: doc
69
+ args: --lib --no-deps --all-features
70
+
71
+ - name: cargo doc --document-private-items
72
+ uses: actions-rs/cargo@v1
73
+ with:
74
+ command: doc
75
+ args: --document-private-items --no-deps --all-features
76
+
77
+ - name: Build tests
78
+ uses: actions-rs/cargo@v1
79
+ with:
80
+ command: test
81
+ args: --all-features --no-run
82
+
83
+ - name: Run test
84
+ uses: actions-rs/cargo@v1
85
+ with:
86
+ command: test
87
+ args: --all-features
88
+
89
+ - name: Clippy
90
+ uses: actions-rs/cargo@v1
91
+ with:
92
+ command: clippy
93
+ args: --all-targets --all-features -- -D warnings
94
+
95
+ # ---------------------------------------------------------------------------
96
+
97
+ check_wasm:
98
+ name: Check wasm32
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+ - uses: actions-rs/toolchain@v1
103
+ with:
104
+ profile: minimal
105
+ toolchain: 1.76.0
106
+ target: wasm32-unknown-unknown
107
+ override: true
108
+
109
+ - name: Set up cargo cache
110
+ uses: Swatinem/rust-cache@v2
111
+
112
+ - name: Check wasm32
113
+ uses: actions-rs/cargo@v1
114
+ with:
115
+ command: check
116
+ args: --target wasm32-unknown-unknown --lib
117
+
118
+ - name: Clippy wasm32
119
+ env:
120
+ CLIPPY_CONF_DIR: "scripts/clippy_wasm" # Use scripts/clippy_wasm/clippy.toml
121
+ run: cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings
122
+
123
+ # ---------------------------------------------------------------------------
124
+
125
+ cargo-deny:
126
+ name: Check Rust dependencies (cargo-deny)
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - uses: actions/checkout@v3
130
+ - uses: EmbarkStudios/cargo-deny-action@v1
131
+ with:
132
+ rust-version: "1.76.0"
133
+ log-level: warn
134
+ command: check
.github/workflows/typos.yml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+
3
+ # https://github.com/crate-ci/typos
4
+ # Add exceptions to `.typos.toml`
5
+ # install and run locally: cargo install typos-cli && typos
6
+
7
+ name: Spell Check
8
+ on: [pull_request]
9
+
10
+ jobs:
11
+ run:
12
+ name: Spell Check
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout Actions Repository
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Check spelling of entire workspace
19
+ uses: crate-ci/typos@master
.gitignore ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Mac stuff:
2
+ .DS_Store
3
+
4
+ # C++ build directory
5
+ build
6
+
7
+ # Rust compile target directories:
8
+ target
9
+ target_ra
10
+ target_wasm
11
+
12
+ # https://github.com/lycheeverse/lychee
13
+ .lycheecache
14
+
15
+ # Pixi environment
16
+ .pixi
17
+
18
+ # Python stuff:
19
+ __pycache__
20
+ .mypy_cache
21
+ .ruff_cache
22
+ venv
.mypy.ini ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [mypy]
2
+ files = .
3
+ exclude = build
4
+ namespace_packages = True
5
+ show_error_codes = True
6
+ strict = True
7
+ enable_error_code = redundant-expr, truthy-bool, ignore-without-code
8
+ ; plugins = numpy.typing.mypy_plugin
9
+ ignore_missing_imports = True
10
+ no_implicit_reexport = False
11
+ disallow_untyped_calls = False
.typos.toml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # https://github.com/crate-ci/typos
2
+ # install: cargo install typos-cli
3
+ # run: typos
4
+
5
+ [default.extend-words]
6
+ teh = "teh" # part of @teh-cmc
.vscode/extensions.json ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=827846
3
+ // for the documentation about the extensions.json format
4
+ "recommendations": [
5
+ "charliermarsh.ruff",
6
+ "gaborv.flatbuffers",
7
+ "github.vscode-github-actions",
8
+ "josetr.cmake-language-support-vscode",
9
+ "ms-python.mypy-type-checker",
10
+ "ms-python.python",
11
+ "ms-vscode.cmake-tools",
12
+ "ms-vscode.cpptools-extension-pack",
13
+ "ms-vsliveshare.vsliveshare",
14
+ "polymeilex.wgsl",
15
+ "rust-lang.rust-analyzer",
16
+ "serayuzgur.crates",
17
+ "streetsidesoftware.code-spell-checker",
18
+ "tamasfe.even-better-toml",
19
+ "vadimcn.vscode-lldb",
20
+ "wayou.vscode-todo-highlight",
21
+ "webfreak.debug",
22
+ "xaver.clang-format", // C++ formatter
23
+ "zxh404.vscode-proto3",
24
+ "esbenp.prettier-vscode"
25
+ ]
26
+ }
.vscode/launch.json ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ // Python
8
+ {
9
+ "name": "Python Debugger: Current File",
10
+ "type": "debugpy",
11
+ "request": "launch",
12
+ "program": "${file}",
13
+ "console": "integratedTerminal"
14
+ },
15
+ // Rust:
16
+ {
17
+ "name": "Debug 'PROJ_NAME'",
18
+ "type": "lldb",
19
+ "request": "launch",
20
+ "cargo": {
21
+ "args": [
22
+ "build"
23
+ ],
24
+ "filter": {
25
+ "name": "PROJ_NAME",
26
+ "kind": "bin"
27
+ }
28
+ },
29
+ "args": [],
30
+ "cwd": "${workspaceFolder}",
31
+ "env": {
32
+ "RUST_LOG": "debug"
33
+ }
34
+ },
35
+ {
36
+ "name": "Launch Rust tests",
37
+ "type": "lldb",
38
+ "request": "launch",
39
+ "cargo": {
40
+ "args": [
41
+ "test",
42
+ "--no-run",
43
+ "--lib",
44
+ "--all-features"
45
+ ],
46
+ "filter": {
47
+ "kind": "lib"
48
+ }
49
+ },
50
+ "cwd": "${workspaceFolder}",
51
+ "env": {
52
+ "RUST_LOG": "debug"
53
+ }
54
+ },
55
+ ]
56
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.semanticTokenColorCustomizations": {
4
+ "rules": {
5
+ "*.unsafe:rust": "#eb5046"
6
+ }
7
+ },
8
+ "files.autoGuessEncoding": true,
9
+ "files.insertFinalNewline": true,
10
+ "files.trimTrailingWhitespace": true,
11
+ // don't share a cargo lock with rust-analyzer.
12
+ // see https://github.com/rerun-io/rerun/pull/519 for rationale
13
+ "rust-analyzer.check.overrideCommand": [
14
+ "cargo",
15
+ "clippy",
16
+ "--target-dir=target_ra",
17
+ "--workspace",
18
+ "--message-format=json",
19
+ "--all-targets",
20
+ "--all-features"
21
+ ],
22
+ "rust-analyzer.cargo.buildScripts.overrideCommand": [
23
+ "cargo",
24
+ "check",
25
+ "--quiet",
26
+ "--target-dir=target_ra",
27
+ "--workspace",
28
+ "--message-format=json",
29
+ "--all-targets",
30
+ "--all-features",
31
+ ],
32
+ // Our build scripts are generating code.
33
+ // Having Rust Analyzer do this while doing other builds can lead to catastrophic failures.
34
+ // INCLUDING attempts to publish a new release!
35
+ "rust-analyzer.cargo.buildScripts.enable": false,
36
+ "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", // Use cmake-tools to grab configs.
37
+ "C_Cpp.autoAddFileAssociations": false,
38
+ "cmake.buildDirectory": "${workspaceRoot}/build/debug",
39
+ "cmake.generator": "Ninja", // Use Ninja, just like we do in our just/pixi command.
40
+ "rust-analyzer.showUnlinkedFileNotification": false,
41
+ "ruff.format.args": [
42
+ "--config=pyproject.toml"
43
+ ],
44
+ "ruff.lint.args": [
45
+ "--config=pyproject.toml"
46
+ ],
47
+ "prettier.requireConfig": true,
48
+ "prettier.configPath": ".prettierrc.toml",
49
+ "[python]": {
50
+ "editor.defaultFormatter": "charliermarsh.ruff"
51
+ },
52
+ }
CHANGELOG.md ADDED
@@ -0,0 +1 @@
 
 
1
+ # Changelog
CMakeLists.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ cmake_minimum_required(VERSION 3.16...3.27)
2
+
3
+ project(PROJ_NAME LANGUAGES CXX)
4
+
5
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
6
+
7
+ if(NOT DEFINED CMAKE_CXX_STANDARD)
8
+ set(CMAKE_CXX_STANDARD 17)
9
+ endif()
10
+
11
+ # Rerun:
12
+ include(FetchContent)
13
+ FetchContent_Declare(rerun_sdk URL https://github.com/rerun-io/rerun/releases/download/0.15.1/rerun_cpp_sdk.zip)
14
+ FetchContent_MakeAvailable(rerun_sdk)
15
+
16
+ add_executable(PROJ_NAME src/main.cpp)
17
+ target_link_libraries(PROJ_NAME rerun_sdk)
18
+ target_include_directories(PROJ_NAME PRIVATE src)
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ opensource@rerun.io.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
Cargo.lock ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 3
4
+
5
+ [[package]]
6
+ name = "new_project_name"
7
+ version = "0.1.0"
Cargo.toml ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [package]
2
+ authors = ["rerun.io <opensource@rerun.io>"]
3
+ categories = [] # TODO: fill in if you plan on publishing the crate
4
+ description = "" # TODO: fill in if you plan on publishing the crate
5
+ edition = "2021"
6
+ homepage = "https://github.com/rerun-io/new_repo_name"
7
+ include = ["LICENSE-APACHE", "LICENSE-MIT", "**/*.rs", "Cargo.toml"]
8
+ keywords = [] # TODO: fill in if you plan on publishing the crate
9
+ license = "MIT OR Apache-2.0"
10
+ name = "new_project_name"
11
+ publish = false # TODO: set to `true` if you plan on publishing the crate
12
+ readme = "README.md"
13
+ repository = "https://github.com/rerun-io/new_repo_name"
14
+ rust-version = "1.76"
15
+ version = "0.1.0"
16
+
17
+ [package.metadata.docs.rs]
18
+ all-features = true
19
+ targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
20
+
21
+
22
+ [features]
23
+ default = []
24
+
25
+
26
+ [dependencies]
27
+
28
+
29
+ [dev-dependencies]
30
+
31
+
32
+ [patch.crates-io]
33
+
34
+
35
+ [lints]
36
+ workspace = true
37
+
38
+
39
+ [workspace.lints.rust]
40
+ unsafe_code = "deny"
41
+
42
+ elided_lifetimes_in_paths = "warn"
43
+ future_incompatible = "warn"
44
+ nonstandard_style = "warn"
45
+ rust_2018_idioms = "warn"
46
+ rust_2021_prelude_collisions = "warn"
47
+ semicolon_in_expressions_from_macros = "warn"
48
+ trivial_numeric_casts = "warn"
49
+ unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
50
+ unused_extern_crates = "warn"
51
+ unused_import_braces = "warn"
52
+ unused_lifetimes = "warn"
53
+
54
+ trivial_casts = "allow"
55
+ unused_qualifications = "allow"
56
+
57
+ [workspace.lints.rustdoc]
58
+ all = "warn"
59
+ missing_crate_level_docs = "warn"
60
+
61
+ # See also clippy.toml
62
+ [workspace.lints.clippy]
63
+ as_ptr_cast_mut = "warn"
64
+ await_holding_lock = "warn"
65
+ bool_to_int_with_if = "warn"
66
+ char_lit_as_u8 = "warn"
67
+ checked_conversions = "warn"
68
+ clear_with_drain = "warn"
69
+ cloned_instead_of_copied = "warn"
70
+ dbg_macro = "warn"
71
+ debug_assert_with_mut_call = "warn"
72
+ derive_partial_eq_without_eq = "warn"
73
+ disallowed_macros = "warn" # See clippy.toml
74
+ disallowed_methods = "warn" # See clippy.toml
75
+ disallowed_names = "warn" # See clippy.toml
76
+ disallowed_script_idents = "warn" # See clippy.toml
77
+ disallowed_types = "warn" # See clippy.toml
78
+ doc_link_with_quotes = "warn"
79
+ doc_markdown = "warn"
80
+ empty_enum = "warn"
81
+ enum_glob_use = "warn"
82
+ equatable_if_let = "warn"
83
+ exit = "warn"
84
+ expl_impl_clone_on_copy = "warn"
85
+ explicit_deref_methods = "warn"
86
+ explicit_into_iter_loop = "warn"
87
+ explicit_iter_loop = "warn"
88
+ fallible_impl_from = "warn"
89
+ filter_map_next = "warn"
90
+ flat_map_option = "warn"
91
+ float_cmp_const = "warn"
92
+ fn_params_excessive_bools = "warn"
93
+ fn_to_numeric_cast_any = "warn"
94
+ from_iter_instead_of_collect = "warn"
95
+ get_unwrap = "warn"
96
+ if_let_mutex = "warn"
97
+ implicit_clone = "warn"
98
+ imprecise_flops = "warn"
99
+ index_refutable_slice = "warn"
100
+ inefficient_to_string = "warn"
101
+ infinite_loop = "warn"
102
+ into_iter_without_iter = "warn"
103
+ invalid_upcast_comparisons = "warn"
104
+ iter_not_returning_iterator = "warn"
105
+ iter_on_empty_collections = "warn"
106
+ iter_on_single_items = "warn"
107
+ iter_over_hash_type = "warn"
108
+ iter_without_into_iter = "warn"
109
+ large_digit_groups = "warn"
110
+ large_include_file = "warn"
111
+ large_stack_arrays = "warn"
112
+ large_stack_frames = "warn"
113
+ large_types_passed_by_value = "warn"
114
+ let_underscore_untyped = "warn"
115
+ let_unit_value = "warn"
116
+ linkedlist = "warn"
117
+ lossy_float_literal = "warn"
118
+ macro_use_imports = "warn"
119
+ manual_assert = "warn"
120
+ manual_clamp = "warn"
121
+ manual_instant_elapsed = "warn"
122
+ manual_let_else = "warn"
123
+ manual_ok_or = "warn"
124
+ manual_string_new = "warn"
125
+ map_err_ignore = "warn"
126
+ map_flatten = "warn"
127
+ map_unwrap_or = "warn"
128
+ match_on_vec_items = "warn"
129
+ match_same_arms = "warn"
130
+ match_wild_err_arm = "warn"
131
+ match_wildcard_for_single_variants = "warn"
132
+ mem_forget = "warn"
133
+ mismatched_target_os = "warn"
134
+ mismatching_type_param_order = "warn"
135
+ missing_assert_message = "warn"
136
+ missing_enforced_import_renames = "warn"
137
+ missing_errors_doc = "warn"
138
+ missing_safety_doc = "warn"
139
+ mut_mut = "warn"
140
+ mutex_integer = "warn"
141
+ needless_borrow = "warn"
142
+ needless_continue = "warn"
143
+ needless_for_each = "warn"
144
+ needless_pass_by_ref_mut = "warn"
145
+ needless_pass_by_value = "warn"
146
+ negative_feature_names = "warn"
147
+ nonstandard_macro_braces = "warn"
148
+ option_option = "warn"
149
+ path_buf_push_overwrite = "warn"
150
+ ptr_as_ptr = "warn"
151
+ ptr_cast_constness = "warn"
152
+ pub_without_shorthand = "warn"
153
+ rc_mutex = "warn"
154
+ readonly_write_lock = "warn"
155
+ redundant_type_annotations = "warn"
156
+ ref_option_ref = "warn"
157
+ rest_pat_in_fully_bound_structs = "warn"
158
+ same_functions_in_if_condition = "warn"
159
+ semicolon_if_nothing_returned = "warn"
160
+ should_panic_without_expect = "warn"
161
+ significant_drop_tightening = "warn"
162
+ single_match_else = "warn"
163
+ str_to_string = "warn"
164
+ string_add = "warn"
165
+ string_add_assign = "warn"
166
+ string_lit_as_bytes = "warn"
167
+ string_lit_chars_any = "warn"
168
+ string_to_string = "warn"
169
+ suspicious_command_arg_space = "warn"
170
+ suspicious_xor_used_as_pow = "warn"
171
+ todo = "warn"
172
+ too_many_lines = "warn"
173
+ trailing_empty_array = "warn"
174
+ trait_duplication_in_bounds = "warn"
175
+ tuple_array_conversions = "warn"
176
+ unchecked_duration_subtraction = "warn"
177
+ undocumented_unsafe_blocks = "warn"
178
+ unimplemented = "warn"
179
+ uninhabited_references = "warn"
180
+ uninlined_format_args = "warn"
181
+ unnecessary_box_returns = "warn"
182
+ unnecessary_safety_doc = "warn"
183
+ unnecessary_struct_initialization = "warn"
184
+ unnecessary_wraps = "warn"
185
+ unnested_or_patterns = "warn"
186
+ unused_peekable = "warn"
187
+ unused_rounding = "warn"
188
+ unused_self = "warn"
189
+ unwrap_used = "warn"
190
+ use_self = "warn"
191
+ useless_transmute = "warn"
192
+ verbose_file_reads = "warn"
193
+ wildcard_dependencies = "warn"
194
+ wildcard_imports = "warn"
195
+ zero_sized_map_values = "warn"
196
+
197
+ manual_range_contains = "allow" # this one is just worse imho
198
+ ref_patterns = "allow" # It's nice to avoid ref pattern, but there are some situations that are hard (impossible?) to express without.
LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
LICENSE-MIT ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2024 Rerun Technologies AB <opensource@rerun.io>
2
+
3
+ Permission is hereby granted, free of charge, to any
4
+ person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the
6
+ Software without restriction, including without
7
+ limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software
10
+ is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice
14
+ shall be included in all copies or substantial portions
15
+ of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
README.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Rerun template repository
2
+ Template for our private and public repos, containing CI, CoC, etc
3
+
4
+ When creating a new Rerun repository, use this as a template, then modify it as it makes sense.
5
+
6
+ This template should be the default for any repository of any kind, including:
7
+ * Rust projects
8
+ * C++ projects
9
+ * Python projects
10
+ * Other stuff
11
+
12
+ This template includes
13
+ * License files
14
+ * Code of Conduct
15
+ * Helpers for checking and linting Rust code
16
+ - `cargo-clippy`
17
+ - `cargo-deny`
18
+ - `rust-toolchain`
19
+ - …
20
+ * CI for:
21
+ - Spell checking
22
+ - Link checking
23
+ - C++ checks
24
+ - Python checks
25
+ - Rust checks
26
+
27
+
28
+ ## How to use
29
+ Start by clicking "Use this template" at https://github.com/rerun-io/rerun_template/ or follow [these instructions](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template).
30
+
31
+ Then follow these steps:
32
+ * Run `scripts/template_update.py init --languages cpp,rust,python` to delete files you don't need (give the languages you need support for)
33
+ * Search and replace all instances of `new_repo_name` with the name of the repository.
34
+ * Search and replace all instances of `new_project_name` with the name of the project (crate/binary name).
35
+ * Search for `TODO` and fill in all those places
36
+ * Replace this `README.md` with something better
37
+ * Commit!
38
+
39
+ In the future you can always update this repository with the latest changes from the template by running:
40
+ * `scripts/template_update.py update --languages cpp,rust,python`
clippy.toml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ #
3
+ # There is also a scripts/clippy_wasm/clippy.toml which forbids some methods that are not available in wasm.
4
+
5
+ # -----------------------------------------------------------------------------
6
+ # Section identical to scripts/clippy_wasm/clippy.toml:
7
+
8
+ msrv = "1.76"
9
+
10
+ allow-unwrap-in-tests = true
11
+
12
+ # https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
13
+ # We want suggestions, even if it changes public API.
14
+ avoid-breaking-exported-api = false
15
+
16
+ excessive-nesting-threshold = 8
17
+
18
+ max-fn-params-bools = 1
19
+
20
+ # https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file
21
+ max-include-file-size = 1000000
22
+
23
+ # https://rust-lang.github.io/rust-clippy/master/index.html#/large_stack_frames
24
+ stack-size-threshold = 512000
25
+
26
+ too-many-lines-threshold = 200
27
+
28
+ # -----------------------------------------------------------------------------
29
+
30
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_macros
31
+ disallowed-macros = ['dbg']
32
+
33
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
34
+ disallowed-methods = [
35
+ { path = "egui_extras::TableBody::row", reason = "`row` doesn't scale. Use `rows` instead." },
36
+ { path = "glam::Vec2::normalize", reason = "normalize() can create NaNs. Use try_normalize or normalize_or_zero" },
37
+ { path = "glam::Vec3::normalize", reason = "normalize() can create NaNs. Use try_normalize or normalize_or_zero" },
38
+ { path = "sha1::Digest::new", reason = "SHA1 is cryptographically broken" },
39
+ { path = "std::env::temp_dir", reason = "Use the tempdir crate instead" },
40
+ { path = "std::panic::catch_unwind", reason = "We compile with `panic = 'abort'`" },
41
+ { path = "std::thread::spawn", reason = "Use `std::thread::Builder` and name the thread" },
42
+
43
+ # There are many things that aren't allowed on wasm,
44
+ # but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406)
45
+ # so we do that in `scripts/clippy_wasm/clippy.toml` instead.
46
+ ]
47
+
48
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_names
49
+ disallowed-names = []
50
+
51
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
52
+ disallowed-types = [
53
+ { path = "ring::digest::SHA1_FOR_LEGACY_USE_ONLY", reason = "SHA1 is cryptographically broken" },
54
+
55
+ { path = "std::sync::Condvar", reason = "Use parking_lot instead" },
56
+ { path = "std::sync::Mutex", reason = "Use parking_lot instead" },
57
+ { path = "std::sync::RwLock", reason = "Use parking_lot instead" },
58
+
59
+ # "std::sync::Once", # enabled for now as the `log_once` macro uses it internally
60
+ ]
61
+
62
+ # Allow-list of words for markdown in dosctrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
63
+ doc-valid-idents = [
64
+ # You must also update the same list in `scripts/clippy_wasm/clippy.toml`!
65
+ "GitHub",
66
+ "GLB",
67
+ "GLTF",
68
+ "iOS",
69
+ "macOS",
70
+ "NaN",
71
+ "OBJ",
72
+ "OpenGL",
73
+ "PyPI",
74
+ "sRGB",
75
+ "sRGBA",
76
+ "WebGL",
77
+ "WebSocket",
78
+ "WebSockets",
79
+ ]
deny.toml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+ #
3
+ # https://github.com/EmbarkStudios/cargo-deny
4
+ #
5
+ # cargo-deny checks our dependency tree for copy-left licenses,
6
+ # duplicate dependencies, and rustsec advisories (https://rustsec.org/advisories).
7
+ #
8
+ # Install: `cargo install cargo-deny`
9
+ # Check: `cargo deny check`.
10
+
11
+
12
+ # Note: running just `cargo deny check` without a `--target` can result in
13
+ # false positives due to https://github.com/EmbarkStudios/cargo-deny/issues/324
14
+ [graph]
15
+ targets = [
16
+ { triple = "aarch64-apple-darwin" },
17
+ { triple = "i686-pc-windows-gnu" },
18
+ { triple = "i686-pc-windows-msvc" },
19
+ { triple = "i686-unknown-linux-gnu" },
20
+ { triple = "wasm32-unknown-unknown" },
21
+ { triple = "x86_64-apple-darwin" },
22
+ { triple = "x86_64-pc-windows-gnu" },
23
+ { triple = "x86_64-pc-windows-msvc" },
24
+ { triple = "x86_64-unknown-linux-gnu" },
25
+ { triple = "x86_64-unknown-linux-musl" },
26
+ { triple = "x86_64-unknown-redox" },
27
+ ]
28
+ all-features = true
29
+
30
+
31
+ [advisories]
32
+ version = 2
33
+ ignore = []
34
+
35
+
36
+ [bans]
37
+ multiple-versions = "deny"
38
+ wildcards = "deny"
39
+ deny = [
40
+ { name = "openssl", reason = "Use rustls" },
41
+ { name = "openssl-sys", reason = "Use rustls" },
42
+ ]
43
+ skip = []
44
+ skip-tree = []
45
+
46
+
47
+ [licenses]
48
+ version = 2
49
+ private = { ignore = true }
50
+ confidence-threshold = 0.93 # We want really high confidence when inferring licenses from text
51
+ allow = [
52
+ "Apache-2.0 WITH LLVM-exception", # https://spdx.org/licenses/LLVM-exception.html
53
+ "Apache-2.0", # https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)
54
+ "BSD-2-Clause", # https://tldrlegal.com/license/bsd-2-clause-license-(freebsd)
55
+ "BSD-3-Clause", # https://tldrlegal.com/license/bsd-3-clause-license-(revised)
56
+ "BSL-1.0", # https://tldrlegal.com/license/boost-software-license-1.0-explained
57
+ "CC0-1.0", # https://creativecommons.org/publicdomain/zero/1.0/
58
+ "ISC", # https://www.tldrlegal.com/license/isc-license
59
+ "LicenseRef-UFL-1.0", # no official SPDX, see https://github.com/emilk/egui/issues/2321
60
+ "MIT-0", # https://choosealicense.com/licenses/mit-0/
61
+ "MIT", # https://tldrlegal.com/license/mit-license
62
+ "MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11. Used by webpki-roots on Linux.
63
+ "OFL-1.1", # https://spdx.org/licenses/OFL-1.1.html
64
+ "OpenSSL", # https://www.openssl.org/source/license.html - used on Linux
65
+ "Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html
66
+ "Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib)
67
+ ]
68
+ exceptions = []
69
+
70
+ [[licenses.clarify]]
71
+ name = "webpki"
72
+ expression = "ISC"
73
+ license-files = [{ path = "LICENSE", hash = 0x001c7e6c }]
74
+
75
+ [[licenses.clarify]]
76
+ name = "ring"
77
+ expression = "MIT AND ISC AND OpenSSL"
78
+ license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }]
79
+
80
+
81
+ [sources]
82
+ unknown-registry = "deny"
83
+ unknown-git = "deny"
84
+
85
+ [sources.allow-org]
86
+ github = ["emilk", "rerun-io"]
lychee.toml ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+
3
+ ################################################################################
4
+ # Config for the link checker lychee.
5
+ #
6
+ # Download & learn more at:
7
+ # https://github.com/lycheeverse/lychee
8
+ #
9
+ # Example config:
10
+ # https://github.com/lycheeverse/lychee/blob/master/lychee.example.toml
11
+ #
12
+ # Run `lychee . --dump` to list all found links that are being checked.
13
+ #
14
+ # Note that by default lychee will only check markdown and html files,
15
+ # to check any other files you have to point to them explicitly, e.g.:
16
+ # `lychee **/*.rs`
17
+ # To make things worse, `exclude_path` is ignored for these globs,
18
+ # so local runs with lots of gitignored files will be slow.
19
+ # (https://github.com/lycheeverse/lychee/issues/1405)
20
+ #
21
+ # This unfortunately doesn't list anything for non-glob checks.
22
+ ################################################################################
23
+
24
+ # Maximum number of concurrent link checks.
25
+ # Workaround for "too many open files" error on MacOS, see https://github.com/lycheeverse/lychee/issues/1248
26
+ max_concurrency = 32
27
+
28
+ # Check links inside `<code>` and `<pre>` blocks as well as Markdown code blocks.
29
+ include_verbatim = true
30
+
31
+ # Proceed for server connections considered insecure (invalid TLS).
32
+ insecure = true
33
+
34
+ # Exclude these filesystem paths from getting checked.
35
+ exclude_path = [
36
+ # Unfortunately lychee doesn't yet read .gitignore https://github.com/lycheeverse/lychee/issues/1331
37
+ # The following entries are there because of that:
38
+ ".git",
39
+ "__pycache__",
40
+ "_deps/",
41
+ ".pixi",
42
+ "build",
43
+ "target_ra",
44
+ "target_wasm",
45
+ "target",
46
+ "venv",
47
+ ]
48
+
49
+ # Exclude URLs and mail addresses from checking (supports regex).
50
+ exclude = [
51
+ # Skip speculative links
52
+ '.*?speculative-link',
53
+
54
+ # Strings with replacements.
55
+ '/__VIEWER_VERSION__/', # Replacement variable __VIEWER_VERSION__.
56
+ '/\$', # Replacement variable $.
57
+ '/GIT_HASH/', # Replacement variable GIT_HASH.
58
+ '\{\}', # Ignore links with string interpolation.
59
+ '\$relpath\^', # Relative paths as used by rerun_cpp's doc header.
60
+ '%7B.+%7D', # Ignore strings that look like ready to use links but contain a replacement strings. The URL escaping is for '{.+}' (this seems to be needed for html embedded urls since lychee assumes they use this encoding).
61
+ '%7B%7D', # Ignore links with string interpolation, escaped variant.
62
+
63
+ # Local links that require further setup.
64
+ 'http://127.0.0.1',
65
+ 'http://localhost',
66
+ 'recording:/', # rrd recording link.
67
+ 'ws:/',
68
+ 're_viewer.js', # Build artifact that html is linking to.
69
+
70
+ # Api endpoints.
71
+ 'https://fonts.googleapis.com/', # Font API entrypoint, not a link.
72
+ 'https://fonts.gstatic.com/', # Font API entrypoint, not a link.
73
+ 'https://tel.rerun.io/', # Analytics endpoint.
74
+
75
+ # Avoid rate limiting.
76
+ 'https://crates.io/crates/.*', # Avoid crates.io rate-limiting
77
+ 'https://github.com/rerun-io/rerun/commit/\.*', # Ignore links to our own commits (typically in changelog).
78
+ 'https://github.com/rerun-io/rerun/pull/\.*', # Ignore links to our own pull requests (typically in changelog).
79
+
80
+ # Used in rerun_template repo until the user search-replaces `new_repo_name`
81
+ 'https://github.com/rerun-io/new_repo_name',
82
+ ]
main.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+
3
+ from __future__ import annotations
4
+
5
+
6
+ def main() -> None:
7
+ pass
8
+
9
+
10
+ if __name__ == "__main__":
11
+ main()
pixi.lock ADDED
The diff for this file is too large to render. See raw diff
 
pixi.toml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pixi is a package management tool for developers.
2
+ # Before running a task, pixi ensures that all listed dependencies are installed first.echop
3
+ #
4
+ # Pixi is not required for rerun, but it is a convenient way to install the
5
+ # dependencies required for this example.
6
+ #
7
+ # https://prefix.dev/docs/pixi/overview
8
+ #
9
+ # Use `pixi task list` to list the available tasks,
10
+ # and `pixi run TASK` to run it (e.g. `pixi run example`).
11
+
12
+ [project]
13
+ name = "new_project_name"
14
+ authors = ["rerun.io <opensource@rerun.io>"]
15
+ channels = ["conda-forge"]
16
+ description = "new_project_name"
17
+ homepage = "https://rerun.io"
18
+ license = "MIT OR Apache-2.0"
19
+
20
+ platforms = ["linux-64", "linux-aarch64", "osx-arm64", "osx-64", "win-64"]
21
+ readme = "README.md"
22
+ repository = "https://github.com/rerun-io/new_repo_name"
23
+ version = "0.1.0"
24
+
25
+
26
+ [tasks]
27
+ # ------------------------------------------------------------------------------------------
28
+ # C++ stuff:
29
+ # Note: extra CLI argument after `pixi run TASK` are passed to the task cmd.
30
+
31
+ # Clean C++ build artifacts
32
+ clean = { cmd = "rm -rf build bin CMakeFiles/" }
33
+ print-env = { cmd = "echo $PATH" }
34
+ prepare = "cmake -G 'Ninja' -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo"
35
+
36
+ # Build C++ example
37
+ build = { cmd = "cmake --build build --config RelWithDebInfo --target all", depends_on = [
38
+ "prepare",
39
+ ] }
40
+
41
+ # Run C++ example
42
+ example = { cmd = "build/PROJ_NAME", depends_on = ["build"] }
43
+
44
+ # Format C++ code
45
+ cpp-fmt = { cmd = "clang-format -i src/*.[hc]pp" }
46
+
47
+ # Check formatting of C++ code
48
+ cpp-fmt-check = { cmd = "clang-format --dry-run --Werror -i src/*.[hc]pp" }
49
+
50
+ # ------------------------------------------------------------------------------------------
51
+ # Python stuff:
52
+
53
+ # Run first ruff fix, then ruff format, order is important see also https://twitter.com/charliermarsh/status/1717229721954799727
54
+ py-fmt = "ruff check --fix --config pyproject.toml . && ruff format --config pyproject.toml ."
55
+ py-fmt-check = "ruff check --config pyproject.toml . && ruff format --check --config pyproject.toml"
56
+ py-lint = "mypy --install-types --non-interactive --no-warn-unused-ignore"
57
+
58
+ # ------------------------------------------------------------------------------------------
59
+ # General stuff:
60
+ lint-typos = "typos"
61
+
62
+
63
+ [dependencies]
64
+ # C++ build-tools:
65
+ cmake = "3.27.6"
66
+ clang-tools = ">=15,<16" # clang-format
67
+ cxx-compiler = "1.6.0.*"
68
+ ninja = "1.11.1"
69
+
70
+ # Python stuff:
71
+ mypy = "1.8.0"
72
+ ruff = "0.3.7"
73
+
74
+ types-requests = ">=2.31,<3" # mypy type hint stubs for generate_changelog.py
75
+
76
+ # General stuff:
77
+ typos = ">=1.16.20"
pyproject.toml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+
3
+ [tool.ruff]
4
+ # https://beta.ruff.rs/docs/configuration/
5
+
6
+ target-version = "py38"
7
+
8
+ # Enable unsafe fixes to allow ruff to apply fixes that may change the behavior of the code.
9
+ # This is needed because otherwise ruff will not be able to trim whitespaces in (codegened) docstrings.
10
+ unsafe-fixes = true
11
+
12
+ # Allow preview lints to be enabled (like `PLW1514` to force `encoding` on open).
13
+ preview = true
14
+ # But we only want to opt-in to certain preview rules!
15
+ lint.explicit-preview-rules = true
16
+
17
+ extend-exclude = [
18
+ # Automatically generated test artifacts
19
+ "venv/",
20
+ "target/",
21
+ ]
22
+
23
+ lint.ignore = [
24
+ # These makes sense to ignore in example code, but for a proper library we should not ignore these.
25
+ "D100", # Missing docstring in public module
26
+ "D101", # Missing docstring in public class
27
+ "D103", # Missing docstring in public function
28
+
29
+ # No blank lines allowed after function docstring.
30
+ "D202",
31
+
32
+ # npydocstyle: http://www.pydocstyle.org/en/stable/error_codes.html
33
+ # numpy convention with a few additional lints
34
+ "D107",
35
+ "D203",
36
+ "D212",
37
+ "D401",
38
+ "D402",
39
+ "D415",
40
+ "D416",
41
+
42
+ # Ruff can't fix this error on its own (yet)
43
+ # Having ruff check this causes errors that prevent the code-formatting process from completing.
44
+ "E501",
45
+
46
+ # allow relative imports
47
+ "TID252",
48
+
49
+ "UP007", # We need this, or `ruff format` will convert `Union[X, Y]` to `X | Y` which break on Python 3.8
50
+ ]
51
+
52
+ line-length = 120
53
+ lint.select = [
54
+ "D", # pydocstyle codes https://www.pydocstyle.org/en/latest/error_codes.html
55
+ "E", # pycodestyle error codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
56
+ "F", # Flake8 error codes https://flake8.pycqa.org/en/latest/user/error-codes.html
57
+ "I", # Isort
58
+ "TID", # flake8-tidy-imports
59
+ "W", # pycodestyle warning codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
60
+ "UP", # pyupgrade (ensures idomatic code for supported python version)
61
+ "PLW1514", # Force setting `encoding` for open calls. This is in order to prevent issues when opening utf8 files on windows where the default encoding may depend on the active locale. https://docs.astral.sh/ruff/rules/unspecified-encoding/
62
+ ]
63
+
64
+ lint.unfixable = [
65
+ "PLW1514", # Automatic fix for `encoding` doesn't do what we want - it queries the locale for the preferred encoding which is exactly what we want to avoid.
66
+ ]
67
+
68
+ [tool.ruff.lint.per-file-ignores]
69
+ "__init__.py" = ["F401", "F403"]
70
+
71
+ [tool.ruff.lint.isort]
72
+ required-imports = ["from __future__ import annotations"]
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ rerun-sdk>=0.15.0,<0.16.0
rust-toolchain ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # If you see this, run "rustup self update" to get rustup 1.23 or newer.
2
+
3
+ # NOTE: above comment is for older `rustup` (before TOML support was added),
4
+ # which will treat the first line as the toolchain name, and therefore show it
5
+ # to the user in the error, instead of "error: invalid channel name '[toolchain]'".
6
+
7
+ [toolchain]
8
+ channel = "1.76.0"
9
+ components = ["rustfmt", "clippy"]
10
+ targets = ["wasm32-unknown-unknown"]
scripts/clippy_wasm/clippy.toml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copied from https://github.com/rerun-io/rerun_template
2
+
3
+ # This is used by the CI so we can forbid some methods that are not available in wasm.
4
+ #
5
+ # We cannot forbid all these methods in the main `clippy.toml` because of
6
+ # https://github.com/rust-lang/rust-clippy/issues/10406
7
+
8
+ # -----------------------------------------------------------------------------
9
+ # Section identical to the main clippy.toml:
10
+
11
+ msrv = "1.76"
12
+
13
+ allow-unwrap-in-tests = true
14
+
15
+ # https://doc.rust-lang.org/nightly/clippy/lint_configuration.html#avoid-breaking-exported-api
16
+ # We want suggestions, even if it changes public API.
17
+ avoid-breaking-exported-api = false
18
+
19
+ excessive-nesting-threshold = 8
20
+
21
+ max-fn-params-bools = 1
22
+
23
+ # https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file
24
+ max-include-file-size = 1000000
25
+
26
+ too-many-lines-threshold = 200
27
+
28
+ # -----------------------------------------------------------------------------
29
+
30
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_methods
31
+ disallowed-methods = [
32
+ { path = "crossbeam::channel::Receiver::into_iter", reason = "Cannot block on Web" },
33
+ { path = "crossbeam::channel::Receiver::iter", reason = "Cannot block on Web" },
34
+ { path = "crossbeam::channel::Receiver::recv_timeout", reason = "Cannot block on Web" },
35
+ { path = "crossbeam::channel::Receiver::recv", reason = "Cannot block on Web" },
36
+ { path = "poll_promise::Promise::block_and_take", reason = "Cannot block on Web" },
37
+ { path = "poll_promise::Promise::block_until_ready_mut", reason = "Cannot block on Web" },
38
+ { path = "poll_promise::Promise::block_until_ready", reason = "Cannot block on Web" },
39
+ { path = "rayon::spawn", reason = "Cannot spawn threads on wasm" },
40
+ { path = "std::sync::mpsc::Receiver::into_iter", reason = "Cannot block on Web" },
41
+ { path = "std::sync::mpsc::Receiver::iter", reason = "Cannot block on Web" },
42
+ { path = "std::sync::mpsc::Receiver::recv_timeout", reason = "Cannot block on Web" },
43
+ { path = "std::sync::mpsc::Receiver::recv", reason = "Cannot block on Web" },
44
+ { path = "std::thread::spawn", reason = "Cannot spawn threads on wasm" },
45
+ { path = "std::time::Duration::elapsed", reason = "use `web-time` crate instead for wasm/web compatibility" },
46
+ { path = "std::time::Instant::now", reason = "use `web-time` crate instead for wasm/web compatibility" },
47
+ { path = "std::time::SystemTime::now", reason = "use `web-time` or `time` crates instead for wasm/web compatibility" },
48
+ ]
49
+
50
+ # https://rust-lang.github.io/rust-clippy/master/index.html#disallowed_types
51
+ disallowed-types = [
52
+ { path = "instant::SystemTime", reason = "Known bugs. Use web-time." },
53
+ { path = "std::thread::Builder", reason = "Cannot spawn threads on wasm" },
54
+ # { path = "std::path::PathBuf", reason = "Can't read/write files on web" }, // Used in build.rs files (which is fine).
55
+ ]
56
+
57
+ # Allow-list of words for markdown in dosctrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
58
+ doc-valid-idents = [
59
+ # You must also update the same list in the root `clippy.toml`!
60
+ "..",
61
+ "GitHub",
62
+ "GLB",
63
+ "GLTF",
64
+ "iOS",
65
+ "macOS",
66
+ "NaN",
67
+ "OBJ",
68
+ "OpenGL",
69
+ "PyPI",
70
+ "sRGB",
71
+ "sRGBA",
72
+ "WebGL",
73
+ "WebSocket",
74
+ "WebSockets",
75
+ ]
scripts/generate_changelog.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # Copied from https://github.com/rerun-io/rerun_template
3
+
4
+ """
5
+ Summarizes recent PRs based on their GitHub labels.
6
+
7
+ The result can be copy-pasted into CHANGELOG.md,
8
+ though it often needs some manual editing too.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import multiprocessing
15
+ import os
16
+ import re
17
+ import sys
18
+ from dataclasses import dataclass
19
+ from typing import Any, Optional
20
+
21
+ import requests
22
+ from git import Repo # pip install GitPython
23
+ from tqdm import tqdm
24
+
25
+ OWNER = "rerun-io"
26
+ REPO = "new_repo_name"
27
+ INCLUDE_LABELS = False # It adds quite a bit of visual noise
28
+ OFFICIAL_RERUN_DEVS = [
29
+ "abey79",
30
+ "emilk",
31
+ "jleibs",
32
+ "jprochazk",
33
+ "nikolausWest",
34
+ "teh-cmc",
35
+ "Wumpf",
36
+ ]
37
+
38
+
39
+ @dataclass
40
+ class PrInfo:
41
+ gh_user_name: str
42
+ pr_title: str
43
+ labels: list[str]
44
+
45
+
46
+ @dataclass
47
+ class CommitInfo:
48
+ hexsha: str
49
+ title: str
50
+ pr_number: Optional[int]
51
+
52
+
53
+ def get_github_token() -> str:
54
+ token = os.environ.get("GH_ACCESS_TOKEN", "")
55
+ if token != "":
56
+ return token
57
+
58
+ home_dir = os.path.expanduser("~")
59
+ token_file = os.path.join(home_dir, ".githubtoken")
60
+
61
+ try:
62
+ with open(token_file, encoding="utf8") as f:
63
+ token = f.read().strip()
64
+ return token
65
+ except Exception:
66
+ pass
67
+
68
+ print("ERROR: expected a GitHub token in the environment variable GH_ACCESS_TOKEN or in ~/.githubtoken")
69
+ sys.exit(1)
70
+
71
+
72
+ # Slow
73
+ def fetch_pr_info_from_commit_info(commit_info: CommitInfo) -> Optional[PrInfo]:
74
+ if commit_info.pr_number is None:
75
+ return None
76
+ else:
77
+ return fetch_pr_info(commit_info.pr_number)
78
+
79
+
80
+ # Slow
81
+ def fetch_pr_info(pr_number: int) -> Optional[PrInfo]:
82
+ url = f"https://api.github.com/repos/{OWNER}/{REPO}/pulls/{pr_number}"
83
+ gh_access_token = get_github_token()
84
+ headers = {"Authorization": f"Token {gh_access_token}"}
85
+ response = requests.get(url, headers=headers)
86
+ json = response.json()
87
+
88
+ # Check if the request was successful (status code 200)
89
+ if response.status_code == 200:
90
+ labels = [label["name"] for label in json["labels"]]
91
+ gh_user_name = json["user"]["login"]
92
+ return PrInfo(gh_user_name=gh_user_name, pr_title=json["title"], labels=labels)
93
+ else:
94
+ print(f"ERROR {url}: {response.status_code} - {json['message']}")
95
+ return None
96
+
97
+
98
+ def get_commit_info(commit: Any) -> CommitInfo:
99
+ match = re.match(r"(.*) \(#(\d+)\)", commit.summary)
100
+ if match:
101
+ title = str(match.group(1))
102
+ pr_number = int(match.group(2))
103
+ return CommitInfo(hexsha=commit.hexsha, title=title, pr_number=pr_number)
104
+ else:
105
+ return CommitInfo(hexsha=commit.hexsha, title=commit.summary, pr_number=None)
106
+
107
+
108
+ def remove_prefix(text: str, prefix: str) -> str:
109
+ if text.startswith(prefix):
110
+ return text[len(prefix) :]
111
+ return text # or whatever
112
+
113
+
114
+ def print_section(crate: str, items: list[str]) -> None:
115
+ if 0 < len(items):
116
+ print(f"#### {crate}")
117
+ for line in items:
118
+ print(f"* {line}")
119
+ print()
120
+
121
+
122
+ def main() -> None:
123
+ parser = argparse.ArgumentParser(description="Generate a changelog.")
124
+ parser.add_argument("--commit-range", help="e.g. 0.1.0..HEAD", required=True)
125
+ args = parser.parse_args()
126
+
127
+ repo = Repo(".")
128
+ commits = list(repo.iter_commits(args.commit_range))
129
+ commits.reverse() # Most recent last
130
+ commit_infos = list(map(get_commit_info, commits))
131
+
132
+ pool = multiprocessing.Pool()
133
+ pr_infos = list(
134
+ tqdm(
135
+ pool.imap(fetch_pr_info_from_commit_info, commit_infos),
136
+ total=len(commit_infos),
137
+ desc="Fetch PR info commits",
138
+ )
139
+ )
140
+
141
+ prs = []
142
+ unsorted_commits = []
143
+
144
+ for commit_info, pr_info in zip(commit_infos, pr_infos):
145
+ hexsha = commit_info.hexsha
146
+ title = commit_info.title
147
+ title = title.rstrip(".").strip() # Some PR end with an unnecessary period
148
+ pr_number = commit_info.pr_number
149
+
150
+ if pr_number is None:
151
+ # Someone committed straight to main:
152
+ summary = f"{title} [{hexsha[:7]}](https://github.com/{OWNER}/{REPO}/commit/{hexsha})"
153
+ unsorted_commits.append(summary)
154
+ else:
155
+ # We prefer the PR title if available
156
+ title = pr_info.pr_title if pr_info else title
157
+ labels = pr_info.labels if pr_info else []
158
+
159
+ if "exclude from changelog" in labels:
160
+ continue
161
+ if "typo" in labels:
162
+ # We get so many typo PRs. Let's not flood the changelog with them.
163
+ continue
164
+
165
+ summary = f"{title} [#{pr_number}](https://github.com/{OWNER}/{REPO}/pull/{pr_number})"
166
+
167
+ if INCLUDE_LABELS and 0 < len(labels):
168
+ summary += f" ({', '.join(labels)})"
169
+
170
+ if pr_info is not None:
171
+ gh_user_name = pr_info.gh_user_name
172
+ if gh_user_name not in OFFICIAL_RERUN_DEVS:
173
+ summary += f" (thanks [@{gh_user_name}](https://github.com/{gh_user_name})!)"
174
+
175
+ prs.append(summary)
176
+
177
+ # Clean up:
178
+ for i in range(len(prs)):
179
+ line = prs[i]
180
+ line = line[0].upper() + line[1:] # Upper-case first letter
181
+ prs[i] = line
182
+
183
+ print()
184
+ print(f"Full diff at https://github.com/rerun-io/{REPO}/compare/{args.commit_range}")
185
+ print()
186
+ print_section("PRs", prs)
187
+ print_section("Unsorted commits", unsorted_commits)
188
+
189
+
190
+ if __name__ == "__main__":
191
+ main()
scripts/template_update.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # Copied from https://github.com/rerun-io/rerun_template
3
+
4
+ """
5
+ The script has two purposes.
6
+
7
+ After using `rerun_template` as a template, run this to clean out things you don't need.
8
+ Use `scripts/template_update.py init --languages cpp,rust,python` for this.
9
+
10
+ Update an existing repository with the latest changes from the template.
11
+ Use `scripts/template_update.py update --languages cpp,rust,python` for this.
12
+
13
+ In either case, make sure the list of languages matches the languages you want to support.
14
+ You can also use `--dry-run` to see what would happen without actually changing anything.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import argparse
20
+ import os
21
+ import shutil
22
+ import tempfile
23
+
24
+ from git import Repo # pip install GitPython
25
+
26
+ OWNER = "rerun-io"
27
+
28
+ # Don't overwrite these when updating existing repository from the template
29
+ DO_NOT_OVERWRITE = {
30
+ "Cargo.lock",
31
+ "CHANGELOG.md",
32
+ "main.py",
33
+ "pixi.lock",
34
+ "README.md",
35
+ "requirements.txt",
36
+ }
37
+
38
+ # Files required by C++, but not by _both_ Python and Rust
39
+ CPP_FILES = {
40
+ ".clang-format",
41
+ ".github/workflows/cpp.yml",
42
+ "CMakeLists.txt",
43
+ "pixi.lock", # Pixi is only C++ & Python - For Rust we only use cargo
44
+ "pixi.toml", # Pixi is only C++ & Python - For Rust we only use cargo
45
+ "src/",
46
+ "src/main.cpp",
47
+ }
48
+
49
+ # Files required by Python, but not by _both_ C++ and Rust
50
+ PYTHON_FILES = {
51
+ ".github/workflows/python.yml",
52
+ ".mypy.ini",
53
+ "main.py",
54
+ "pixi.lock", # Pixi is only C++ & Python - For Rust we only use cargo
55
+ "pixi.toml", # Pixi is only C++ & Python - For Rust we only use cargo
56
+ "pyproject.toml",
57
+ "requirements.txt",
58
+ }
59
+
60
+ # Files required by Rust, but not by _both_ C++ and Python
61
+ RUST_FILES = {
62
+ ".github/workflows/rust.yml",
63
+ "bacon.toml",
64
+ "Cargo.lock",
65
+ "Cargo.toml",
66
+ "CHANGELOG.md", # We only keep a changelog for Rust crates at the moment
67
+ "clippy.toml",
68
+ "Cranky.toml",
69
+ "deny.toml",
70
+ "rust-toolchain",
71
+ "scripts/clippy_wasm/",
72
+ "scripts/clippy_wasm/clippy.toml",
73
+ "scripts/generate_changelog.py", # We only keep a changelog for Rust crates at the moment
74
+ "src/",
75
+ "src/lib.rs",
76
+ "src/main.rs",
77
+ }
78
+
79
+ # Files we used to have, but have been removed in never version of rerun_template
80
+ DEAD_FILES = ["bacon.toml", "Cranky.toml"]
81
+
82
+
83
+ def parse_languages(lang_str: str) -> set[str]:
84
+ languages = lang_str.split(",") if lang_str else []
85
+ for lang in languages:
86
+ assert lang in ["cpp", "python", "rust"], f"Unsupported language: {lang}"
87
+ return set(languages)
88
+
89
+
90
+ def calc_deny_set(languages: set[str]) -> set[str]:
91
+ """The set of files to delete/ignore."""
92
+ files_to_delete = CPP_FILES | PYTHON_FILES | RUST_FILES
93
+ if "cpp" in languages:
94
+ files_to_delete -= CPP_FILES
95
+ if "python" in languages:
96
+ files_to_delete -= PYTHON_FILES
97
+ if "rust" in languages:
98
+ files_to_delete -= RUST_FILES
99
+ return files_to_delete
100
+
101
+
102
+ def init(languages: set[str], dry_run: bool) -> None:
103
+ print("Removing all language-specific files not needed for languages {languages}.")
104
+ files_to_delete = calc_deny_set(languages)
105
+ delete_files_and_folder(files_to_delete, dry_run)
106
+
107
+
108
+ def remove_file(filepath: str):
109
+ try:
110
+ os.remove(filepath)
111
+ except FileNotFoundError:
112
+ pass
113
+
114
+
115
+ def delete_files_and_folder(paths: set[str], dry_run: bool) -> None:
116
+ repo_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
117
+ for path in paths:
118
+ full_path = os.path.join(repo_path, path)
119
+ if os.path.exists(full_path):
120
+ if os.path.isfile(full_path):
121
+ print(f"Removing file {full_path}…")
122
+ if not dry_run:
123
+ remove_file(full_path)
124
+ elif os.path.isdir(full_path):
125
+ print(f"Removing folder {full_path}…")
126
+ if not dry_run:
127
+ shutil.rmtree(full_path)
128
+
129
+
130
+ def update(languages: set[str], dry_run: bool) -> None:
131
+ for file in DEAD_FILES:
132
+ print(f"Removing dead file {file}…")
133
+ if not dry_run:
134
+ remove_file(file)
135
+
136
+ files_to_ignore = calc_deny_set(languages) | DO_NOT_OVERWRITE
137
+ repo_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
138
+
139
+ with tempfile.TemporaryDirectory() as temp_dir:
140
+ Repo.clone_from("https://github.com/rerun-io/rerun_template.git", temp_dir)
141
+ for root, dirs, files in os.walk(temp_dir):
142
+ for file in files:
143
+ src_path = os.path.join(root, file)
144
+ rel_path = os.path.relpath(src_path, temp_dir)
145
+
146
+ if rel_path.startswith(".git/"):
147
+ continue
148
+ if rel_path.startswith("src/"):
149
+ continue
150
+ if rel_path in files_to_ignore:
151
+ continue
152
+
153
+ dest_path = os.path.join(repo_path, rel_path)
154
+
155
+ print(f"Updating {rel_path}…")
156
+ if not dry_run:
157
+ os.makedirs(os.path.dirname(dest_path), exist_ok=True)
158
+ shutil.copy2(src_path, dest_path)
159
+
160
+
161
+ def main() -> None:
162
+ parser = argparse.ArgumentParser(description="Handle the Rerun template.")
163
+ subparsers = parser.add_subparsers(dest="command")
164
+
165
+ init_parser = subparsers.add_parser("init", help="Initialize a new checkout of the template.")
166
+ init_parser.add_argument(
167
+ "--languages", default="", nargs="?", const="", help="The languages to support (e.g. `cpp,python,rust`)."
168
+ )
169
+ init_parser.add_argument("--dry-run", action="store_true", help="Don't actually delete any files.")
170
+
171
+ update_parser = subparsers.add_parser(
172
+ "update", help="Update all existing Rerun repositories with the latest changes from the template"
173
+ )
174
+ update_parser.add_argument(
175
+ "--languages", default="", nargs="?", const="", help="The languages to support (e.g. `cpp,python,rust`)."
176
+ )
177
+ update_parser.add_argument("--dry-run", action="store_true", help="Don't actually delete any files.")
178
+
179
+ args = parser.parse_args()
180
+
181
+ if args.command == "init":
182
+ init(parse_languages(args.languages), args.dry_run)
183
+ elif args.command == "update":
184
+ update(parse_languages(args.languages), args.dry_run)
185
+ else:
186
+ parser.print_help()
187
+ exit(1)
188
+
189
+
190
+ if __name__ == "__main__":
191
+ main()
src/lib.rs ADDED
@@ -0,0 +1 @@
 
 
1
+ //! Example of a Rust library.
src/main.cpp ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #include <cstdio>
2
+
3
+ #include <rerun.hpp>
4
+
5
+ int main(int argc, const char* argv[]) {
6
+ printf("Hello, World!\n");
7
+ return 0;
8
+ }
src/main.rs ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ //! Example of a Rust binary.
2
+
3
+ fn main() {
4
+ println!("Hello, PROJ_NAME!");
5
+ }