docs/CONTRIBUTING
Contributing to Nebble
Thank you for your interest in contributing to Nebble! This project aims to provide a robust, idiomatic Nim wrapper for the Pebble SDK.
Getting Started
- Fork the repository on GitHub.
- Clone your fork locally.
- Install dependencies:
- Nim (>= 2.2.0, installed via choosenim recommended)
- Pebble SDK (installed and in PATH)
- nimble install -d (installs test dependencies)
Development Workflow
We use the nebble CLI tool (which is built from this repo) to build and test examples.
Build the CLI:
cd cli
nimble build
# Install the CLI locally
nimble install_local
Run Tests:
nimble test
This runs unit tests, compile-only tests for all platforms, and builds all example apps.
Code Style
We follow standard Nim style conventions (NEP 1).
Naming Conventions
- Types: PascalCase (e.g., WindowHandle)
- Procs/Vars/Fields: camelCase (e.g., newWindow, backgroundColor)
- Constants: PascalCase or UPPER_SNAKE_CASE for FFI-level constants (e.g., GColorBlack)
- Modules: snake_case (standard Nim practice, though we prefer descriptive names)
Spacing and Indentation
- Use 2 spaces for indentation.
- No tabs.
- Use spaces around operators (e.g., x + y, not x+y).
Documentation
- Use double hashes ## for documentation comments.
- All exported procs must have documentation.
Managed Types (ARC)
Nebble uses Nim's ARC memory management to wrap Pebble C resources.
- Always use DefineUniqueHandle template for new types where possible.
- Ensure destructors are safe (check for double-free).
- Use {.inline.} for trivial wrappers to ensure zero overhead.
Adding Features
- Low-Level FFI: If a Pebble API is missing, check src/nebble/ffi/generated/. If it's not there, you may need to regenerate bindings (see nebble.nimble regenFfi task).
- High-Level Wrapper: Add a module in src/nebble/ui/, src/nebble/foundation/, etc.
- Documentation: Add doc comments (##) to all exported procs.
- Tests: Add a test case in tests/ or update an example app to demonstrate the feature.
Pull Requests
- Keep PRs focused on a single feature or fix.
- Ensure nimble test passes.
- Update documentation if API changes.
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Made with Nim. Generated: 2026-03-04 13:16:42 UTC