Merge pull request #923 from drikusroor/add-flake8-workflow

Add flake8 linter workflow
pull/742/head^2
Richard Beales 2023-04-12 19:48:24 +01:00 committed by GitHub
commit 079daf726d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 9 deletions

View File

@ -1,4 +1,4 @@
name: Unit Tests name: Python CI
on: on:
push: push:
@ -30,6 +30,10 @@ jobs:
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -r requirements.txt pip install -r requirements.txt
- name: Lint with flake8
continue-on-error: true
run: flake8 scripts/ tests/
- name: Run unittest tests with coverage - name: Run unittest tests with coverage
run: | run: |
coverage run --source=scripts -m unittest discover tests coverage run --source=scripts -m unittest discover tests

2
.gitignore vendored
View File

@ -18,4 +18,4 @@ log.txt
# Coverage reports # Coverage reports
.coverage .coverage
coverage.xml coverage.xml
htmlcov/ htmlcov/

View File

@ -96,9 +96,10 @@ pip install -r requirements.txt
``` ```
4. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVEN_LABS_API_KEY` as well. 4. Rename `.env.template` to `.env` and fill in your `OPENAI_API_KEY`. If you plan to use Speech Mode, fill in your `ELEVEN_LABS_API_KEY` as well.
- Obtain your OpenAI API key from: https://platform.openai.com/account/api-keys.
- Obtain your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website. - Obtain your OpenAI API key from: https://platform.openai.com/account/api-keys.
- If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and provide the `OPENAI_AZURE_API_BASE`, `OPENAI_AZURE_API_VERSION` and `OPENAI_AZURE_DEPLOYMENT_ID` values as explained here: https://pypi.org/project/openai/ in the `Microsoft Azure Endpoints` section. Additionally you need separate deployments for both embeddings and chat. Add their ID values to `OPENAI_AZURE_CHAT_DEPLOYMENT_ID` and `OPENAI_AZURE_EMBEDDINGS_DEPLOYMENT_ID` respectively - Obtain your ElevenLabs API key from: https://elevenlabs.io. You can view your xi-api-key using the "Profile" tab on the website.
- If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and provide the `OPENAI_AZURE_API_BASE`, `OPENAI_AZURE_API_VERSION` and `OPENAI_AZURE_DEPLOYMENT_ID` values as explained here: https://pypi.org/project/openai/ in the `Microsoft Azure Endpoints` section. Additionally you need separate deployments for both embeddings and chat. Add their ID values to `OPENAI_AZURE_CHAT_DEPLOYMENT_ID` and `OPENAI_AZURE_EMBEDDINGS_DEPLOYMENT_ID` respectively
## 🔧 Usage ## 🔧 Usage
@ -113,9 +114,11 @@ python scripts/main.py
3. To exit the program, type "exit" and press Enter. 3. To exit the program, type "exit" and press Enter.
### Logs ### Logs
You will find activity and error logs in the folder ```./logs```
You will find activity and error logs in the folder `./logs`
To output debug logs: To output debug logs:
``` ```
python scripts/main.py --debug python scripts/main.py --debug
``` ```
@ -331,3 +334,11 @@ To run tests and see coverage, run the following command:
``` ```
coverage run -m unittest discover tests coverage run -m unittest discover tests
``` ```
## Run linter
This project uses [flake8](https://flake8.pycqa.org/en/latest/) for linting. To run the linter, run the following command:
```
flake8 scripts/ tests/
```

View File

@ -1 +1 @@
from scripts.main import main from scripts.main import main

View File

@ -15,4 +15,5 @@ pinecone-client==2.2.1
redis redis
orjson orjson
Pillow Pillow
coverage coverage
flake8

View File

@ -2,4 +2,4 @@ import sys
import os import os
sys.path.insert(0, os.path.abspath( sys.path.insert(0, os.path.abspath(
os.path.join(os.path.dirname(__file__), '../scripts'))) os.path.join(os.path.dirname(__file__), '../scripts')))