π§βπ»π€ Contributing to slick-tuneΒΆ
Hello from the SlickMLπ§ Team π and welcome to our contributing guidelines π€. Here we laid out the details of the development process based on our coding standards, and we hope these guidelines ease the process for you. Please feel free to apply your revisions if you did not find these guidelines useful.
π©ββοΈ Code of ConductΒΆ
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. By participating and contributing to this project, you agree to uphold our community standards π.
ππ Getting StartedΒΆ
Please note that before starting any major work, open an issue describing what you are planning to work on. The best way to start is to check the good-first-issue labelπ· on the issue board. In this way, the SlickML team members and other interested parties can give you feedback on the opened issue πββοΈ regarding the possible idea π‘, bug πͺ², or feature π§¬. Additionally, it will reduce the chance of duplicated work and it would help us to manage the tasks in a parallel fashion; so your pull request would get merged faster π π. Whether the contributions consist of adding new features, optimizing the code-base, or assisting with the documentation, we welcome new contributors of all experience levels. The SlickMLπ§ community goals are to be helpful and effective π.
π Coding StandardsΒΆ
Long time Pythoneer π Tim Peters succinctly channels the BDFLβs guiding principles for Pythonβs design into 20 aphorisms, only 19 of which have been written down as Zen of Python π§ββοΈ.
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases arenβt special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be oneβ and preferably only one βobvious way to do it.
Although that way may not be obvious at first unless youβre Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, itβs a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea β letβs do more of those!
We try to follow Google Python Style Guide as much as possible.
We try to maximize the use of Data Classes in our source codes and unit-tests.
We follow numpydoc style guidelines for docstrings π.
Every public and private function/method must have full type annotations (parameters + return type). Prefer precise types over
Any.Prefer keyword (named) arguments over positional calls. Multi-arg public APIs use a leading
*; multi-field dataclasses usekw_only=True.
π π₯· Environment ManagementΒΆ
To begin with, install a Python version >=3.10,<3.14.
All developments are done via uv. To begin with, first install
uvfollowing the installation documentation depending on your operating system.Once you setup your environment, to install the dependencies (
uv.lock), simply run πββοΈ:uv syncQLoRA extras (CUDA + bitsandbytes only):
uv sync --extra qlora
We mainly use Poe the Poet, a pythonic task runner that works well with
uv. Install the CLI once πββοΈ:uv tool install poethepoet
To make sure your environment is setup correctly, simply run πββοΈ:
poe greetFor more options for task runners, simply run πββοΈ:
poe --help
π FormattingΒΆ
To ease the process and reduce headache πββοΈ, we have serialized the required formatting commands to save more time β°. To apply all the required
formattingsteps, simply run πββοΈ:poe formatWe save a lot of time β³ and mental energy π for more important matters by using ruff as our main code formatter (line-length = 100; see
ruff.toml). To apply formatting, simply run πββοΈ:poe formatTo check if the code is formatted correctly (without writing), simply run πββοΈ:
poe format --check
πͺ LintingΒΆ
Similar to formatting, to ease the process and reduce headache πββοΈ, we have serialized the required linting commands to save more time β°. To apply all the required
lintingsteps, simply run πββοΈ:poe checkpoe checkessentially runspoe format --check,ruff check ., andpoe mypybehind the scenes in a serial fashion. You can learn more about each step below π.To lint our code base we use ruff (including
ANNtype-annotation rules). To applyruffto the code base, simply run πββοΈ:ruff check .
We also use mypy with more specification laid out in
mypy.inito check static typing of our code base. To applymypyto the code base, simply run πββοΈ:poe mypyTo run lint + tests + build across supported Python versions, use tox (
tox.ini):poe tox
π§ͺ TestingΒΆ
We believe in Modern Test Driven Development (TDD) and mainly use pytest, assertpy along with pytest-cov with more specification laid out in
pytest.iniand .coveragerc to develop our unit-tests.All unit-tests live in
tests/directory separated from the source code.All unit-test files should begin with the word
testi.e.test_foo.py.Our naming convention for naming tests is
test_<method_under_test>__<when>__<then>pattern which would increase the code readability.Prefer
assertpyover bareassertin tests.We use pytest-cov plugin π which helps to populate a coverage report π for the unit-tests to shed more light on the parts of the code that have not been touched in unit-tests π π΅οΈββοΈ.
Coverage settings live in
.coveragerc(branch coverage,fail_under = 100).To run all unit-tests, simply run πββοΈ:
poe test
To run a specific test file, simply run πββοΈ:
poe test tests/test_<file_name>.py
π DocumentationΒΆ
We follow numpydoc style guidelines for docstrings syntax, and best practices π.
Include
Parameters,Returns,Raises, andExampleswhen useful.Sphinx docs live under
docs/(same layout as slick-ml): pages indocs/pages/, config indocs/conf.py.Build HTML locally πββοΈ:
uv sync --group docs poe sphinx # open docs/_build/index.html
Keep the product overview in
README.md; keep contributor workflow details in this file.
π₯ Pull RequestsΒΆ
Please make sure to open an issue before starting major work and get core-team feedback.
Try to fix one bug or add one new feature per PR. This would minimize the amount of code changes and it is easier for code-review. Hefty PRs usually do not get merged so fast while it could have been if the work was split into multiple PRs clearly laid out in an issue beforehand. Therefore, the code reviewer would not be surprised by the work.
We recommend to follow Fork and Pull Request Workflow.
Fork our repository to your own Github account.
Clone the forked repository to your machine.
Create a branch locally; our naming conventions are
bugfix/the-bug-i-fixandfeature/the-new-feature-i-addfor bug fixes and new features, respectively.Please use present tense verbs for your commit messages i.e.
Fix bug ...,Add feature ..., and avoid using past tense verbs.Try to
rebasethe commits as much as possible to keep the git history clean.Follow the
formatting,linting, andtestingguidelines above (poe format,poe check,poe test).CI (GitHub Actions) runs the same gates on Ubuntu + macOS for Python 3.10β3.13 β see
.github/workflows/ci.yml.Now, you are ready to push your changes to your forked repository.
Lastly, open a PR in our repository and follow the PR template so that we can efficiently review the changes as soon as possible and get your feature/bug-fix merged.
Nicely done! You are all set! You are now officially part of slick-tune contributors.
β π π² Need Help?ΒΆ
Please join our Slack Channel to interact directly with the core team and our small community. This is a good place to discuss your questions and ideas or in general ask for help π¨βπ©βπ§ π« π¨βπ©βπ¦.