helper-dev-utils 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- helper_dev_utils-0.5.0/LICENSE +21 -0
- helper_dev_utils-0.5.0/MANIFEST.in +5 -0
- helper_dev_utils-0.5.0/PKG-INFO +230 -0
- helper_dev_utils-0.5.0/README.md +184 -0
- helper_dev_utils-0.5.0/pyproject.toml +84 -0
- helper_dev_utils-0.5.0/requirements-dev.txt +4 -0
- helper_dev_utils-0.5.0/requirements.txt +4 -0
- helper_dev_utils-0.5.0/setup.cfg +4 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/.env.example_logger +63 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/__init__.py +86 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/helper_logger.py +546 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/helper_pandas.py +1018 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/helper_utils_colab.py +679 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils/helper_utils_print.py +725 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils.egg-info/PKG-INFO +230 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils.egg-info/SOURCES.txt +17 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils.egg-info/dependency_links.txt +1 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils.egg-info/requires.txt +24 -0
- helper_dev_utils-0.5.0/src/helper_dev_utils.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 c0z0c
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: helper-dev-utils
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Python 유틸리티 모음 라이브러리: 로깅, Pandas 확장, 출력, 경로 관리
|
|
5
|
+
Author-email: c0z0c <c0z0c.dev@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/c0z0c-helper/helper_dev_utils
|
|
8
|
+
Project-URL: Repository, https://github.com/c0z0c-helper/helper_dev_utils
|
|
9
|
+
Project-URL: Issues, https://github.com/c0z0c-helper/helper_dev_utils/issues
|
|
10
|
+
Keywords: utilities,logger,pandas,print,colab,jupyter,path,cache,google-drive,logging,visualization,tree,korean
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: matplotlib>=3.2.0
|
|
27
|
+
Requires-Dist: numpy>=1.16.0
|
|
28
|
+
Requires-Dist: pandas>=1.0.0
|
|
29
|
+
Requires-Dist: pytz>=2021.1
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
35
|
+
Provides-Extra: dotenv
|
|
36
|
+
Requires-Dist: python-dotenv>=0.19.0; extra == "dotenv"
|
|
37
|
+
Provides-Extra: jupyter
|
|
38
|
+
Requires-Dist: IPython>=7.0.0; extra == "jupyter"
|
|
39
|
+
Provides-Extra: torch
|
|
40
|
+
Requires-Dist: torch>=1.0.0; extra == "torch"
|
|
41
|
+
Provides-Extra: all
|
|
42
|
+
Requires-Dist: python-dotenv>=0.19.0; extra == "all"
|
|
43
|
+
Requires-Dist: IPython>=7.0.0; extra == "all"
|
|
44
|
+
Requires-Dist: torch>=1.0.0; extra == "all"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# helper-dev-utils
|
|
48
|
+
|
|
49
|
+
[](https://badge.fury.io/py/helper-dev-utils)
|
|
50
|
+
[](https://pypi.org/project/helper-dev-utils/)
|
|
51
|
+
[](https://opensource.org/licenses/MIT)
|
|
52
|
+
|
|
53
|
+
Python 개발 시 자주 사용하는 유틸리티 모음 라이브러리
|
|
54
|
+
|
|
55
|
+
## 주요 기능
|
|
56
|
+
|
|
57
|
+
- **helper_logger**: 로깅 유틸리티 (콘솔/파일 핸들러, 환경변수 기반 설정, KST 타임존)
|
|
58
|
+
- **helper_pandas**: Pandas 확장 기능 (한글 컬럼 설명, 데이터 출력, HTML/콘솔 지원)
|
|
59
|
+
- **helper_utils_print**: 출력 유틸리티 (디렉토리/JSON/딕셔너리 트리 구조 출력)
|
|
60
|
+
- **helper_utils_colab**: 경로 관리 유틸리티 (로컬/Colab 환경 경로 자동 탐색)
|
|
61
|
+
|
|
62
|
+
## 설치
|
|
63
|
+
|
|
64
|
+
### 기본 설치
|
|
65
|
+
```bash
|
|
66
|
+
pip install helper-dev-utils
|
|
67
|
+
|
|
68
|
+
# 테스트 서버
|
|
69
|
+
pip install --index-url https://test.pypi.org/simple/ helper-dev-utils
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 선택적 의존성 설치
|
|
73
|
+
```bash
|
|
74
|
+
# .env 파일 지원
|
|
75
|
+
pip install helper-dev-utils[dotenv]
|
|
76
|
+
|
|
77
|
+
# Jupyter/Colab 지원
|
|
78
|
+
pip install helper-dev-utils[jupyter]
|
|
79
|
+
|
|
80
|
+
# PyTorch Tensor 지원
|
|
81
|
+
pip install helper-dev-utils[torch]
|
|
82
|
+
|
|
83
|
+
# 모든 선택적 의존성 설치
|
|
84
|
+
pip install helper-dev-utils[all]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 사용법
|
|
88
|
+
|
|
89
|
+
### 1. Logger (helper_logger)
|
|
90
|
+
|
|
91
|
+
환경변수 또는 코드 기반으로 로깅을 쉽게 설정할 수 있습니다.
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
from helper_dev_utils import get_auto_logger, sample_logger_env
|
|
95
|
+
|
|
96
|
+
# .env.example_logger 샘플 파일 생성
|
|
97
|
+
sample_logger_env()
|
|
98
|
+
|
|
99
|
+
# 자동으로 호출자 모듈명을 로거 이름으로 사용
|
|
100
|
+
logger = get_auto_logger()
|
|
101
|
+
logger.info("Hello World")
|
|
102
|
+
logger.debug("디버그 메시지")
|
|
103
|
+
logger.warning("경고 메시지")
|
|
104
|
+
logger.error("에러 메시지")
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**환경변수 설정 예시 (`.env` 파일)**:
|
|
108
|
+
```env
|
|
109
|
+
LOG_LEVEL=INFO
|
|
110
|
+
LOG_CONSOLE=True
|
|
111
|
+
LOG_FILE=True
|
|
112
|
+
LOG_FILE_PATH=./logs/app.log
|
|
113
|
+
LOG_FILE_MAX_BYTES=10485760
|
|
114
|
+
LOG_FILE_BACKUP_COUNT=5
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 2. Pandas Extension (helper_pandas)
|
|
118
|
+
|
|
119
|
+
DataFrame과 Series에 한글 컬럼 설명 기능을 추가합니다.
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from helper_dev_utils import set_pandas_extension
|
|
123
|
+
import pandas as pd
|
|
124
|
+
|
|
125
|
+
# Pandas 확장 등록
|
|
126
|
+
set_pandas_extension()
|
|
127
|
+
|
|
128
|
+
# DataFrame 생성
|
|
129
|
+
df = pd.DataFrame({
|
|
130
|
+
'name': ['Alice', 'Bob', 'Charlie'],
|
|
131
|
+
'age': [25, 30, 35],
|
|
132
|
+
'city': ['Seoul', 'Busan', 'Incheon']
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
# 컬럼 설명 추가
|
|
136
|
+
df.set_col_description('name', '사용자 이름')
|
|
137
|
+
df.set_col_description('age', '나이')
|
|
138
|
+
df.set_col_description('city', '거주 도시')
|
|
139
|
+
|
|
140
|
+
# 한글 컬럼명과 함께 출력
|
|
141
|
+
df.show()
|
|
142
|
+
# 출력:
|
|
143
|
+
# name (사용자 이름) age (나이) city (거주 도시)
|
|
144
|
+
# Alice 25 Seoul
|
|
145
|
+
# Bob 30 Busan
|
|
146
|
+
# Charlie 35 Incheon
|
|
147
|
+
|
|
148
|
+
# 컬럼 설명 조회
|
|
149
|
+
print(df.get_col_description('name')) # 출력: 사용자 이름
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 3. Print Utilities (helper_utils_print)
|
|
153
|
+
|
|
154
|
+
디렉토리, JSON, 딕셔너리를 트리 구조로 출력합니다.
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
from helper_dev_utils import print_dir_tree, print_json_tree, print_dic_tree
|
|
158
|
+
|
|
159
|
+
# 디렉토리 트리 출력
|
|
160
|
+
print_dir_tree('/path/to/directory', max_depth=3)
|
|
161
|
+
|
|
162
|
+
# JSON/딕셔너리 트리 출력 (파이프 스타일)
|
|
163
|
+
data = {
|
|
164
|
+
'users': [
|
|
165
|
+
{'name': 'Alice', 'age': 25},
|
|
166
|
+
{'name': 'Bob', 'age': 30}
|
|
167
|
+
],
|
|
168
|
+
'config': {'debug': True}
|
|
169
|
+
}
|
|
170
|
+
print_json_tree(data, max_depth=5, max_list_items=10)
|
|
171
|
+
|
|
172
|
+
# 딕셔너리 트리 출력 (박스 드로잉 스타일)
|
|
173
|
+
print_dic_tree(data, max_depth=5, show_values=True)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 4. Colab/Path Utilities (helper_utils_colab)
|
|
177
|
+
|
|
178
|
+
로컬 및 Google Colab 환경에서 경로를 자동으로 관리합니다.
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from helper_dev_utils import my_driver, my_cache
|
|
182
|
+
|
|
183
|
+
# Google Drive 경로 가져오기 (Colab에서 자동 마운트)
|
|
184
|
+
drive_path = my_driver()
|
|
185
|
+
print(drive_path) # /content/drive/MyDrive (Colab) 또는 로컬 경로
|
|
186
|
+
|
|
187
|
+
# 캐시 디렉토리 가져오기 (OS별 자동 탐색)
|
|
188
|
+
cache_path = my_cache()
|
|
189
|
+
print(cache_path) # ~/.cache (Linux/Mac) 또는 로컬 경로
|
|
190
|
+
|
|
191
|
+
# 하위 경로 지정
|
|
192
|
+
model_cache = my_cache('models/bert')
|
|
193
|
+
data_drive = my_driver('datasets/images')
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**환경변수 우선 지원**:
|
|
197
|
+
```env
|
|
198
|
+
MY_DRIVER_PATH=/custom/drive/path
|
|
199
|
+
MY_CACHE_PATH=/custom/cache/path
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## 의존성
|
|
203
|
+
|
|
204
|
+
### 필수 의존성
|
|
205
|
+
- `matplotlib >= 3.2.0`
|
|
206
|
+
- `numpy >= 1.16.0`
|
|
207
|
+
- `pandas >= 1.0.0`
|
|
208
|
+
- `pytz >= 2021.1`
|
|
209
|
+
|
|
210
|
+
### 선택적 의존성
|
|
211
|
+
- `python-dotenv >= 0.19.0` - `.env` 파일 지원
|
|
212
|
+
- `IPython >= 7.0.0` - Jupyter/Colab 지원
|
|
213
|
+
- `torch >= 1.0.0` - PyTorch Tensor 지원
|
|
214
|
+
|
|
215
|
+
## 라이선스
|
|
216
|
+
|
|
217
|
+
MIT License - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세요.
|
|
218
|
+
|
|
219
|
+
## 기여
|
|
220
|
+
|
|
221
|
+
이슈 리포트 및 풀 리퀘스트는 [GitHub Repository](https://github.com/c0z0c-helper/helper_dev_utils)에서 환영합니다!
|
|
222
|
+
|
|
223
|
+
## 작성자
|
|
224
|
+
|
|
225
|
+
**c0z0c** - [c0z0c.dev@gmail.com](mailto:c0z0c.dev@gmail.com)
|
|
226
|
+
|
|
227
|
+
## 관련 라이브러리
|
|
228
|
+
|
|
229
|
+
- [helper-plot-hangul](https://github.com/c0z0c-helper/helper_plot_hangul) - Matplotlib 한글 폰트 자동 설정
|
|
230
|
+
- [helper-hwp](https://github.com/c0z0c-helper/helper_hwp) - HWP 파일 파싱 라이브러리
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# helper-dev-utils
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/helper-dev-utils)
|
|
4
|
+
[](https://pypi.org/project/helper-dev-utils/)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Python 개발 시 자주 사용하는 유틸리티 모음 라이브러리
|
|
8
|
+
|
|
9
|
+
## 주요 기능
|
|
10
|
+
|
|
11
|
+
- **helper_logger**: 로깅 유틸리티 (콘솔/파일 핸들러, 환경변수 기반 설정, KST 타임존)
|
|
12
|
+
- **helper_pandas**: Pandas 확장 기능 (한글 컬럼 설명, 데이터 출력, HTML/콘솔 지원)
|
|
13
|
+
- **helper_utils_print**: 출력 유틸리티 (디렉토리/JSON/딕셔너리 트리 구조 출력)
|
|
14
|
+
- **helper_utils_colab**: 경로 관리 유틸리티 (로컬/Colab 환경 경로 자동 탐색)
|
|
15
|
+
|
|
16
|
+
## 설치
|
|
17
|
+
|
|
18
|
+
### 기본 설치
|
|
19
|
+
```bash
|
|
20
|
+
pip install helper-dev-utils
|
|
21
|
+
|
|
22
|
+
# 테스트 서버
|
|
23
|
+
pip install --index-url https://test.pypi.org/simple/ helper-dev-utils
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 선택적 의존성 설치
|
|
27
|
+
```bash
|
|
28
|
+
# .env 파일 지원
|
|
29
|
+
pip install helper-dev-utils[dotenv]
|
|
30
|
+
|
|
31
|
+
# Jupyter/Colab 지원
|
|
32
|
+
pip install helper-dev-utils[jupyter]
|
|
33
|
+
|
|
34
|
+
# PyTorch Tensor 지원
|
|
35
|
+
pip install helper-dev-utils[torch]
|
|
36
|
+
|
|
37
|
+
# 모든 선택적 의존성 설치
|
|
38
|
+
pip install helper-dev-utils[all]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 사용법
|
|
42
|
+
|
|
43
|
+
### 1. Logger (helper_logger)
|
|
44
|
+
|
|
45
|
+
환경변수 또는 코드 기반으로 로깅을 쉽게 설정할 수 있습니다.
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from helper_dev_utils import get_auto_logger, sample_logger_env
|
|
49
|
+
|
|
50
|
+
# .env.example_logger 샘플 파일 생성
|
|
51
|
+
sample_logger_env()
|
|
52
|
+
|
|
53
|
+
# 자동으로 호출자 모듈명을 로거 이름으로 사용
|
|
54
|
+
logger = get_auto_logger()
|
|
55
|
+
logger.info("Hello World")
|
|
56
|
+
logger.debug("디버그 메시지")
|
|
57
|
+
logger.warning("경고 메시지")
|
|
58
|
+
logger.error("에러 메시지")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**환경변수 설정 예시 (`.env` 파일)**:
|
|
62
|
+
```env
|
|
63
|
+
LOG_LEVEL=INFO
|
|
64
|
+
LOG_CONSOLE=True
|
|
65
|
+
LOG_FILE=True
|
|
66
|
+
LOG_FILE_PATH=./logs/app.log
|
|
67
|
+
LOG_FILE_MAX_BYTES=10485760
|
|
68
|
+
LOG_FILE_BACKUP_COUNT=5
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Pandas Extension (helper_pandas)
|
|
72
|
+
|
|
73
|
+
DataFrame과 Series에 한글 컬럼 설명 기능을 추가합니다.
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from helper_dev_utils import set_pandas_extension
|
|
77
|
+
import pandas as pd
|
|
78
|
+
|
|
79
|
+
# Pandas 확장 등록
|
|
80
|
+
set_pandas_extension()
|
|
81
|
+
|
|
82
|
+
# DataFrame 생성
|
|
83
|
+
df = pd.DataFrame({
|
|
84
|
+
'name': ['Alice', 'Bob', 'Charlie'],
|
|
85
|
+
'age': [25, 30, 35],
|
|
86
|
+
'city': ['Seoul', 'Busan', 'Incheon']
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
# 컬럼 설명 추가
|
|
90
|
+
df.set_col_description('name', '사용자 이름')
|
|
91
|
+
df.set_col_description('age', '나이')
|
|
92
|
+
df.set_col_description('city', '거주 도시')
|
|
93
|
+
|
|
94
|
+
# 한글 컬럼명과 함께 출력
|
|
95
|
+
df.show()
|
|
96
|
+
# 출력:
|
|
97
|
+
# name (사용자 이름) age (나이) city (거주 도시)
|
|
98
|
+
# Alice 25 Seoul
|
|
99
|
+
# Bob 30 Busan
|
|
100
|
+
# Charlie 35 Incheon
|
|
101
|
+
|
|
102
|
+
# 컬럼 설명 조회
|
|
103
|
+
print(df.get_col_description('name')) # 출력: 사용자 이름
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 3. Print Utilities (helper_utils_print)
|
|
107
|
+
|
|
108
|
+
디렉토리, JSON, 딕셔너리를 트리 구조로 출력합니다.
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from helper_dev_utils import print_dir_tree, print_json_tree, print_dic_tree
|
|
112
|
+
|
|
113
|
+
# 디렉토리 트리 출력
|
|
114
|
+
print_dir_tree('/path/to/directory', max_depth=3)
|
|
115
|
+
|
|
116
|
+
# JSON/딕셔너리 트리 출력 (파이프 스타일)
|
|
117
|
+
data = {
|
|
118
|
+
'users': [
|
|
119
|
+
{'name': 'Alice', 'age': 25},
|
|
120
|
+
{'name': 'Bob', 'age': 30}
|
|
121
|
+
],
|
|
122
|
+
'config': {'debug': True}
|
|
123
|
+
}
|
|
124
|
+
print_json_tree(data, max_depth=5, max_list_items=10)
|
|
125
|
+
|
|
126
|
+
# 딕셔너리 트리 출력 (박스 드로잉 스타일)
|
|
127
|
+
print_dic_tree(data, max_depth=5, show_values=True)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 4. Colab/Path Utilities (helper_utils_colab)
|
|
131
|
+
|
|
132
|
+
로컬 및 Google Colab 환경에서 경로를 자동으로 관리합니다.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from helper_dev_utils import my_driver, my_cache
|
|
136
|
+
|
|
137
|
+
# Google Drive 경로 가져오기 (Colab에서 자동 마운트)
|
|
138
|
+
drive_path = my_driver()
|
|
139
|
+
print(drive_path) # /content/drive/MyDrive (Colab) 또는 로컬 경로
|
|
140
|
+
|
|
141
|
+
# 캐시 디렉토리 가져오기 (OS별 자동 탐색)
|
|
142
|
+
cache_path = my_cache()
|
|
143
|
+
print(cache_path) # ~/.cache (Linux/Mac) 또는 로컬 경로
|
|
144
|
+
|
|
145
|
+
# 하위 경로 지정
|
|
146
|
+
model_cache = my_cache('models/bert')
|
|
147
|
+
data_drive = my_driver('datasets/images')
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**환경변수 우선 지원**:
|
|
151
|
+
```env
|
|
152
|
+
MY_DRIVER_PATH=/custom/drive/path
|
|
153
|
+
MY_CACHE_PATH=/custom/cache/path
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 의존성
|
|
157
|
+
|
|
158
|
+
### 필수 의존성
|
|
159
|
+
- `matplotlib >= 3.2.0`
|
|
160
|
+
- `numpy >= 1.16.0`
|
|
161
|
+
- `pandas >= 1.0.0`
|
|
162
|
+
- `pytz >= 2021.1`
|
|
163
|
+
|
|
164
|
+
### 선택적 의존성
|
|
165
|
+
- `python-dotenv >= 0.19.0` - `.env` 파일 지원
|
|
166
|
+
- `IPython >= 7.0.0` - Jupyter/Colab 지원
|
|
167
|
+
- `torch >= 1.0.0` - PyTorch Tensor 지원
|
|
168
|
+
|
|
169
|
+
## 라이선스
|
|
170
|
+
|
|
171
|
+
MIT License - 자세한 내용은 [LICENSE](LICENSE) 파일을 참조하세요.
|
|
172
|
+
|
|
173
|
+
## 기여
|
|
174
|
+
|
|
175
|
+
이슈 리포트 및 풀 리퀘스트는 [GitHub Repository](https://github.com/c0z0c-helper/helper_dev_utils)에서 환영합니다!
|
|
176
|
+
|
|
177
|
+
## 작성자
|
|
178
|
+
|
|
179
|
+
**c0z0c** - [c0z0c.dev@gmail.com](mailto:c0z0c.dev@gmail.com)
|
|
180
|
+
|
|
181
|
+
## 관련 라이브러리
|
|
182
|
+
|
|
183
|
+
- [helper-plot-hangul](https://github.com/c0z0c-helper/helper_plot_hangul) - Matplotlib 한글 폰트 자동 설정
|
|
184
|
+
- [helper-hwp](https://github.com/c0z0c-helper/helper_hwp) - HWP 파일 파싱 라이브러리
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "helper-dev-utils"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Python 유틸리티 모음 라이브러리: 로깅, Pandas 확장, 출력, 경로 관리"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "c0z0c", email = "c0z0c.dev@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"utilities", "logger", "pandas", "print", "colab",
|
|
17
|
+
"jupyter", "path", "cache", "google-drive", "logging",
|
|
18
|
+
"visualization", "tree", "korean"
|
|
19
|
+
]
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 4 - Beta",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.8",
|
|
26
|
+
"Programming Language :: Python :: 3.9",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Programming Language :: Python :: 3.13",
|
|
31
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
32
|
+
"Topic :: Utilities",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
dependencies = [
|
|
36
|
+
"matplotlib>=3.2.0",
|
|
37
|
+
"numpy>=1.16.0",
|
|
38
|
+
"pandas>=1.0.0",
|
|
39
|
+
"pytz>=2021.1",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
dev = [
|
|
44
|
+
"pytest>=7.0.0",
|
|
45
|
+
"pytest-cov>=4.0.0",
|
|
46
|
+
"black>=23.0.0",
|
|
47
|
+
"ruff>=0.1.0",
|
|
48
|
+
]
|
|
49
|
+
dotenv = [
|
|
50
|
+
"python-dotenv>=0.19.0",
|
|
51
|
+
]
|
|
52
|
+
jupyter = [
|
|
53
|
+
"IPython>=7.0.0",
|
|
54
|
+
]
|
|
55
|
+
torch = [
|
|
56
|
+
"torch>=1.0.0",
|
|
57
|
+
]
|
|
58
|
+
all = [
|
|
59
|
+
"python-dotenv>=0.19.0",
|
|
60
|
+
"IPython>=7.0.0",
|
|
61
|
+
"torch>=1.0.0",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
[project.urls]
|
|
65
|
+
Homepage = "https://github.com/c0z0c-helper/helper_dev_utils"
|
|
66
|
+
Repository = "https://github.com/c0z0c-helper/helper_dev_utils"
|
|
67
|
+
Issues = "https://github.com/c0z0c-helper/helper_dev_utils/issues"
|
|
68
|
+
|
|
69
|
+
[tool.setuptools]
|
|
70
|
+
package-dir = {"" = "src"}
|
|
71
|
+
|
|
72
|
+
[tool.setuptools.packages.find]
|
|
73
|
+
where = ["src"]
|
|
74
|
+
|
|
75
|
+
[tool.setuptools.package-data]
|
|
76
|
+
helper_dev_utils = [".env.example_logger"]
|
|
77
|
+
|
|
78
|
+
[tool.black]
|
|
79
|
+
line-length = 100
|
|
80
|
+
target-version = ["py38", "py39", "py310", "py311", "py312"]
|
|
81
|
+
|
|
82
|
+
[tool.ruff]
|
|
83
|
+
line-length = 100
|
|
84
|
+
target-version = "py38"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# helper_logger 환경변수 설정 예제
|
|
2
|
+
# 이 파일을 .env로 복사하여 사용하세요
|
|
3
|
+
|
|
4
|
+
# =============================================================================
|
|
5
|
+
# 로그 레벨 설정 (우선순위)
|
|
6
|
+
# =============================================================================
|
|
7
|
+
|
|
8
|
+
# 1순위: 전체 로그 레벨 (콘솔과 파일 모두 적용)
|
|
9
|
+
# LOG_LEVEL을 설정하면 LOG_CONSOLE_LEVEL과 LOG_FILE_LEVEL보다 우선합니다
|
|
10
|
+
# 옵션: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
|
11
|
+
LOG_LEVEL=INFO
|
|
12
|
+
|
|
13
|
+
# 2순위: 개별 로그 레벨 (LOG_LEVEL이 설정되지 않은 경우에만 적용)
|
|
14
|
+
# 콘솔 출력 로그 레벨
|
|
15
|
+
LOG_CONSOLE_LEVEL=WARNING
|
|
16
|
+
|
|
17
|
+
# 파일 저장 로그 레벨
|
|
18
|
+
LOG_FILE_LEVEL=DEBUG
|
|
19
|
+
|
|
20
|
+
# =============================================================================
|
|
21
|
+
# 로그 디렉토리 및 파일 설정
|
|
22
|
+
# =============================================================================
|
|
23
|
+
|
|
24
|
+
# 로그 파일이 저장될 디렉토리 경로
|
|
25
|
+
# 기본값: ./logs
|
|
26
|
+
LOG_DIR=./logs
|
|
27
|
+
|
|
28
|
+
# 파일 로깅 활성화 여부
|
|
29
|
+
# 옵션: true, false, 1, 0, yes, no
|
|
30
|
+
# 기본값: false (파일 로깅 비활성화)
|
|
31
|
+
LOG_FILE_ENABLED=false
|
|
32
|
+
|
|
33
|
+
# =============================================================================
|
|
34
|
+
# 사용 예제
|
|
35
|
+
# =============================================================================
|
|
36
|
+
#
|
|
37
|
+
# 예제 1: 모든 로그를 DEBUG 레벨로 설정하고 파일에 저장
|
|
38
|
+
# LOG_LEVEL=DEBUG
|
|
39
|
+
# LOG_FILE_ENABLED=true
|
|
40
|
+
# LOG_DIR=./my_logs
|
|
41
|
+
#
|
|
42
|
+
# 예제 2: 콘솔은 WARNING, 파일은 DEBUG (파일 로깅 활성화)
|
|
43
|
+
# # LOG_LEVEL= (주석 처리)
|
|
44
|
+
# LOG_CONSOLE_LEVEL=WARNING
|
|
45
|
+
# LOG_FILE_LEVEL=DEBUG
|
|
46
|
+
# LOG_FILE_ENABLED=true
|
|
47
|
+
#
|
|
48
|
+
# 예제 3: 환경변수 무시하고 코드에서 직접 설정
|
|
49
|
+
# logger = get_logger("my_app", use_env=False, console_level=logging.INFO)
|
|
50
|
+
#
|
|
51
|
+
# =============================================================================
|
|
52
|
+
# 우선순위 정리
|
|
53
|
+
# =============================================================================
|
|
54
|
+
#
|
|
55
|
+
# 최종 설정 우선순위:
|
|
56
|
+
# 1. 함수 매개변수 (console_level, file_level, file, log_dir 등)
|
|
57
|
+
# 2. 환경변수 (.env 파일)
|
|
58
|
+
# - LOG_LEVEL (전체)
|
|
59
|
+
# - LOG_CONSOLE_LEVEL, LOG_FILE_LEVEL (개별)
|
|
60
|
+
# - LOG_DIR, LOG_FILE_ENABLED
|
|
61
|
+
# 3. 기본값 (console_level=INFO, file_level=DEBUG, file=False, log_dir=./logs)
|
|
62
|
+
#
|
|
63
|
+
# =============================================================================
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""
|
|
2
|
+
helper-dev-utils
|
|
3
|
+
============
|
|
4
|
+
|
|
5
|
+
Python 유틸리티 모음 라이브러리
|
|
6
|
+
|
|
7
|
+
주요 모듈:
|
|
8
|
+
- helper_logger: 로깅 유틸리티 (콘솔/파일 핸들러, 환경변수 기반 설정)
|
|
9
|
+
- helper_pandas: Pandas 확장 기능 (한글 컬럼 설명, 데이터 출력)
|
|
10
|
+
- helper_utils_print: 출력 유틸리티 (디렉토리/JSON/딕셔너리 트리 구조 출력)
|
|
11
|
+
- helper_utils_colab: 경로 관리 유틸리티 (로컬/Colab 환경 경로 자동 탐색)
|
|
12
|
+
|
|
13
|
+
기본 사용법:
|
|
14
|
+
# Logger
|
|
15
|
+
from helper_dev_utils import get_auto_logger
|
|
16
|
+
logger = get_auto_logger()
|
|
17
|
+
logger.info("Hello World")
|
|
18
|
+
|
|
19
|
+
# Pandas Extension
|
|
20
|
+
from helper_dev_utils import set_pandas_extension
|
|
21
|
+
import pandas as pd
|
|
22
|
+
set_pandas_extension()
|
|
23
|
+
df = pd.DataFrame({'name': ['Alice', 'Bob']})
|
|
24
|
+
df.set_col_description('name', '사용자 이름')
|
|
25
|
+
df.show()
|
|
26
|
+
|
|
27
|
+
# Print Tree
|
|
28
|
+
from helper_dev_utils import print_dir_tree, print_json_tree
|
|
29
|
+
print_dir_tree('/path/to/directory')
|
|
30
|
+
print_json_tree({'key': 'value'})
|
|
31
|
+
|
|
32
|
+
# Colab Path
|
|
33
|
+
from helper_dev_utils import my_driver, my_cache
|
|
34
|
+
driver_path = my_driver() # Google Drive 경로
|
|
35
|
+
cache_path = my_cache() # 캐시 경로
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
__version__ = "0.5.0"
|
|
39
|
+
|
|
40
|
+
# Import main functions from each module
|
|
41
|
+
from .helper_logger import (
|
|
42
|
+
get_logger,
|
|
43
|
+
get_auto_logger,
|
|
44
|
+
sample_logger_env,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
from .helper_pandas import (
|
|
48
|
+
set_pandas_extension,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
from .helper_utils_print import (
|
|
52
|
+
print_dir_tree,
|
|
53
|
+
print_json_tree,
|
|
54
|
+
print_dic_tree,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
from .helper_utils_colab import (
|
|
58
|
+
my_driver,
|
|
59
|
+
my_driver_path,
|
|
60
|
+
my_cache,
|
|
61
|
+
my_cache_path,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
__all__ = [
|
|
65
|
+
# Logger utilities
|
|
66
|
+
"get_logger",
|
|
67
|
+
"get_auto_logger",
|
|
68
|
+
"sample_logger_env",
|
|
69
|
+
|
|
70
|
+
# Pandas extension
|
|
71
|
+
"set_pandas_extension",
|
|
72
|
+
|
|
73
|
+
# Print utilities
|
|
74
|
+
"print_dir_tree",
|
|
75
|
+
"print_json_tree",
|
|
76
|
+
"print_dic_tree",
|
|
77
|
+
|
|
78
|
+
# Colab/Path utilities
|
|
79
|
+
"my_driver",
|
|
80
|
+
"my_driver_path",
|
|
81
|
+
"my_cache",
|
|
82
|
+
"my_cache_path",
|
|
83
|
+
|
|
84
|
+
# Version
|
|
85
|
+
"__version__",
|
|
86
|
+
]
|