Contributing to Linax¤
Thank you for your interest in contributing to Linax! 🎉
We welcome contributions of all kinds: bug reports, feature requests, documentation improvements, and code contributions.
Table of Contents¤
Getting Started¤
Before contributing, please:
- Check existing issues to see if someone is already working on it
- Open an issue to discuss major changes before implementing them
- Read our Code of Conduct and follow community standards
Development Setup¤
Prerequisites¤
- Python 3.12
- uv package manager
Installation Steps¤
- Fork and clone the repository:
git clone git@github.com:camail-official/linax.git
cd linax
- Install dependencies (including dev tools):
uv sync --extra dev
- Install pre-commit hooks:
uv run pre-commit install
This will automatically run linters and formatters before each commit.
Optional: CUDA Support¤
If you have a CUDA capable GPU:
uv sync --extra cu12 --extra dev
Code Style¤
We use the following tools to maintain code quality:
- Ruff - Linting and formatting
- Pre-commit hooks - Automatic checks before commits
Running Code Quality Checks¤
# Run all pre-commit hooks manually
uv run pre-commit run --all-files
# Run ruff linter
uv run ruff check src/ tests/
# Run ruff formatter
uv run ruff format src/ tests/
Style Guidelines¤
- Follow PEP 8 conventions
- Use Google-style docstrings
- Maximum line length: 99 characters
- Type hints are required for all public functions
- Use
jaxtypingfor array shape annotations
Example:
from jaxtyping import Array, Float
def my_function(x: Float[Array, "batch features"]) -> Float[Array, "batch"]:
"""Brief description of the function.
Args:
x: Input array with shape (batch, features).
Returns:
Processed array with shape (batch,).
"""
return x.sum(axis=-1)
Testing¤
We use pytest for testing.
Running Tests¤
# Run all tests
uv run pytest
# Run specific test file
uv run pytest tests/test_smoke.py
# Run with coverage
uv run pytest --cov=linax
Writing Tests¤
- Place tests in the
tests/directory - Name test files
test_*.py - Name test functions
test_* - Include docstrings explaining what the test validates
Submitting Changes¤
Pull Request Process¤
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes:
- Write clear, concise commit messages
- Add tests for new functionality
-
Update documentation as needed
-
Ensure all checks pass:
uv run pre-commit run --all-files
uv run pytest
- Push to your fork:
git push origin feature/your-feature-name
- Open a Pull Request:
- Use a clear, descriptive title
- Fill out the PR template completely
- Link any related issues
Commit Message Guidelines¤
Write clear, descriptive commit messages that explain what changed:
Good:
Add LRU sequence mixer implementation
Fix gradient computation in LinOSS
Update README installation instructions
Add tests for S5 model
Not so good:
fix
update
wip
changes
Tips: - Use the imperative mood ("Add feature" not "Added feature") - Be specific about what changed - Reference issue numbers if applicable (e.g., "Fix #123")
Community¤
- Discord: Join our Discord server
- Issues: GitHub Issues
- Website: camail.org/linax
Questions?¤
If you have questions about contributing, feel free to:
- Open a GitHub Discussion
- Ask in our Discord server
- Email the maintainers (see
pyproject.tomlfor contact info)
Thank you for contributing to Linax! 🚀