Skip to content

Commit

Permalink
Style core code (#186)
Browse files Browse the repository at this point in the history
* init

* init cleaning

* big clean

* init check

* nit

* up

* up

* fix isort
  • Loading branch information
natolambert authored Jul 10, 2024
1 parent 0008ae0 commit 0d0e8a4
Show file tree
Hide file tree
Showing 19 changed files with 1,134 additions and 733 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
extend-ignore = E203
30 changes: 30 additions & 0 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Quality

on:
push:
branches:
- main
- v*-release
pull_request:
branches:
- main

jobs:

check_code_quality:
name: Check code quality
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python environment
uses: actions/setup-python@v2
with:
python-version: 3.10.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black flake8 isort
- name: Code quality
run: |
make quality
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: style quality

# make sure to test the local checkout in scripts and not the pre-installed one (don't use quotes!)
export PYTHONPATH = open_instruct

check_dirs := open_instruct

style:
python -m black --line-length 119 --target-version py310 $(check_dirs)
python -m isort $(check_dirs) --profile black

quality:
python -m flake8 --max-line-length 119 $(check_dirs)
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ docker build --build-arg CUDA=12.1.0 --build-arg TARGET=cudnn8-devel --build-arg

For training, you can use the previous image.

### Developing
When submitting a PR to this repo, we check the core code in `open_instruct/` for style with the following:
```
make style
make quality
```

### Repo structure
```
├── assets/ <- Images, licenses, etc.
Expand Down
4 changes: 3 additions & 1 deletion open_instruct/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .utils import *
from .utils import ArgumentParserPlus, FlatArguments

All = [FlatArguments, ArgumentParserPlus]
Loading

0 comments on commit 0d0e8a4

Please sign in to comment.