Skip to content

Commit

Permalink
chore: add pre-commit hook (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
knjk04 authored Jul 12, 2023
1 parent dea3c26 commit 8e0467b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-ast
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ Steps:
OPENAI_API_KEY=ab-0a0aaaaA0aaAAa0AaaaaA00aaaAA0aA0aaA0AaAAaaaaaa00
```
3. Install dependencies: `pip install -r src/requirements.txt`
Configure development environment:
1. Run pip install -r src/requirements-dev.txt
1. Install pre-commit hook: pre-commit install
1. (Optional) run hook: pre-commit run --all-files
5 changes: 2 additions & 3 deletions src/api/process.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import logging
from enum import Enum
from io import StringIO

import openai
import pandas as pd
from dotenv import dotenv_values
from io import StringIO
import openai

logger = logging.getLogger(__name__)
# Set other loggers to error to not clutter this app's logs
Expand Down Expand Up @@ -67,4 +67,3 @@ def get_da_vinci_response(dataset_of: str) -> str:

def get_models() -> list[str]:
return [m.value for m in Models]

5 changes: 3 additions & 2 deletions src/frontend/st_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import streamlit as st
import time

from src.api.process import get_response, get_models
import streamlit as st

from src.api.process import get_models, get_response
from src.frontend.util import df_to_csv, df_to_json

app_title = "Dataset Generator"
Expand Down
1 change: 1 addition & 0 deletions src/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit==3.3.3

0 comments on commit 8e0467b

Please sign in to comment.