diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..60f841028 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,90 @@ +# Contributing to the CodeFlare SDK + +Thank you for your interest in contributing to the CodeFlare SDK! + +## Getting Started + +### Prerequisites + +- Python 3.9 +- [Poetry](https://python-poetry.org/) + +### Setting Up Your Development Environment + +1. **Clone the repository:** + + ```sh + git clone https://github.com/project-codeflare/codeflare-sdk.git + cd codeflare-sdk + ``` + +2. Create a Poetry virtual environment: + + ```sh + poetry shell + ``` + +3. Install dependencies: + + ```sh + poetry install + ``` + + - To include test dependencies, run: + + ```sh + poetry install --with test + ``` + + - To include docs dependencies, run: + + ```sh + poetry install --with docs + ``` + + - To include both test and docs dependencies, run: + + ```sh + poetry install --with test,docs + ``` + +## Development Workflow + +### Pre-commit + +We use pre-commit to ensure consistent code formatting. To enable pre-commit hooks, run: + +```sh +pre-commit install +``` + +## Testing + +To install CodeFlare SDK in editable mode, run: + +```sh +pip install -e . +``` + +### Unit Testing + +To run the unit tests, execute: + +```sh +pytest -v tests/unit_test.py +``` + +### Local e2e Testing + +- Please follow the [e2e documentation](https://github.com/project-codeflare/codeflare-sdk/blob/main/docs/e2e.md) + +#### Code Coverage + +- Run tests with the following command: `coverage run -m --source=src pytest tests/unit_test.py` +- To then view a code coverage report w/ missing lines, run `coverage report -m` + +### Code Formatting + +- To check file formatting, in top-level dir run `black --check .` +- To auto-reformat all files, remove the `--check` flag +- To reformat an individual file, run `black ` diff --git a/README.md b/README.md index 0ea7f6941..31177840c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Codeflare-SDK +# CodeFlare SDK [![Python application](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/project-codeflare/codeflare-sdk/actions/workflows/unit-tests.yml) ![coverage badge](./coverage.svg) @@ -19,61 +19,7 @@ Can be installed via `pip`: `pip install codeflare-sdk` ## Development -### Prerequisites - -We recommend using Python 3.9 for development, along with Poetry. -Create a Poetry virtual environment with the required Python version 3.9, and run all commands within this environment. - - - run: `poetry shell` - -#### Install dependencies: - - - run: `poetry install` - -This will install standard requirements as specified in the poetry.lock file. Test and docs dependencies are optional. - -- To include test dependencies run: `poetry install --with test` - -- To include docs dependencies run: `poetry install --with docs` - -- To include test and docs dependencies run: `poetry install --with test,docs` - -If you require a requirements.txt file you can run: - -`poetry export -f requirements.txt --output requirements.txt --without-hashes` - -### Pre-commit - -We use pre-commit to make sure the code is consistently formatted. To make sure that pre-commit is run every time you commit changes, simply run `pre-commit install` - -To build the codeflare-sdk pre-commit image run `podman build -f .github/build/Containerfile .` from the root directory. - -### Testing - -- To install codeflare-sdk in editable mode, run `pip install -e .` from the repo root. -- Any new test functions/scripts can be added into the `tests` folder -- NOTE: Functional tests coming soon, will live in `tests/func_test.py` - -#### Unit Testing -- To run the unit tests, run `pytest -v tests/unit_test.py` - -#### Local e2e Testing -- Please follow the [e2e documentation](https://github.com/project-codeflare/codeflare-sdk/blob/main/docs/e2e.md) - -#### Code Coverage - -- Run tests with the following command: `coverage run -m --source=src pytest tests/unit_test.py` -- To then view a code coverage report w/ missing lines, run `coverage report -m` - -### Code Formatting - -- To check file formatting, in top-level dir run `black --check .` -- To auto-reformat all files, remove the `--check` flag -- To reformat an individual file, run `black ` - -### Package Build - -To build the python package: `$ poetry build` +Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed instructions. ## Release Instructions