Skip to content
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

Style core code #186

Merged
merged 8 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
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
Loading