-
Notifications
You must be signed in to change notification settings - Fork 0
Code Quality
Maintaining a clean, strictly typed, and uniform codebase is critical for reproducible machine learning research and collaborative development. The MLFramework Template enforces code quality standards through automated formatting and static type analysis.
This template utilizes a modern, high-performance Python toolchain managed by uv:
-
Ruff: An extremely fast Python linter and code formatter written in Rust. It replaces legacy tools such as
flake8,isort, andblack. - Mypy: A static type checker for Python. The template configures Mypy in strict mode to ensure robustness across the core architecture and pipeline logic.
To abstract the execution of these tools, the repository includes a Makefile with predefined targets. These commands automatically utilize the isolated .venv environment managed by uv, ensuring no conflicts with system-level Python installations.
To automatically format all Python files, enforce line lengths, and sort imports according to the defined standard, execute:
make formatTo identify syntax errors, unused variables, or type inconsistencies without modifying the files, execute:
make lintBefore committing any code to the version control system, it is highly recommended to run the combined check:
make checkThis command sequentially executes the formatter and the linter. If any step fails, the output will indicate the exact file and line requiring manual intervention.
Because Mypy is configured with strict = true in pyproject.toml, all function signatures must include correct type hints.
When overriding standard framework methods (e.g., PyTorch Lightning hooks) that require arguments you do not intend to use, prefix the argument name with an underscore (e.g., _batch_idx). This idiom explicitly signals to both Ruff and Mypy that the variable is intentionally unused, thereby preventing unnecessary warnings while maintaining strict interface compliance.
If you utilize this framework template in your research or engineering workflows, please consider citing it to support ongoing development:
@software{MLFramework_Template_2026,
author = {Danylo Chystiakov},
title = {MLFramework Template: A Reproducible MLOps Environment},
year = {2026},
url = {[https://github.com/allllpina/MLTemplate](https://github.com/allllpina/MLTemplate)}
}This template is built upon the philosophies and architectural patterns established by the following foundational projects:
- Hydra for hierarchical configuration.
- PyTorch Lightning for hardware-agnostic training abstractions.
- Data Version Control (DVC) for Git-integrated data management.
Contact & Support For inquiries regarding architectural decisions, bug reports, or feature requests, please open an issue on the GitHub repository.
Maintained by Danylo Chystiakov.