Skip to content

Commit f2bc671

Browse files
committed
fix: 코드베이스 전체 import 정리 및 버그 수정 (Phase 6)
## 주요 변경사항 ### 1. Scripts 및 CLI 업데이트 - **scripts/welcome.py**: llmkit → beanllm 모든 참조 변경 - Import 경로: `from llmkit.ui` → `from beanllm.ui` - 환경 변수: LLMKIT_SHOW_BANNER → BEANLLM_SHOW_BANNER - GitHub URL: leebeanbin/llmkit → leebeanbin/beanllm - CLI 예제 코드 업데이트 - **publish.sh**: PyPI 배포 스크립트 업데이트 - 패키지명: llmkit → beanllm - Ruff check 경로: src/llmkit → src/beanllm - PyPI/TestPyPI URL 업데이트 - 설치 명령어: `pip install llmkit` → `pip install beanllm` - **src/beanllm/utils/cli/cli.py**: 상대 import → 절대 import 변경 - `from ...infrastructure` → `from beanllm.infrastructure` - `from ...ui` → `from beanllm.ui` ### 2. Import 문 표준화 (86개 파일) - **모든 3-level 상대 import 제거**: `from ...` → `from beanllm.` - **모든 4-level 상대 import 제거**: `from ....` → `from beanllm.` - **모든 5-level 상대 import 제거**: `from .....` → `from beanllm.` **영향받은 모듈:** - domain/ (loaders, embeddings, evaluation, vision, vector_stores, retrieval, splitters, parsers, prompts, graph, finetuning) - service/impl/ (모든 서비스 구현) - infrastructure/ (hybrid, registry, models, scanner, inferrer) - integrations/ (llamaindex, langgraph) - dto/ (request, response) - facade/, providers/, models/, utils/ ### 3. 누락된 Import 버그 수정 - **docling_loader.py**: `os`, `Dict`, `Any` import 추가 - **csv.py**: `csv` 모듈 import 추가 - **directory.py**: 중복 `import re` 제거 - **jupyter.py**: 문자열 결합 버그 수정 - 변경 전: `"\n\n" + "="*80 + "\n\n".join(content_parts)` - 변경 후: `("\n\n" + "="*80 + "\n\n").join(content_parts)` ### 4. PDF Loader Import 수정 (8개 파일) - bean_pdf_loader.py - engines/base.py, pymupdf_engine.py, pdfplumber_engine.py, marker_engine.py - utils/layout_analyzer.py, markdown_converter.py - vision_rag_service_impl.py ## 검증 결과 ✅ 3-level 이상 상대 import: 144개 → 0개 ✅ llmkit 참조 (src/scripts): 모두 제거 ✅ requests import: 0개 (모두 httpx 사용) ✅ 누락된 import: 모두 추가 ✅ 중복 import: 모두 제거 ## 기술적 개선사항 - **유지보수성**: 절대 import로 코드 가독성 향상 - **안정성**: 누락된 import 버그 수정으로 런타임 에러 방지 - **일관성**: 전체 코드베이스 import 스타일 통일 - **호환성**: 패키지 리팩토링 후에도 import 경로 안정성 보장
1 parent bb3a52e commit f2bc671

File tree

86 files changed

+169
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+169
-168
lines changed

publish.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
22

3-
# llmkit PyPI 배포 스크립트
3+
# beanllm PyPI 배포 스크립트
44
# 사용법: ./publish.sh [test|prod]
55

66
set -e # 에러 발생시 중단
77

8-
echo "🚀 llmkit PyPI 배포 스크립트"
8+
echo "🚀 beanllm PyPI 배포 스크립트"
99
echo "=============================="
1010

1111
# 인자 확인
@@ -27,7 +27,7 @@ echo ""
2727
echo "🔍 Step 2: 코드 품질 체크..."
2828
if command -v ruff &> /dev/null; then
2929
echo " - Ruff 린트 실행 중..."
30-
ruff check src/llmkit --fix || echo " ⚠️ 경고가 있지만 계속 진행합니다."
30+
ruff check src/beanllm --fix || echo " ⚠️ 경고가 있지만 계속 진행합니다."
3131
else
3232
echo " ⚠️ Ruff가 설치되어 있지 않습니다. 건너뜁니다."
3333
fi
@@ -67,14 +67,14 @@ ls -lh dist/
6767
echo ""
6868
if [ "$MODE" = "test" ]; then
6969
echo "🧪 Step 5: TestPyPI에 업로드 중..."
70-
echo " TestPyPI: https://test.pypi.org/project/llmkit/"
70+
echo " TestPyPI: https://test.pypi.org/project/beanllm/"
7171
python -m twine upload --repository testpypi dist/*
7272

7373
echo ""
7474
echo "✅ TestPyPI 업로드 완료!"
7575
echo ""
7676
echo "테스트 설치 방법:"
77-
echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ llmkit"
77+
echo " pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ beanllm"
7878

7979
elif [ "$MODE" = "prod" ]; then
8080
echo "🚀 Step 5: PyPI에 업로드 중..."
@@ -90,9 +90,9 @@ elif [ "$MODE" = "prod" ]; then
9090
echo "✅ PyPI 업로드 완료!"
9191
echo ""
9292
echo "설치 방법:"
93-
echo " pip install llmkit"
93+
echo " pip install beanllm"
9494
echo ""
95-
echo "PyPI 페이지: https://pypi.org/project/llmkit/"
95+
echo "PyPI 페이지: https://pypi.org/project/beanllm/"
9696
else
9797
echo "❌ 배포가 취소되었습니다."
9898
exit 1

scripts/welcome.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22
"""
3-
llmkit 환영 메시지 및 빠른 시작 가이드
3+
beanllm 환영 메시지 및 빠른 시작 가이드
44
디자인 시스템 적용
55
"""
66
import sys
@@ -10,7 +10,7 @@
1010
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
1111

1212
try:
13-
from llmkit.ui import (
13+
from beanllm.ui import (
1414
print_logo,
1515
OnboardingPattern,
1616
InfoPattern,
@@ -30,7 +30,7 @@ def print_welcome():
3030
"""환영 메시지 출력 (디자인 시스템 적용)"""
3131
if not use_ui:
3232
print("=" * 70)
33-
print("🚀 Welcome to llmkit!")
33+
print("🚀 Welcome to beanllm!")
3434
print("=" * 70)
3535
return
3636

@@ -43,7 +43,7 @@ def print_quick_start():
4343
if not use_ui:
4444
print("\n📚 Quick Start:")
4545
print(" 1. Set environment variables: export OPENAI_API_KEY='your-key'")
46-
print(" 2. Try: python -c \"from llmkit import get_registry; print(get_registry().get_available_models())\"")
46+
print(" 2. Try: python -c \"from beanllm import Client; print(Client().list_models())\"")
4747
return
4848

4949
# 온보딩 패턴 사용
@@ -56,15 +56,15 @@ def print_quick_start():
5656
},
5757
{
5858
"title": "Try it out",
59-
"description": "from llmkit import get_registry; r = get_registry()"
59+
"description": "from beanllm import Client; client = Client()"
6060
},
6161
{
6262
"title": "Use CLI",
63-
"description": "llmkit list"
63+
"description": "beanllm list"
6464
},
6565
{
6666
"title": "Read docs",
67-
"description": "https://github.com/yourusername/llmkit"
67+
"description": "https://github.com/leebeanbin/beanllm"
6868
}
6969
]
7070
)
@@ -98,14 +98,14 @@ def print_providers_status():
9898
import google.generativeai
9999
providers.append((StatusIcon.success(), "Gemini", Badge.success("Installed")))
100100
except ImportError:
101-
providers.append((StatusIcon.warning(), "Gemini", "Optional - pip install llmkit[gemini]"))
101+
providers.append((StatusIcon.warning(), "Gemini", "Optional - pip install beanllm[gemini]"))
102102

103103
# Ollama
104104
try:
105105
import ollama
106106
providers.append((StatusIcon.success(), "Ollama", Badge.success("Installed")))
107107
except ImportError:
108-
providers.append((StatusIcon.warning(), "Ollama", "Optional - pip install llmkit[ollama]"))
108+
providers.append((StatusIcon.warning(), "Ollama", "Optional - pip install beanllm[ollama]"))
109109

110110
console = get_console()
111111
table = Table(title="[bold cyan]📦 Provider Status[/bold cyan]", box=box.ROUNDED, show_header=True)
@@ -129,8 +129,8 @@ def main():
129129
# 추가 정보
130130
if use_ui:
131131
InfoPattern.render(
132-
"💡 Tip: Set LLMKIT_SHOW_BANNER=true to see this on import",
133-
details=["📚 Docs: https://github.com/yourusername/llmkit"]
132+
"💡 Tip: Set BEANLLM_SHOW_BANNER=true to see this on import",
133+
details=["📚 Docs: https://github.com/leebeanbin/beanllm"]
134134
)
135135

136136

src/beanllm/domain/embeddings/advanced.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .utils import batch_cosine_similarity
99

1010
try:
11-
from ...utils.logger import get_logger
11+
from beanllm.utils.logger import get_logger
1212
except ImportError:
1313
import logging
1414

src/beanllm/domain/embeddings/api_embeddings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from .base import BaseAPIEmbedding
2020

2121
try:
22-
from ...utils.logger import get_logger
22+
from beanllm.utils.logger import get_logger
2323
except ImportError:
2424
import logging
2525

src/beanllm/domain/embeddings/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import List, Optional, Tuple
1010

1111
try:
12-
from ...utils.logger import get_logger
12+
from beanllm.utils.logger import get_logger
1313
except ImportError:
1414
import logging
1515

src/beanllm/domain/embeddings/cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
from typing import Any, Dict, List, Optional
88

99
try:
10-
from ...utils.cache import LRUCache
11-
from ...utils.logger import get_logger
10+
from beanllm.utils.cache import LRUCache
11+
from beanllm.utils.logger import get_logger
1212
except ImportError:
1313
import logging
1414

src/beanllm/domain/embeddings/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818

1919
try:
20-
from ...utils.logger import get_logger
20+
from beanllm.utils.logger import get_logger
2121
except ImportError:
2222
import logging
2323

src/beanllm/domain/embeddings/local_embeddings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .base import BaseLocalEmbedding
1818

1919
try:
20-
from ...utils.logger import get_logger
20+
from beanllm.utils.logger import get_logger
2121
except ImportError:
2222
import logging
2323

src/beanllm/domain/embeddings/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
np = None
1414

1515
try:
16-
from ...utils.logger import get_logger
16+
from beanllm.utils.logger import get_logger
1717
except ImportError:
1818
import logging
1919

src/beanllm/domain/evaluation/checklist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _get_client(self):
6868
"""클라이언트 lazy loading"""
6969
if self.client is None:
7070
try:
71-
from ...facade.client_facade import create_client
71+
from beanllm.facade.client_facade import create_client
7272

7373
self.client = create_client()
7474
except Exception:

0 commit comments

Comments
 (0)