|
| 1 | +# Contributing to the Codeflare SDK |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Codeflare SDK! |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- Python 3.9 |
| 10 | +- [Poetry](https://python-poetry.org/) |
| 11 | + |
| 12 | +### Setting Up Your Development Environment |
| 13 | + |
| 14 | +1. **Clone the repository:** |
| 15 | + |
| 16 | + ```sh |
| 17 | + git clone https://github.com/project-codeflare/codeflare-sdk.git |
| 18 | + cd codeflare-sdk |
| 19 | + ``` |
| 20 | + |
| 21 | +2. Create a Poetry virtual environment: |
| 22 | + |
| 23 | + ```sh |
| 24 | + poetry shell |
| 25 | + ``` |
| 26 | + |
| 27 | +3. Install dependencies: |
| 28 | + |
| 29 | + ```sh |
| 30 | + poetry install |
| 31 | + ``` |
| 32 | + |
| 33 | + - To include test dependencies, run: |
| 34 | + |
| 35 | + ```sh |
| 36 | + poetry install --with test |
| 37 | + ``` |
| 38 | + |
| 39 | + - To include docs dependencies, run: |
| 40 | + |
| 41 | + ```sh |
| 42 | + poetry install --with docs |
| 43 | + ``` |
| 44 | + |
| 45 | + - To include both test and docs dependencies, run: |
| 46 | + |
| 47 | + ```sh |
| 48 | + poetry install --with test,docs |
| 49 | + ``` |
| 50 | + |
| 51 | +## Development Workflow |
| 52 | + |
| 53 | +### Pre-commit |
| 54 | + |
| 55 | +We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run: |
| 56 | + |
| 57 | +```sh |
| 58 | +pre-commit install |
| 59 | +``` |
| 60 | + |
| 61 | +## Testing |
| 62 | + |
| 63 | +To install Codeflare SDK in editable mode, run: |
| 64 | + |
| 65 | +```sh |
| 66 | +pip install -e . |
| 67 | +``` |
| 68 | + |
| 69 | +### Unit Testing |
| 70 | + |
| 71 | +To run the unit tests, execute: |
| 72 | + |
| 73 | +```sh |
| 74 | +pytest -v tests/unit_test.py |
| 75 | +``` |
| 76 | + |
| 77 | +### Local e2e Testing |
| 78 | + |
| 79 | +- Please follow the [e2e documentation](https://github.com/project-codeflare/codeflare-sdk/blob/main/docs/e2e.md) |
| 80 | + |
| 81 | +#### Code Coverage |
| 82 | + |
| 83 | +- Run tests with the following command: `coverage run -m --source=src pytest tests/unit_test.py` |
| 84 | +- To then view a code coverage report w/ missing lines, run `coverage report -m` |
| 85 | + |
| 86 | +### Code Formatting |
| 87 | + |
| 88 | +- To check file formatting, in top-level dir run `black --check .` |
| 89 | +- To auto-reformat all files, remove the `--check` flag |
| 90 | +- To reformat an individual file, run `black <filename>` |
0 commit comments