Getting Started
Codebase Structure
Understanding where to make changes:| What you’re changing | Where to look |
|---|---|
| CLI behavior, command args, auto-detection | src/lib.rs |
| COCO format adapter | src/ir/io_coco_json.rs |
| CVAT format adapter | src/ir/io_cvat_xml.rs |
| Label Studio format adapter | src/ir/io_label_studio_json.rs |
| TFOD format adapter | src/ir/io_tfod_csv.rs |
| YOLO format adapter | src/ir/io_yolo.rs |
| Pascal VOC format adapter | src/ir/io_voc_xml.rs |
| Lossiness and conversion policy | src/conversion/mod.rs |
| Stable conversion issue codes | src/conversion/report.rs |
| CLI integration tests | tests/cli.rs |
| Format roundtrip tests | tests/*_roundtrip.rs |
Module Organization
src/lib.rs: Library entry point with CLI command dispatchsrc/main.rs: Thin CLI wrapper that calls into the librarysrc/ir/: Intermediate Representation module (model, bbox, converters)src/conversion/: Conversion lossiness analysis and stable report issue codessrc/inspect/: Dataset inspection/statistics logicsrc/validation/: Dataset validation logictests/: Integration and property-based testsdocs/: User and contributor documentationbenches/: Criterion benchmarksfuzz/: Cargo-fuzz targets for parser fuzzingscripts/: Utility scripts (dataset generator)
Testing Approach
Panlabel uses three types of tests:1. Unit Tests
Located within source files using#[cfg(test)]:
2. Integration Tests
Located intests/ directory, testing CLI behavior and format roundtrips:
3. Property-Based Tests
Usingproptest for roundtrip and idempotency checks:
Fuzzing
Panlabel includes fuzz targets for all parsers. Fuzzing requires nightly Rust andcargo-fuzz:
fuzz/corpus/<target>/.
The
fuzz/Cargo.toml enables panlabel’s fuzzing feature so parser entrypoints are available to fuzz targets.Benchmarks
Performance benchmarks use Criterion:Generating Synthetic Test Data
For testing with larger datasets, use the included generator:Adding a New Format
Create the format adapter
Add a new file in
src/ir/ following the naming convention io_<format>_<extension>.rs:Contribution Workflow
Update documentation
If your change affects user-visible behavior, update the relevant docs:
| Behavior change | Update |
|---|---|
| CLI flags or commands | docs/cli.md and README.md examples |
| Format read/write behavior | docs/formats.md |
| Task or use-case support | docs/tasks.md |
| Lossiness, report schema, or issue codes | docs/conversion.md |
Commit and push
What Contributions Are Welcome?
Here are some areas where help is especially welcome:New Format Adapters
Support for additional annotation formats like:- Labelbox
- Supervisely
- VGG Image Annotator (VIA)
- Custom enterprise formats
Better Error Messages
If a Panlabel error confused you, that’s a bug worth fixing. Clear, actionable error messages help everyone.Test Coverage
Especially:- Edge cases in existing formats
- Roundtrip tests for complex scenarios
- Property-based tests for invariants
Documentation Improvements
- Clearer explanations
- Better examples
- Typo fixes
- Use case tutorials
For larger changes (new formats, IR schema changes), please open an issue first so we can discuss the approach before you invest time writing code.
Coding Style & Conventions
- Follow
rustfmtdefaults (4-space indentation, standard Rust formatting) - Run
cargo fmtandcargo clippybefore opening a PR - Naming conventions:
snake_casefor functions/modules/testsCamelCasefor typesSCREAMING_SNAKE_CASEfor constants
- Keep CLI glue in
src/main.rs; put core behavior insrc/lib.rsor its modules
Development Commands
Guidelines
- Don’t claim unsupported capabilities: Current scope is detection bounding boxes only (not segmentation, pose/keypoints, OBB, or classification-only)
- Prefer small, concrete examples that match tested behavior
- Write tests for new behavior — if it’s not tested, it can silently break
- Keep generated assets out of git; only commit code and fixtures meant to be versioned
- Never add anything under
design/to git history (it is gitignored for a reason)
Getting Help
Need help with your contribution?- Check existing issues and PRs for similar work
- Open an issue to discuss your idea
- Review the existing code for patterns and conventions
- Read through the test suite for examples