How talmolab/sleap-io works
Project type and purpose
• sleap-io is a standalone Python library (no GUI) providing utilities to load, convert, and save animal pose-tracking data in multiple file formats. It complements the core SLEAP package by focusing solely on I/O and data manipulation, with minimal dependencies.
File structure
• Top-level directories:
• sleap_io/
– model/ : Core in-memory data structures (Labels, LabeledFrame, Instance, Skeleton, Camera, Video, etc.)
– io/ : Format-specific readers and writers (SLP, NWB, COCO, DeepLabCut, JABS, LabelStudio, Ultralytics, etc.), plus CLI entry point
• scripts/ : Utility scripts for coverage, changelog, ref-page, version reordering
• docs/ : MkDocs documentation site (assets, CSS, markdown guides)
• tests/ : Pytest suites for I/O modules, model behaviors, video reading/writing, integration tests
• .github/ : CI/CD workflows (Lint, CI, docs, code review)
• config (pyproject.toml, environment.yml, mkdocs.yml, codecov.yml)
• Architectural patterns
• Layered design:
– Core Model layer (defines data)
– I/O layer (adapts between files and model)
– CLI layer (exposes commands)
– Scripts and Docs (auxiliary tooling)
• Plugin-like I/O modules: each file format has its own submodule implementing load/save via a common interface.
• Factory pattern in io/main.py for dispatching based on file extension.
README for additional insights
• Emphasizes minimal dependencies, optional extras for video backends (opencv, ffmpeg, pyav).
• Demonstrates typical usage: load_slp, save_file, load_video, model instantiation.
• Notes that there is no labeling/training/inference in this package.
Detail
• How dependency injection or factory dispatch works for format readers.