First off, thank you for considering contributing to Copper-rs! We welcome contributions from everyone. This document provides guidelines for contributing to the project.
- Rust: Ensure you have a recent stable Rust toolchain installed. You can install it using rustup.
curl --proto '=https' --tlsv1.2 -sSf [https://sh.rustup.rs](https://sh.rustup.rs) | sh
- cargo-nextest: For running tests efficiently.
cargo install cargo-nextest
- Platform-Specific Dependencies: Depending on your operating system and the features you intend to work with, you might need additional dependencies. Refer to the Continuous Integration Setup section below for details extracted from our CI workflow. For Ubuntu 22.04, please checkout our Dockerfile.
To build the project, navigate to the root directory and run:
cargo build --workspaceFor a release build, use:
cargo build --release --workspaceWe use cargo-nextest for running tests. To run all unit tests:
cargo nextest run --workspace --all-targetsTo run tests including specific features (matching the CI 'debug' mode non-CUDA features):
cargo nextest run --workspace --all-targets --features macro_debug,mock,perf-ui,image,kornia,python,gst,faer,nalgebra,glam,debug_pane,bincode-
Fork the Repository: Create your own fork of the copper-rs repository on GitHub.
-
Clone Your Fork: Clone your forked repository to your local machine.
git clone https://github.com/YOUR_USERNAME/copper-rs.git cd copper-rs -
Create a Branch: Create a new branch for your changes. Choose a descriptive branch name. ex:
yang/chore/beta_clippy,gbin/feat/soa,gbin/fix/balancebot_sim.git checkout -b user/feat/description
-
Make Changes: Implement your feature or fix the bug. Write clear and concise code.
-
Run Checks: Before committing, ensure your code adheres to the project's standards:
- Formatting:
cargo fmt --all -- --check - Clippy Lints:
cargo clippy --workspace --all-targets -- --deny warnings - Tests:
cargo nextest run --workspace --all-targets(run with relevant features if applicable) - Typos: Ensure you run a spell checker. We use
typos --config .config/_typos.toml.
- Formatting:
-
Commit and push Changes: Commit your changes with clear and descriptive commit messages. (Consider using Conventional Commits)
git add . git commit -m "feat: new feature" git push user/feat/description
-
Create a Pull Request: Open a pull request (PR) from your branch to the master branch of the main copper-rs repository. Provide a clear description of your changes in the PR.
We keep our dependencies minimal and up-to-date.
We use cargo-machete to identify and remove unused dependencies. Before submitting a PR, please run:
- Install
cargo-machete
cargo install cargo-machete- Run
cargo-macheteto find unused dependencies:
cargo machete --with-metadata- Handling False Positives
cargo-machete is not perfect. If it incorrectly flags a necessary dependency (e.g., required by a feature flag or build script), add it to the ignored list in the relevant Cargo.toml file:
[package.metadata.cargo-machete]
# Explain *why* the dependency is needed despite not being directly used in code.
# e.g. "Required for X feature" or "Used in build.rs"
ignored = ["some-crate", "another-crate"]If you encounter a bug or have a feature suggestion, please open an issue on the GitHub repository. Provide as much detail as possible, including:
- A clear description of the issue or feature.
- Steps to reproduce the bug (if applicable).
- Your operating system and Rust version.
- Relevant logs or error messages.