# How to contribute to 🤗 LeRobot

Everyone is welcome to contribute, and we value everybody's contribution. Code is not the only way to help the community. Answering questions, helping others, reaching out, and improving the documentation are immensely valuable.

Whichever way you choose to contribute, please be mindful to respect our [code of conduct](https://github.com/huggingface/lerobot/blob/main/CODE_OF_CONDUCT.md) and our [AI policy](https://github.com/huggingface/lerobot/blob/main/AI_POLICY.md).

## Ways to Contribute

You can contribute in many ways:

- **Fixing issues:** Resolve bugs or improve existing code.
- **New features:** Develop new features.
- **Extend:** Implement new models/policies, robots, or simulation environments and upload datasets to the Hugging Face Hub.
- **Documentation:** Improve examples, guides, and docstrings.
- **Feedback:** Submit tickets related to bugs or desired new features.

**Adding new hardware?** Robots, teleoperators, and cameras usually work best as a standalone plugin package rather than a change to the core library. Follow [Bring Your Own Hardware](https://huggingface.co/docs/lerobot/integrate_hardware#using-your-own-lerobot-devices-), publish your package, then open a PR adding it to [Third-Party Robots & Teleoperators](https://huggingface.co/docs/lerobot/third_party_robots) or [Third-Party Cameras & Sensors](https://huggingface.co/docs/lerobot/third_party_sensors).

If you are unsure where to start, join our [Discord Channel](https://discord.gg/s3KuuzsPFb).

## Development Setup

To contribute code, you need to set up a development environment.

### 1. Fork and Clone

Fork the repository on GitHub, then clone your fork:

```bash
git clone https://github.com/<your-handle>/lerobot.git
cd lerobot
git remote add upstream https://github.com/huggingface/lerobot.git
```

### 2. Environment Installation

Please follow our [Installation Guide](https://huggingface.co/docs/lerobot/installation) for the environment setup & installation from source.

## Running Tests & Quality Checks

### Code Style (Pre-commit)

Install `pre-commit` hooks to run checks automatically before you commit:

```bash
pre-commit install
```

To run checks manually on all files:

```bash
pre-commit run --all-files
```

### Docstrings

The API reference is generated from the docstrings in `src/lerobot/`. If you add or change anything public, follow the [docstring standard](https://huggingface.co/docs/lerobot/writing_docstrings) — the format is parsed by the renderer and checked in CI.

### Running Tests

We use `pytest`. First, ensure you have test artifacts by installing **git-lfs**:

```bash
git lfs install
git lfs pull
```

Run the full suite (this may require extras installed):

```bash
pytest -sv ./tests
```

Or run a specific test file during development:

```bash
pytest -sv tests/test_specific_feature.py
```

The Fast Tests CI runs one tier per extra (`base`, `dataset`, `hardware`, `viz`) and selects the tests of each tier with a pytest mark. If your test needs the `dataset`, `hardware` or `viz` extra, mark it (`pytestmark = pytest.mark.dataset` for a whole file, `@pytest.mark.dataset` for one test). Unmarked tests run in the `base` tier only, where a test that needs an extra is skipped. To run one tier locally:

```bash
pytest -sv tests -m dataset
```

The GPU Tests CI only runs tests marked `gpu`. Every test under `tests/policies` and every `@require_cuda` test gets it automatically; mark any other test that uses CUDA with `@pytest.mark.gpu`.

## Submitting Issues & Pull Requests

Use the templates for required fields and examples.

- **Issues:** Follow the [ticket template](https://github.com/huggingface/lerobot/blob/main/.github/ISSUE_TEMPLATE/bug-report.yml).
- **Pull requests:** Rebase on `upstream/main`, use a descriptive branch (don't work on `main`), run `pre-commit` and tests locally, and follow the [PR template](https://github.com/huggingface/lerobot/blob/main/.github/PULL_REQUEST_TEMPLATE.md).

> [!IMPORTANT]
> Community Review Policy: To help scale our efforts and foster a collaborative environment, we ask contributors to review at least one other person's open PR before their own receives attention. This shared responsibility multiplies our review capacity and helps everyone's code get merged faster!

Once you have submitted your PR and completed a peer review, a member of the LeRobot team will review your contribution.

Thank you for contributing to LeRobot!

