Skip to content

Commit

Permalink
Add a DEVELOPMENT.md with basic dev setup instructions
Browse files Browse the repository at this point in the history
This isn't exhaustive, but should give a basic starting point for
anyone wanting to work on SDG locally.

Signed-off-by: Ben Browning <[email protected]>
  • Loading branch information
bbrowning committed Jan 9, 2025
1 parent 4efcdef commit 99139bc
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Local Development Setup

These instructions assume you have SDG cloned to a directory locally
and are executing these commands within that directory.

## Setup a Python virtual environment and install InstructLab

```shell
python3 -m venv --upgrade-deps venv
. venv/bin/activate
pip install git+https://github.com/instructlab/instructlab@main
```

At this point, you have InstructLab installed and a working `ilab`
CLI. However, it is using a released version of SDG and not your
locally cloned one.

## Overwrite SDG with your locally cloned one

Now let's override the SDG version installed with our locally cloned
one. We'll use the `-e` flag to `pip install` so that we can edit the
SDG files and changes immediately take effect, without having to run
`pip install` again after each edit. We also install the development
requirements, necessary to run tests.

```shell
pip install -e .
pip install -r requirements-dev.txt
```

This may give a warning from pip about its dependency resolver and
instructlab-sdg versions. You can ignore that, as we are explicitly
using an unreleased local version of instructlab-sdg here.

## Test SDG

At this point, you should be able to run SDG tests locally as a sanity
check to ensure your local development environment is setup. The first
time you run them may take a bit as `tox` installs the necessary
development requirements. Subsequent runs will be faster.

### Unit Tests

These are relatively fast to run, with each testing a small section of
the SDG code.

```shell
tox -e py3-unit
```

### Functional Tests

These take a bit longer to run, and test larger functional areas of
the SDG code.

```shell
tox -e py3-functional
```

### Manual Testing / usage

You can also invoke the `ilab` CLI or use the SDG Python APIs directly
to test things locally. Details on how to use the `ilab` CLI are
maintained in the [upstream InstructLab
documentation](https://github.com/instructlab/instructlab).

## Running code formatting and linting checks locally

To run the same checks locally that our CI system uses to evaluate PRs
for linting errors, unused imports, code style, etc:

```shell
tox -e ruff -- check
tox -e lint
tox -e mypy
tox -e validate-pipelines
```

Also run the unit and functional tests, mentioned above, before
opening a PR to ensure the tests pass with your changes.

0 comments on commit 99139bc

Please sign in to comment.