|
| 1 | +# Contributing to nanobot |
| 2 | + |
| 3 | +Thank you for being here. |
| 4 | + |
| 5 | +nanobot is built with a simple belief: good tools should feel calm, clear, and humane. |
| 6 | +We care deeply about useful features, but we also believe in achieving more with less: |
| 7 | +solutions should be powerful without becoming heavy, and ambitious without becoming |
| 8 | +needlessly complicated. |
| 9 | + |
| 10 | +This guide is not only about how to open a PR. It is also about how we hope to build |
| 11 | +software together: with care, clarity, and respect for the next person reading the code. |
| 12 | + |
| 13 | +## Maintainers |
| 14 | + |
| 15 | +| Maintainer | Focus | |
| 16 | +|------------|-------| |
| 17 | +| [@re-bin](https://github.com/re-bin) | Project lead, `main` branch | |
| 18 | +| [@chengyongru](https://github.com/chengyongru) | `nightly` branch, experimental features | |
| 19 | + |
| 20 | +## Branching Strategy |
| 21 | + |
| 22 | +We use a two-branch model to balance stability and exploration: |
| 23 | + |
| 24 | +| Branch | Purpose | Stability | |
| 25 | +|--------|---------|-----------| |
| 26 | +| `main` | Stable releases | Production-ready | |
| 27 | +| `nightly` | Experimental features | May have bugs or breaking changes | |
| 28 | + |
| 29 | +### Which Branch Should I Target? |
| 30 | + |
| 31 | +**Target `nightly` if your PR includes:** |
| 32 | + |
| 33 | +- New features or functionality |
| 34 | +- Refactoring that may affect existing behavior |
| 35 | +- Changes to APIs or configuration |
| 36 | + |
| 37 | +**Target `main` if your PR includes:** |
| 38 | + |
| 39 | +- Bug fixes with no behavior changes |
| 40 | +- Documentation improvements |
| 41 | +- Minor tweaks that don't affect functionality |
| 42 | + |
| 43 | +**When in doubt, target `nightly`.** It is easier to move a stable idea from `nightly` |
| 44 | +to `main` than to undo a risky change after it lands in the stable branch. |
| 45 | + |
| 46 | +### How Does Nightly Get Merged to Main? |
| 47 | + |
| 48 | +We don't merge the entire `nightly` branch. Instead, stable features are **cherry-picked** from `nightly` into individual PRs targeting `main`: |
| 49 | + |
| 50 | +``` |
| 51 | +nightly ──┬── feature A (stable) ──► PR ──► main |
| 52 | + ├── feature B (testing) |
| 53 | + └── feature C (stable) ──► PR ──► main |
| 54 | +``` |
| 55 | + |
| 56 | +This happens approximately **once a week**, but the timing depends on when features become stable enough. |
| 57 | + |
| 58 | +### Quick Summary |
| 59 | + |
| 60 | +| Your Change | Target Branch | |
| 61 | +|-------------|---------------| |
| 62 | +| New feature | `nightly` | |
| 63 | +| Bug fix | `main` | |
| 64 | +| Documentation | `main` | |
| 65 | +| Refactoring | `nightly` | |
| 66 | +| Unsure | `nightly` | |
| 67 | + |
| 68 | +## Development Setup |
| 69 | + |
| 70 | +Keep setup boring and reliable. The goal is to get you into the code quickly: |
| 71 | + |
| 72 | +```bash |
| 73 | +# Clone the repository |
| 74 | +git clone https://github.com/HKUDS/nanobot.git |
| 75 | +cd nanobot |
| 76 | + |
| 77 | +# Install with dev dependencies |
| 78 | +pip install -e ".[dev]" |
| 79 | + |
| 80 | +# Run tests |
| 81 | +pytest |
| 82 | + |
| 83 | +# Lint code |
| 84 | +ruff check nanobot/ |
| 85 | + |
| 86 | +# Format code |
| 87 | +ruff format nanobot/ |
| 88 | +``` |
| 89 | + |
| 90 | +## Code Style |
| 91 | + |
| 92 | +We care about more than passing lint. We want nanobot to stay small, calm, and readable. |
| 93 | + |
| 94 | +When contributing, please aim for code that feels: |
| 95 | + |
| 96 | +- Simple: prefer the smallest change that solves the real problem |
| 97 | +- Clear: optimize for the next reader, not for cleverness |
| 98 | +- Decoupled: keep boundaries clean and avoid unnecessary new abstractions |
| 99 | +- Honest: do not hide complexity, but do not create extra complexity either |
| 100 | +- Durable: choose solutions that are easy to maintain, test, and extend |
| 101 | + |
| 102 | +In practice: |
| 103 | + |
| 104 | +- Line length: 100 characters (`ruff`) |
| 105 | +- Target: Python 3.11+ |
| 106 | +- Linting: `ruff` with rules E, F, I, N, W (E501 ignored) |
| 107 | +- Async: uses `asyncio` throughout; pytest with `asyncio_mode = "auto"` |
| 108 | +- Prefer readable code over magical code |
| 109 | +- Prefer focused patches over broad rewrites |
| 110 | +- If a new abstraction is introduced, it should clearly reduce complexity rather than move it around |
| 111 | + |
| 112 | +## Questions? |
| 113 | + |
| 114 | +If you have questions, ideas, or half-formed insights, you are warmly welcome here. |
| 115 | + |
| 116 | +Please feel free to open an [issue](https://github.com/HKUDS/nanobot/issues), join the community, or simply reach out: |
| 117 | + |
| 118 | +- [Discord](https://discord.gg/MnCvHqpUGB) |
| 119 | +- [Feishu/WeChat](./COMMUNICATION.md) |
| 120 | +- Email: Xubin Ren (@Re-bin) — <xubinrencs@gmail.com> |
| 121 | + |
| 122 | +Thank you for spending your time and care on nanobot. We would love for more people to participate in this community, and we genuinely welcome contributions of all sizes. |
0 commit comments