Skip to content

Commit

Permalink
Improve CONTRIBUTING.md (rerun-io#774)
Browse files Browse the repository at this point in the history
* Expand `CONTRIBUTING.md` with what to contribute, and how to get started

* Move instructions from how to run examples to examples/README.md

* Remove dummy README.md

* Link to the main setup section

* Remove extra word
  • Loading branch information
emilk authored Jan 16, 2023
1 parent 5044a49 commit 51726ad
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 28 deletions.
38 changes: 23 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,26 @@ This is written for anyone who wants to contribute to the Rerun repository.

Rerun is an open core company, and this repository is dual-licensed under MIT and APACHE. However, this repository is NOT YET open source, but IT WILL BE. Therefore we ask you to avoid making public clones of this repository, but in other respects treat it as any other open source GitHub project.

## Setup
First up, you need to install the Rust toolchain: <https://rustup.rs/>. Then run `./scripts/setup_dev.sh`.
## What to contribute
* **Examples**: We welcome any examples you would like to add. Follow the pattern of the existing examples in the [`examples/`](examples) folder.

## Structure
The main crates are found in the `crates/` folder, with examples in the `examples/` folder.
* **Bug reports and issues**: Open them at <https://github.com/rerun-io/rerun/issues>.

You can also look at our [`good first issue` tag](https://github.com/rerun-io/rerun/labels/good%20first%20issue).

## Pull Requests
We use [Trunk Based Development](https://trunkbaseddevelopment.com/), which means we encourage small, short-lived branches. Open draft PR:s to get some early feedback on your work.

All PR:s are merged with [`Squash and Merge`](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits), meaning they all get squashed to just one commit on the `main` branch. This means you don't need to keep a clean commit history on your feature branches. In fact, it is preferable to add new commits to a branch rather than rebasing or squashing. For one, it makes it easier to track progress on a branch, but rebasing and force-pushing also discourages collaboration on a branch.

Read about individual examples for details on how to run them.
## Getting started with the repository.
* Install the Rust toolchain: <https://rustup.rs/>
* `git clone [email protected]:rerun-io/rerun.git && cd rerun`
* Run `./scripts/setup_dev.sh`.
* Make sure `cargo --version` prints `1.65.0` once you are done

## Structure
The main crates are found in the [`crates/`](crates) folder, with examples in the [`examples/`](examples) folder.

To get an overview of the crates, read their documentation with:

Expand All @@ -27,25 +40,20 @@ cargo run -p rerun -- --help

We use the [`just`](https://github.com/casey/just) command runner tool for repository automation. See [here](https://github.com/casey/just#installation) for installation instructions. To see available automations, use `just --list`.

We use [cargo cranky](https://github.com/ericseppanen/cargo-cranky) and specify our clippy lints in `Cranky.toml`. Usage: `cargo cranky`.
We use [cargo cranky](https://github.com/ericseppanen/cargo-cranky) and specify our clippy lints in [`Cranky.toml`](Cranky.toml). Usage: `cargo cranky`.

We use [cargo deny](https://github.com/EmbarkStudios/cargo-deny) to check our dependency tree for copy-left licenses, duplicate dependencies and [rustsec advisories](https://rustsec.org/advisories). You can configure it in `deny.toml`. Usage: `cargo deny check`.

Configure your editor to run `cargo fmt` on save. Also configure it to strip trailing whitespace, an to end each file with a newline. Settings for VSCode can be found in the `.vscode` folder and should be applied automatically. If you are using another editor, consider adding good setting to this repository!
Configure your editor to run `cargo fmt` on save. Also configure it to strip trailing whitespace, and to end each file with a newline. Settings for VSCode can be found in the `.vscode` folder and should be applied automatically. If you are using another editor, consider adding good setting to this repository!

To check everything in one go, run `./scripts/check.sh`. `check.sh` should ideally check approximately the same things as our CI.

### Optional
You can use [bacon](https://github.com/Canop/bacon) to automatically check your code on each save. For instance, running just `bacon` will re-run `cargo cranky` each time you change a rust file. See `bacon.toml` for more.
You can use [bacon](https://github.com/Canop/bacon) to automatically check your code on each save. For instance, running just `bacon` will re-run `cargo cranky` each time you change a rust file. See [`bacon.toml`](bacon.toml) for more.

### Other
You can view higher log levels with `export RUST_LOG=debug` or `export RUST_LOG=trace`.

## Pull Requests
We use [Trunk Based Development](https://trunkbaseddevelopment.com/), which means we encourage small, short-lived branches.

All PR:s are all merged with [`Squash and Merge`](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges#squash-and-merge-your-commits), meaning they all get squashed to just one commit on the `main` branch. This means you don't need to keep a clean commit history on your feature branches. In fact, it is preferable to add new commits to a branch rather than rebasing or squashing. For one, it makes it easier to track progress on a branch, and secondly it is more difficult to collaborate on a branch if one user is rebasing it.

## Rust code

### Error handling and logging
Expand Down Expand Up @@ -142,9 +150,9 @@ Points, vectors, rays etc all live in different _spaces_. Whenever there is room
Here are some of our standard spaces:

* `ui`: coordinate system used by `egui`, measured in logical pixels ("points"), with origin in the top left
* `image`: image pixel coordinates, possibly with an added z=depth
* `image`: image pixel coordinates, possibly with an added `z=depth`
* `space`: a user-defined space where they log stuff into
* `world`: the common coordinate system of a 3D screen, usually same as `space`
* `world`: the common coordinate system of a 3D scene, usually same as `space`
* `view`: X=right, Y=down, Z=back, origin = center of screen

#### Matrices
Expand Down
12 changes: 0 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ pip install ./rerun_py
## Getting started with examples
The easiest way to get started is to run and look at [`examples`](examples).

### Install dependencies and run an example
Each example comes with its own set of dependencies listed in a `requirements.txt` file. To install dependencies and run the `car` example (a toy example that doesn't need to download data) run:
```sh
pip install -r examples/car/requirements.txt # Install the dependencies needed to run the car example
python examples/car/main.py
```
You can install dependencies needed run all examples by running:
```sh
pip install -r examples/requirements.txt # Install the dependencies needed to run all car examples
```

> Note: The Stable Diffusion currently requires installing `diffusers` and `transformers` directly from main. To install run `pip install -U -r examples/stable_diffusion/requirements.txt`.

### Buffered or live visualization
By default, the examples run in buffered mode. This means they run through the whole example, and then show the viewer (UI) at the end in the same process by calling blocking function `rerun.show()`.
Expand Down
1 change: 0 additions & 1 deletion crates/README.md

This file was deleted.

24 changes: 24 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Rerun Examples
## Setup
First follow [the main setup instructions](https://github.com/rerun-io/rerun#setup).

## Running the examples
Each example comes with its own set of dependencies listed in a `requirements.txt` file. For example, to install dependencies and run the toy `car` example (which doesn't need to download any data) run:

```sh
pip install -r examples/car/requirements.txt
examples/car/main.py
```

You can also install all dependencies needed to run all examples with:

```sh
pip install -r examples/requirements.txt
```

> Note: The `stable_diffusion` example requires installing `diffusers` and `transformers` directly from main. To install run `pip install -U -r examples/stable_diffusion/requirements.txt`.
## Contributions welcome
Feel free to open a PR to add a new example!

See [`CONTRIBUTING.md`](../CONTRIBUTING.md) for details on how to contribute.

0 comments on commit 51726ad

Please sign in to comment.