From dce71d163a84805ef9011898463c83f4956816d9 Mon Sep 17 00:00:00 2001 From: leoguillaume Date: Tue, 17 Sep 2024 22:28:00 +0200 Subject: [PATCH] fix: pyproject --- CONTRIBUTING.md | 4 ++-- app/helpers/_vectorstore.py | 4 ++-- pyproject.toml | 12 +++++++++--- ui/chat.py | 5 +++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8087a33b..15591d94 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ feat(collections): collection name retriever 2. Dans un environnement virtuel Python, installez les packages Python présents dans le fichier *[pyproject.toml](./pyproject.toml)* ```bash - pip install ".[ui,app,dev]" + pip install ".[ui,app,dev,test]" pre-commit install ``` @@ -37,7 +37,7 @@ Merci avant chaque pull request, de vérifier le bon déploiement de votre API ``` 2. Executez les tests unitaires - + ```bash PYTHONPATH=. pytest -v --exitfirst app/tests --base-url http://localhost:8080/v1 --api-key API_KEY ``` diff --git a/app/helpers/_vectorstore.py b/app/helpers/_vectorstore.py index 9b15287d..a452b216 100644 --- a/app/helpers/_vectorstore.py +++ b/app/helpers/_vectorstore.py @@ -1,12 +1,12 @@ import time -import uuid from typing import List, Optional +import uuid from fastapi import HTTPException +from langchain.docstore.document import Document from qdrant_client.http.models import Distance, FieldCondition, Filter, MatchAny, PointIdsList, PointStruct, VectorParams from app.schemas.chunks import Chunk -from langchain.docstore.document import Document from app.schemas.collections import CollectionMetadata from app.schemas.config import EMBEDDINGS_MODEL_TYPE, METADATA_COLLECTION, PRIVATE_COLLECTION_TYPE, PUBLIC_COLLECTION_TYPE diff --git a/pyproject.toml b/pyproject.toml index f1106c63..0892aa3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,12 @@ dev = [ "ruff==0.6.5", "pre-commit==3.6.2", ] +test = [ + "pytest==8.2.2", +] + +[tool.setuptools] +py-modules = [] [tool.ruff] line-length = 150 @@ -42,10 +48,10 @@ line-length = 150 [tool.ruff.lint] ignore = ["F403", "F841"] # import * and never used variables -[ruff.isort] +[tool.ruff.lint.isort] force-sort-within-sections = true known-first-party = ["config", "utils", "app"] forced-separate = ["tests"] -sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] - +[tool.ruff.lint.isort.sections] +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] diff --git a/ui/chat.py b/ui/chat.py index 4976e584..3684f71e 100644 --- a/ui/chat.py +++ b/ui/chat.py @@ -1,7 +1,8 @@ +from openai import OpenAI import streamlit as st + from config import BASE_URL -from openai import OpenAI -from utils import get_collections, get_models, set_config, header +from utils import get_collections, get_models, header, set_config # Config set_config()