Apply kinemotion development standards. Use when writing Python code, creating tests, modifying the kinemotion codebase, or reviewing code quality.
Always run before committing:
uv run ruff check --fix # Auto-fix linting
uv run ruff format # Format code
uv run pyright # Type check (strict)
uv run pytest # Run all tests
Or combined:
uv run ruff check --fix && uv run ruff format && uv run pyright && uv run pytest
| Metric | Target | Current |
|---|---|---|
| Test coverage | ā„ 50% | 80.86% |
| Code duplication | < 3% | 2.96% |
| Type errors | 0 | 0 |
| Lint errors | 0 | 0 |
Check duplication: npx jscpd src/kinemotion
NDArray[np.float64] for numpy arraysTypedDict for metric dictionariesLiteral for string unionsfrom numpy.typing import NDArray
from typing import TypedDict, Literal
QualityPreset = Literal["fast", "balanced", "accurate"]
class CMJMetrics(TypedDict):
jump_height_cm: float
flight_time_ms: float
src/kinemotion/
āāā cli.py # Main CLI entry point
āāā api.py # Public Python API
āāā core/ # Shared utilities
ā āāā validation.py # Base validation classes
ā āāā pose.py # MediaPipe wrapper
ā āāā filtering.py # Signal processing
ā āāā video_io.py # Video I/O handling
āāā cmj/ # CMJ analysis module
ā āāā cli.py # CMJ CLI subcommand
ā āāā analysis.py # Core CMJ algorithm
ā āāā kinematics.py # Velocity, position calc
ā āāā validation_bounds.py # CMJ-specific bounds
āāā dropjump/ # Drop jump module
āāā cli.py # Drop jump CLI subcommand
āāā analysis.py # Core drop jump algorithm
āāā validation_bounds.py # Drop jump bounds
Mirror source: tests/core/, tests/cmj/, tests/dropjump/, tests/cli/
Use centralized fixtures from tests/conftest.py:
cli_runner: Click test runnerminimal_video: Synthetic test videosample_video_path: Path to test fixture@pytest.mark.parametrize("input_data,expected", [
(np.array([]), None), # Empty
(np.array([1.0]), 1.0), # Single value
(np.array([np.nan, 1.0, 2.0]), None), # NaN handling
])
def test_edge_cases(input_data, expected):
...
| Aspect | CMJ | Drop Jump |
|---|---|---|
| Search direction | Backward (from peak) | Forward |
| Velocity type | Signed (direction matters) | Absolute (magnitude) |
| Key phase | Countermovement detection | Ground contact |
| Starting position | Floor level | Elevated (box) |
int(), float() before serializationUse Conventional Commits:
<type>(<scope>): <description>
Types: feat, fix, docs, test, refactor, perf, chore
Examples:
feat(cmj): add triple extension tracking
fix(dropjump): correct ground contact detection
test(core): add filtering edge case tests
ref_search_documentation and ref_read_url to consult external library documentation (OpenCV, MediaPipe, NumPy, etc.) when needing clarification on APIs.get_code_context_exa to find best practices and modern examples for specific coding tasks.save_memory or write_note (Serena) to persist important architectural decisions or validation results.