statusline 0.1.0__py3-none-any.whl

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.
statusline/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .core import StatusLine
2
+
3
+ __all__ = ["StatusLine"]
statusline/core.py ADDED
@@ -0,0 +1,26 @@
1
+ class StatusLine:
2
+ def __init__(self, enabled=True, checking_prefix="[CHECKING]"):
3
+ self.enabled = enabled
4
+ self.prev_len = 0
5
+ self.checking_prefix = checking_prefix
6
+
7
+ def update_log(self, msg: str):
8
+ if not self.enabled:
9
+ return
10
+ width = max(self.prev_len, len(msg))
11
+ print(f"\r{msg:<{width}}", end="", flush=True)
12
+ self.prev_len = width
13
+
14
+ def result_log(self, msg: str):
15
+ if not self.enabled:
16
+ print(msg)
17
+ return
18
+ width = max(self.prev_len, len(msg))
19
+ print(f"\r{msg:<{width}}")
20
+ self.prev_len = 0
21
+
22
+ def emit(self, msg: str):
23
+ if msg.startswith(self.checking_prefix):
24
+ self.update_log(msg)
25
+ else:
26
+ self.result_log(msg)
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: statusline
3
+ Version: 0.1.0
4
+ Summary: Tiny single-line status updater for CLI
5
+ Author-email: Hunhee Choi <hunhee9982@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 HunheeChoi
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/hunhee99/statusline
29
+ Project-URL: Repository, https://github.com/hunhee99/statusline
30
+ Project-URL: Issues, https://github.com/hunhee99/statusline/issues
31
+ Keywords: cli,terminal,progress,status,logging,tqdm
32
+ Classifier: Programming Language :: Python :: 3
33
+ Classifier: Programming Language :: Python :: 3 :: Only
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Classifier: Intended Audience :: Developers
37
+ Classifier: Topic :: Software Development :: Libraries
38
+ Classifier: Topic :: Utilities
39
+ Requires-Python: >=3.9
40
+ Description-Content-Type: text/markdown
41
+ License-File: LICENSE
42
+ Dynamic: license-file
43
+
44
+ # statusline
45
+
46
+ A tiny, dependency-free status logger for CLI scripts.
47
+ Made because I got tired of spamming `print()` in brute-force / crawling / long loops.
48
+
49
+ ## What it does
50
+
51
+ `emit()` routes your message automatically:
52
+
53
+ - If the message starts with `[CHECKING]` (or your custom prefix), it **updates in-place** on a single line (loading-bar vibe).
54
+ - Otherwise, it prints a **persistent result line** (won’t be overwritten).
55
+
56
+ ## Install (editable / dev)
57
+
58
+ ```bash
59
+ pip install -e .
60
+ ```
61
+
62
+ Tip: If you're using a specific interpreter/venv, always install with that same Python:
63
+
64
+ ```bash
65
+ python -m pip install -e .
66
+ ```
67
+
68
+ ## Usage
69
+
70
+ ```python
71
+ from statusline import StatusLine
72
+
73
+ st = StatusLine() # or: StatusLine(checking_prefix="[PROGRESS]")
74
+
75
+ st.emit("[CHECKING] probing...") # updates the same line
76
+ st.emit("[CHECKING] still probing...")
77
+
78
+ st.emit("do not erase this line!") # printed as a normal line (kept on screen)
79
+ ```
80
+
81
+ ### Notes
82
+ - Prefix matching is simple string logic: `msg.startswith(checking_prefix)`.
83
+ - If your editor (e.g., VSCode/Pylance) shows missing-import warnings while it still runs,
84
+ your language server is probably using a different interpreter. Select the same interpreter
85
+ you used to install this package and restart the language server.
86
+
87
+ ---
88
+
89
+ ## statusline (한국어)
90
+
91
+ CLI에서 로그 찍는 게 귀찮아서 만든 초경량(의존성 없음) 상태 출력 유틸.
92
+ 브루트포스/크롤링/긴 반복문 돌릴 때 `print()` 난사하기 싫어서 만들었음.
93
+
94
+ ### 기능
95
+
96
+ emit() 하나로 자동 분기됨:
97
+ - 메시지가 [CHECKING](또는 커스텀 prefix)로 시작하면 한 줄에서 계속 갱신됨(로딩바 느낌)
98
+ - 그 외 메시지는 결과 로그로 확정 출력되어 절대 안 지워짐
99
+
100
+ ### 설치 (editable / 개발용)
101
+
102
+ ```bash
103
+ pip install -e .
104
+ ```
105
+
106
+ 팁: 인터프리터/venv를 쓰고 있다면, 항상 같은 파이썬으로 설치해야 함:
107
+
108
+ ```bash
109
+ python -m pip install -e .
110
+ ```
111
+
112
+ ### 사용법
113
+
114
+ ```python
115
+ from statusline import StatusLine
116
+
117
+ st = StatusLine() # StatusLine(checking_prefix="[PROGRESS]") 처럼 prefix 변경도 가능
118
+
119
+ st.emit("[CHECKING] 뭐시기...") # 같은 줄에서 계속 갱신됨
120
+ st.emit("[CHECKING] 더 뭐시기...")
121
+
122
+ st.emit("지워지지 말거라!") # 결과는 개행으로 확정 출력(안 사라짐)
123
+ ```
@@ -0,0 +1,7 @@
1
+ statusline/__init__.py,sha256=xuHwg0OmSg0VjxZlCJI9YFllo1Y7MKNNogHEzC2zo_M,54
2
+ statusline/core.py,sha256=IjuOnxIaTAl1YzLIsyi9CS0Zs63HP7rCBHgPRlmqs5E,790
3
+ statusline-0.1.0.dist-info/licenses/LICENSE,sha256=wEoJYyBH9q10xn-Hr3LbkKq7I2ChrIrI3PuHBsR2Lck,1067
4
+ statusline-0.1.0.dist-info/METADATA,sha256=7MbkC9yzb_v1uLV5Iavx_O4HiOJxj-F68QFBr9PRrss,4389
5
+ statusline-0.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
6
+ statusline-0.1.0.dist-info/top_level.txt,sha256=MSV3ejcgDGA_we3OHehB71V4vdlxE_fGHVoMQMtF5KE,11
7
+ statusline-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 HunheeChoi
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 @@
1
+ statusline