Skip to content

Added new CONTRIBUTING.md file #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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 <filename>`
58 changes: 2 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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 <filename>`

### Package Build

To build the python package: `$ poetry build`
Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed instructions.

## Release Instructions

Expand Down