We welcome contributions to xarray-ome! This guide will help you get started.
- Python 3.11 or later
- uv for dependency management
# Clone the repository
git clone https://github.com/your-org/xarray-ome.git
cd xarray-ome
# Install dependencies (uv will create a virtual environment)
uv sync
# Install pre-commit hooks
uv run pre-commit installxarray-ome/
├── xarray_ome/ # Main package
│ ├── __init__.py # Package exports
│ ├── reader.py # Reading functions
│ ├── writer.py # Writing functions
│ ├── transforms.py # Coordinate transformations
│ ├── backend.py # Xarray backend integration
│ └── _store_utils.py # Store type detection
├── tests/ # Test suite
├── examples/ # Example scripts
├── docs/ # Documentation
├── plan.md # Implementation plan
├── AGENTS.md # AI assistant instructions
└── pyproject.toml # Project configuration
-
Create a branch for your feature or fix:
git checkout -b feature-name
-
Make your changes following our code style guidelines
-
Run tests:
uv run pytest
-
Run type checking:
uv run mypy xarray_ome/
-
Format and lint:
uv run ruff check xarray_ome/ uv run ruff format xarray_ome/
-
Commit your changes:
git add specific-files.py git commit -m "Descriptive commit message"
Pre-commit hooks will automatically run linting and formatting checks.
- Use pythonic patterns and conventions
- Follow PEP 8 style guidelines (enforced by ruff)
- Write clear, readable, self-documenting code
- Use meaningful variable and function names
DO NOT leave excessive comments in code.
- Write self-documenting code with clear names and structure
- Only add comments when necessary to explain complex logic
- Prefer docstrings for functions/classes over inline comments
- Trust that the code itself tells the story
All functions must have type hints:
def open_ome_dataset(
path: str | Path,
resolution: int = 0,
validate: bool = False,
) -> xr.Dataset:
"""Function docstring."""
...Use numpy-style docstrings:
def function_name(param1: str, param2: int) -> bool:
"""
Short description.
Longer description if needed.
Parameters
----------
param1 : str
Description of param1
param2 : int
Description of param2
Returns
-------
bool
Description of return value
Raises
------
ValueError
When this error occurs
Examples
--------
>>> function_name("test", 42)
True
"""feature/description- New featuresfix/description- Bug fixesdocs/description- Documentation changesrefactor/description- Code refactoring
Write clear, descriptive commit messages:
Short summary (50 chars or less)
More detailed explanation if needed. Wrap at 72 characters.
- Bullet points are okay
- Use present tense ("Add feature" not "Added feature")
- Reference issues: "Fixes #123"
NEVER use indiscriminate git adds:
# ❌ BAD
git add -A
git add .
# ✅ GOOD
git add file1.py file2.py
git add xarray_ome/reader.pyAlways review changes before staging:
git status
git diff# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_reader.py
# Run with coverage
uv run pytest --cov=xarray_ome --cov-report=html
# Run in parallel
uv run pytest -n autoPlace tests in the tests/ directory:
"""Test description."""
import pytest
from xarray_ome import open_ome_dataset
def test_open_dataset_local() -> None:
"""Test opening a local OME-Zarr file."""
ds = open_ome_dataset("path/to/test.ome.zarr")
assert "image" in ds.data_vars
assert ds.dims["x"] > 0
def test_invalid_path() -> None:
"""Test that invalid path raises appropriate error."""
with pytest.raises(FileNotFoundError):
open_ome_dataset("nonexistent.ome.zarr")# Install documentation dependencies
uv sync --group docs
# Build documentation
cd docs
make html
# View documentation
open _build/html/index.html- Use MyST Markdown for documentation files
- Include code examples that actually work
- Add docstrings to all public functions and classes
- Keep documentation up-to-date with code changes
- Ensure all tests pass and code is properly formatted
- Update documentation if adding new features
- Add tests for new functionality
- Update CHANGELOG.md if applicable
- Create pull request with clear description
- Address review feedback promptly
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Code refactoring
## Testing
How was this tested?
## Checklist
- [ ] Tests pass
- [ ] Type checking passes (mypy)
- [ ] Linting passes (ruff)
- [ ] Documentation updated
- [ ] CHANGELOG.md updated- Leverage ngff-zarr: Don't reimplement OME-Zarr spec parsing
- Focus on coordinates: Core value is transforming OME-NGFF transforms ↔ xarray coordinates
- Preserve metadata: Store full OME metadata in attrs for round-tripping
- Type safety: All code must pass mypy strict type checking
Before implementing a new feature:
- Read
plan.mdto understand project goals and architecture - Check existing patterns in the codebase
- Consider impact on API and backward compatibility
- Discuss in an issue if making significant changes
(For maintainers)
- Update version in
pyproject.toml - Update
CHANGELOG.md - Create git tag:
git tag v0.1.0 - Push tag:
git push origin v0.1.0 - Build and publish:
uv build && uv publish
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Read the Docs
We follow the Contributor Covenant Code of Conduct. Please be respectful and constructive in all interactions.
By contributing, you agree that your contributions will be licensed under the MIT License.