Development notes
How to contribute to Matr1x
Did you find a bug or have a suggestion for improvement?
If you find a bug:
- Check if the issue already exists on GitHub
- If not, create an issue using the bug template.
- Follow the instructions and hints on the bug template.
Submitting Pull Requests
- Fork the repository.
- Create a new branch for your changes.
- Make your changes and commit them with clear, descriptive messages.
- Format the code with
ruff formatand check it withruff checkandty check. - Ensure the new code passes the test suite:
pytest. - Push to your fork and submit a pull request to the
developmentbranch using Conventional Commits.
Development Setup
We recommend setting up your development environment using a uv virtual environment. Make sure your installation has all the required dependencies.
uv sync --all-extras --all-groupsCode Style
- Use meaningful variable and function names
- Add docstrings to functions and classes in numpy format
- Keep functions focused and concise
- The exact style guide is enforced by
ruff.
Questions?
Please open an issue for questions or discussions about contributing.
Conventional Commits
Please note that Commitizen can assist with message generation.
Type Checking
Early bug detection relies on strict type boundaries. To prevent type erosion, two core constraints apply:
- Within a class:
AnyandUnknownshould not cross method signatures. - Outside a class:
AnyandUnknownmust never cross public class boundaries.
Pre-commit hooks
For anyone interested to run the pre-commit hooks locally and also using the exact versions fixed by uv.lock you can use:
repos:
- repo: local
hooks:
# Run the linter using local ruff
- id: ruff-check
name: ruff check
entry: uv run ruff check --fix
language: system
types_or: [python, pyi]
require_serial: true
# Run the formatter using local ruff
- id: ruff-format
name: ruff format
entry: uv run ruff format
language: system
types_or: [python, pyi]
require_serial: true
# Run ty type checker using local ty
- id: ty
name: ty type checker
entry: uv run ty check
language: system
types_or: [python, pyi]
# Run complexipy using local complexipy
- id: complexipy
name: complexipy
entry: uv run complexipy .
language: system
types_or: [python, pyi]
pass_filenames: falseadd the pre-commit-config.yaml to .git/info/exclude.
Specific editor settings
Zed editor settings
In case you use the Zed editor you may benefit from including these settings for this project and install the toml, ruff and ty extensions. Note that you have to replace <project-root> with the directory on your system.
{
"languages": {
"Python": {
"language_servers": ["ruff", "ty"]
}
},
"lsp": {
"ty": {
"binary": {
"path": "<project-root>/.venv/bin/ty",
"arguments": ["server"]
}
},
"ruff": {
"binary": {
"path": "<project-root>/.venv/bin/ruff",
"arguments": ["server"]
}
}
},
"terminal": {
"detect_venv": {
"on": {
"directories": [".venv"],
"activate_script": "default"
}
}
}
}Visual Studio Code settings
If you use Visual Studio Code, you can install the Python, ruff and ty extensions.