Contributing¶
Thank you for considering contributing to the SiloGen AI Workloads development!
Development Setup¶
- Fork the repository
-
Clone your fork:
-
Set up development environment:
Pre-commit setup¶
We use pre-commit for consistent formatting and cleaner code. Hooks are specified in ai-workloads-dev/.pre-commit-config.yaml
.
To install:
cd ai-workloads-dev
(this is necessary for pre-commit install
, which runs particular to a git repository)
source your_venv
pip install pre-commit
pre-commit install --config .pre-commit-config.yaml
git commit -m "test commit"
With the final command, pre-commit should run automatically, with output something like the following:
check json...........................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
fix end of files.....................................(no files to check)Skipped
fix requirements.txt.................................(no files to check)Skipped
trim trailing whitespace.............................(no files to check)Skipped
black................................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
isort (python).......................................(no files to check)Skipped
mypy.................................................(no files to check)Skipped
helmlint.............................................(no files to check)Skipped
It's also possible to manually run pre-commit using
pre-commit run --all-files
Troubleshooting pre-commit¶
Many pre-commit bugs come from having an incorrect version of pre-commit active. Pre-commit can hang around as a system-wide version, in python venvs, or in your pre-commit cache.
It's easiest to use pre-commit as part of a python virtual environment. To check that the right pre-commit is being found, run which pre-commit
and confirm that the binaries inside your venv are shown. For example: /../../venvs/your_venv/bin/pre-commit
. A different path could indicate that your system is choosing the wrong pre-commit install.
From system:
brew uninstall pre-commit
(mac)
sudo apt remove pre-commit
(linux)
From venv:
pip uninstall pre-commit
Just the pre-commit hooks uninstall:
pre-commit uninstall
pre-commit clean
Then reinstall pre-commit from scratch as described above.
Development Workflow¶
-
Create a branch for your feature or bugfix:
-
Make your changes and write tests
-
Run tests:
-
Submit a pull request
Documentation¶
Update the documentation when adding new features:
- Add new pages in the
docs/
directory - Update the
nav
section inmkdocs.yml
if necessary - Test the documentation locally:
Code Style¶
Follow PEP 8 guidelines. We use black
for code formatting and flake8
for linting.