Skip to content
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

Better getting-started instructions #4

Merged
merged 6 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ target_wasm

# Pixi environment
.pixi

# Python stuff:
__pycache__
.mypy_cache
.ruff_cache
venv
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
},
// Rust:
{
"name": "Debug 'rerun_template'",
"name": "Debug 'PROJ_NAME'",
"type": "lldb",
"request": "launch",
"cargo": {
"args": [
"build"
],
"filter": {
"name": "rerun_template",
"name": "PROJ_NAME",
"kind": "bin"
}
},
Expand Down
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16...3.27)

project(rerun_template LANGUAGES CXX) # TODO
project(PROJ_NAME LANGUAGES CXX)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand All @@ -13,6 +13,6 @@ include(FetchContent)
FetchContent_Declare(rerun_sdk URL https://github.com/rerun-io/rerun/releases/download/0.15.1/rerun_cpp_sdk.zip)
FetchContent_MakeAvailable(rerun_sdk)

add_executable(rerun_template src/main.cpp) # TODO
target_link_libraries(rerun_template rerun_sdk) # TODO
target_include_directories(rerun_template PRIVATE src) # TODO
add_executable(PROJ_NAME src/main.cpp)
target_link_libraries(PROJ_NAME rerun_sdk)
target_include_directories(PROJ_NAME PRIVATE src)
2 changes: 1 addition & 1 deletion Cargo.lock

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

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
[package]
authors = ["rerun.io <opensource@rerun.io>"]
categories = [] # TODO
description = "" # TODO
categories = [] # TODO: fill in if you plan on publishing the crate
description = "" # TODO: fill in if you plan on publishing the crate
edition = "2021"
homepage = "https://github.com/rerun-io/rerun_template" # TODO
homepage = "https://github.com/rerun-io/new_repo_name"
include = ["LICENSE-APACHE", "LICENSE-MIT", "**/*.rs", "Cargo.toml"]
keywords = [] # TODO
keywords = [] # TODO: fill in if you plan on publishing the crate
license = "MIT OR Apache-2.0"
name = "rerun_template" # TODO
name = "new_project_name"
publish = false # TODO: set to `true` if you plan on publishing the crate
readme = "README.md"
repository = "https://github.com/rerun-io/rerun_template" # TODO
repository = "https://github.com/rerun-io/new_repo_name"
rust-version = "1.76"
version = "0.1.0"

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ This template includes
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).

Then follow these steps:
* Search and replace `rerun_template` with the name of the repository
* Run `scripts/template_update.py init --languages cpp,rust,python` to delete files you don't need (give the languages you need support for)
* Search and replace all instances of `new_repo_name` with the name of the repository.
* Search and replace all instances of `new_project_name` with the name of the project (crate/binary name).
* Search for `TODO` and fill in all those places
* Replace this `README.md` with something better
* Commit!
Expand Down
4 changes: 1 addition & 3 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ all-features = true

[advisories]
version = 2
ignore = [
"RUSTSEC-2023-0081", # TODO(#5998): unmaintained crate "safemem" pulled in by "cargo-run-wasm"
]
ignore = []


[bans]
Expand Down
33 changes: 2 additions & 31 deletions lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,35 +77,6 @@ exclude = [
'https://github.com/rerun-io/rerun/commit/\.*', # Ignore links to our own commits (typically in changelog).
'https://github.com/rerun-io/rerun/pull/\.*', # Ignore links to our own pull requests (typically in changelog).

# Intentionally faked links.
'file://foo',
'http://foo.com/',
'https://link.to',
'https://static.rerun.io/my_screenshot/',

# Link fragments and data links in examples.
'https://raw.githubusercontent.com/googlefonts/noto-emoji/', # URL fragment.
'https://static.rerun.io/rgbd_dataset', # Base data link for rgbd dataset.
'https://storage.googleapis.com/', # Storage API entrypoint, not a link.

# Not accessible from CI.
'.github/workflows/.*.yml', # GitHub action workflows cause issues on CI.
'https://stackoverflow.com/.', # Stackoverflow links are no longer accessible from CI.
'https://www.tensorflow.org/', # tensorflow.org apparently blocks CI.
'https://9p.io/sys/doc/lexnames.html', # Works locally but on ci we get: `Failed: Network error: error:0A000152:SSL routines:final_renegotiate:unsafe legacy renegotiation disabled:ssl/statem/extensions.c:946:`

# Need GitHub login.
'https://github.com/rerun-io/landing',
'https://github.com/rerun-io/documentation',

# Temporarily down or not accessible.
'https://cs.nyu.edu/~silberman/datasets/nyu_depth_v2.html', # Nyud links are down every now and then.
'https://eigen.tuxfamily.org/', # Website down https://gitlab.com/libeigen/eigen/-/issues/2804
'https://github.com/rerun-io/rerun/releases/download/prerelease', # Pre-release downloads may go down while a pre-release updates or pre-release CI partially breaks.

# Works but is really slow at times:
'https://openaccess.thecvf.com/content/CVPR2023/html/Du_Learning_To_Render_Novel_Views_From_Wide-Baseline_Stereo_Pairs_CVPR_2023_paper.html',
'https://anaconda.org/conda-forge/arrow-cpp',

#'^file:///', # Ignore local file links. They need to be tested, but it's useful for external links we have to ping.
# Used in rerun_template repo until the user search-replaces `new_repo_name`
'https://github.com/rerun-io/new_repo_name',
]
11 changes: 11 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python3

from __future__ import annotations


def main() -> None:
pass


if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
# and `pixi run TASK` to run it (e.g. `pixi run example`).

[project]
name = "rerun_template" # TODO
name = "new_project_name"
authors = ["rerun.io <opensource@rerun.io>"]
channels = ["conda-forge"]
description = "rerun_template" # TODO
description = "new_project_name"
homepage = "https://rerun.io"
license = "MIT OR Apache-2.0"

platforms = ["linux-64", "linux-aarch64", "osx-arm64", "osx-64", "win-64"]
readme = "README.md"
repository = "https://github.com/rerun-io/rerun_template" # TODO
repository = "https://github.com/rerun-io/new_repo_name"
version = "0.1.0"


Expand All @@ -39,7 +39,7 @@ build = { cmd = "cmake --build build --config RelWithDebInfo --target all", depe
] }

# Run C++ example
example = { cmd = "build/rerun_template", depends_on = ["build"] }
example = { cmd = "build/PROJ_NAME", depends_on = ["build"] }

# Format C++ code
cpp-fmt = { cmd = "clang-format -i src/*.[hc]pp" }
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ extend-exclude = [
]

lint.ignore = [
# Missing docstring in public function - TODO(emilk): enable for SDK but not for examples
"D1",
# These makes sense to ignore in example code, but for a proper library we should not ignore these.
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D103", # Missing docstring in public function

# No blank lines allowed after function docstring.
"D202",
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rerun-sdk>=0.15.0,<0.16.0
2 changes: 1 addition & 1 deletion scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from tqdm import tqdm

OWNER = "rerun-io"
REPO = "rerun_template" # TODO: Change this to the name of the repo
REPO = "new_repo_name"
INCLUDE_LABELS = False # It adds quite a bit of visual noise
OFFICIAL_RERUN_DEVS = [
"abey79",
Expand Down
21 changes: 12 additions & 9 deletions scripts/template_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
PYTHON_FILES = {
".github/workflows/python.yml",
".mypy.ini",
"main.py",
"pixi.lock", # Not needed by Rust
"pixi.toml", # Not needed by Rust
"pyproject.toml",
"requirements.txt",
}

# Files requires by Rust, but not by both C++ or Python
Expand Down Expand Up @@ -104,7 +106,10 @@ def delete_files_and_folder(paths: set[str], dry_run: bool) -> None:


def update(languages: set[str], dry_run: bool) -> None:
files_to_ignore = calc_deny_set(languages)
# Don't overwrite these
ALWAYS_IGNORE_FILES = {"README.md", "pixi.lock", "Cargo.lock", "main.py", "requirements.txt"}

files_to_ignore = calc_deny_set(languages) | ALWAYS_IGNORE_FILES
repo_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

with tempfile.TemporaryDirectory() as temp_dir:
Expand All @@ -118,17 +123,15 @@ def update(languages: set[str], dry_run: bool) -> None:
continue
if rel_path.startswith("src/"):
continue

if rel_path in {"README.md", "pixi.lock", "Cargo.lock"}:
if rel_path in files_to_ignore:
continue

if rel_path not in files_to_ignore:
dest_path = os.path.join(repo_path, rel_path)
dest_path = os.path.join(repo_path, rel_path)

print(f"Updating {rel_path}…")
if not dry_run:
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
shutil.copy2(src_path, dest_path)
print(f"Updating {rel_path}…")
if not dry_run:
os.makedirs(os.path.dirname(dest_path), exist_ok=True)
shutil.copy2(src_path, dest_path)


def main() -> None:
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
fn main() {
println!("Hello, rerun_template!");
println!("Hello, PROJ_NAME!");
}
Loading