From bac5c4532162c5e945e60e6684e109b5e29ea7d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=80=E1=85=A7=E1=86=BC?= =?UTF-8?q?=E1=84=90=E1=85=A2?= Date: Sun, 18 May 2025 11:30:15 +0900 Subject: [PATCH] refactor: unify dependency management via requirements.txt --- setup.py | 57 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/setup.py b/setup.py index 9313df4..a55bd93 100644 --- a/setup.py +++ b/setup.py @@ -1,40 +1,49 @@ -# setup.py +""" +setup.py - lang2sql 패키지의 설치 및 배포 구성을 정의하는 파일입니다. + +이 파일은 setuptools를 사용하여 패키지 메타데이터, 의존성, CLI 엔트리 포인트 등을 지정하며, +pip 또는 Python 배포 도구들이 이 정보를 바탕으로 설치를 수행합니다. +""" + from setuptools import find_packages, setup + +def load_requirements(path="requirements.txt"): + """ + 주어진 경로의 requirements.txt 파일을 읽어 의존성 목록을 반환합니다. + + 각 줄을 읽고, 빈 줄이나 주석(#)은 무시합니다. + + Args: + path (str): 읽을 requirements 파일 경로 (기본값: 'requirements.txt') + + Returns: + list[str]: 설치할 패키지 목록 + """ + + with open(path, "r", encoding="utf-8") as f: + return [line.strip() for line in f if line.strip() and not line.startswith("#")] + + +requirements = load_requirements() + with open("docs/README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( - name="lang2sql", # 패키지 이름 - version="0.1.9", # 버전 + name="lang2sql", + version="0.1.9", author="ehddnr301", author_email="dy95032@gmail.com", url="https://github.com/CausalInferenceLab/Lang2SQL", description="Lang2SQL - Query Generator for Data Warehouse", long_description=long_description, long_description_content_type="text/markdown", - packages=find_packages(), # my_package를 자동으로 찾음 - install_requires=[ - "langgraph==0.2.62", - "datahub==0.999.1", - "langchain==0.3.14", - "langchain-community==0.3.14", - "openai==1.59.8", - "langchain-openai==0.3.0", - "streamlit==1.41.1", - "python-dotenv==1.0.1", - "faiss-cpu==1.10.0", - "langchain-aws>=0.2.21,<0.3.0", - "langchain-google-genai>=2.1.3,<3.0.0", - "langchain-ollama>=0.3.2,<0.4.0", - "langchain-huggingface>=0.1.2,<0.2.0", - "transformers==4.51.2", - "pytest>=8.3.5", - ], + packages=find_packages(), + install_requires=requirements, entry_points={ "console_scripts": [ - # "my-project" 명령어로 my_package.main 모듈의 run 함수를 실행 - "lang2sql = cli.__init__:cli" - ] + "lang2sql = cli.__init__:cli", + ], }, )