- Install dev dependencies first:
uv pip install -e '.[dev]'(required for pytest and other dev tools) - Run all tests:
./meta/unit_tests.sh(usesuv run pytest --doctest-modules) - Run single test:
uv run pytest tests/path/to/test_file.py::test_function_name - Run static analysis:
./meta/static_tests.sh - Fix formatting:
./meta/autofix.sh
- Run type checking:
ty check(checks entire codebase) - Run type checking on specific files:
ty check path/to/file.py - Run type checking on directory:
ty check path/to/directory/ - Note: Install dev dependencies first with
uv pip install -e '.[dev]'
- Fix formatting
- Fix all tests
- Formatting: ruff format
- Imports: Standard lib first, third-party second, project modules last (alphabetically sorted in groups)
- Naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
- Types: Type hints for function parameters and return values where applicable
- Documentation: Google-style docstrings with Args/Returns sections for complex functions
- Error handling: Explicit exceptions with descriptive messages, exception chaining with
raise X from Y - Indentation: 4 spaces
- Linting: ruff check, vulture
- Python 3.13+
- Install uv:
pip install uvorcurl -LsSf https://astral.sh/uv/install.sh | sh - Install dev dependencies:
uv venv && uv pip install -e '.[dev]' - Always use
uv run pytest(not barepytest) to ensure the project venv is used
- Mole files:
{image}.jpg.json- JSON arrays with mole coordinates and metadata - Mask files:
{image}.jpg.mask.png- Binary masks defining body regions - Meta files:
{image}.jpg.meta.json- Ellipse geometry data for coordinate transformation - Extra stem files:
{image}.jpg.{stem}.json- Additional mole data with specific stems
- Use
mel.lib.image.save_image()instead ofcv2.imwrite()directly - This function respects file permissions and prevents overwriting read-only files
- For JSON operations, use
mel.rotomap.moles.save_json()for consistent formatting
- Rotomap commands follow pattern:
mel rotomap {action} [options] FILES... - Add new commands to
mel/cmd/rotomap{action}.pywithsetup_parser()andprocess_args()functions - Register commands in
mel/cmd/mel.pyby importing module and adding toCOMMANDS["rotomap"]dict
- Copyright and license notices live at the bottom of each file, in the existing license block (above the
END-OF-FILEline). Do not add copyright lines near the top of the file. - In changed files, update the copyright year range in the bottom license block to include the current year.
- Ensure "Generated with assistance from Claude Code." appears under the copyright line in the bottom license block.