faridlib 0.0.1__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.
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: faridlib
3
+ Version: 0.0.1
4
+ Summary: CLI launcher untuk project Machine Learning Labs
5
+ Author-email: Farid Suryadi <nanarananaru2024@gmail.com>
6
+ License: All Rights Reserved
7
+ Project-URL: Homepage, https://github.com/faridSrydi/faridlib
8
+ Project-URL: Repository, https://github.com/faridSrydi/faridlib
9
+ Project-URL: Issues, https://github.com/faridSrydi/faridlib/issues
10
+ Keywords: python,cli,machine-learning,labs,automation
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+
16
+ # faridLib
@@ -0,0 +1 @@
1
+ # faridLib
@@ -0,0 +1 @@
1
+ from .machine_learning import run as machine_learning
@@ -0,0 +1,204 @@
1
+ # Copyright (c) 2026 Farid Suryadi
2
+ # All Rights Reserved.
3
+
4
+ import os
5
+ import sys
6
+ import time
7
+ import itertools
8
+ import subprocess
9
+
10
+ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
11
+
12
+ # ── Warna ANSI ──
13
+ G = "\033[92m" # Hijau
14
+ B = "\033[94m" # Biru
15
+ Y = "\033[93m" # Kuning
16
+ R = "\033[91m" # Merah
17
+ W = "\033[97m" # Putih
18
+ BD = "\033[1m" # Bold
19
+ RS = "\033[0m" # Reset
20
+
21
+ BANNER = r"""
22
+ __ __ _ _ _ _
23
+ | \/ | __ _ ___| |__ (_)_ __ ___ | | ___ __ _ _ __ _ __ (_)_ __ __ _
24
+ | |\/| |/ _` |/ __| '_ \| | '_ \ / _ \ | | / _ \/ _` | '__| '_ \| | '_ \ / _` |
25
+ | | | | (_| | (__| | | | | | | | __/ | |__| __/ (_| | | | | | | | | | | (_| |
26
+ |_| |_|\__,_|\___|_| |_|_|_| |_|\___| |_____\___|\__,_|_| |_| |_|_|_| |_|\__, |
27
+ |___/
28
+ """
29
+
30
+ def clear():
31
+ os.system("cls" if os.name == "nt" else "clear")
32
+
33
+ def loading(msg, duration=1.5):
34
+ """Animasi spinner."""
35
+ spinner = itertools.cycle("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏")
36
+ end = time.time() + duration
37
+ print(f"\n{Y}{BD}>> {msg}", end="", flush=True)
38
+ while time.time() < end:
39
+ sys.stdout.write(f" {G}{next(spinner)}{RS}")
40
+ sys.stdout.flush()
41
+ time.sleep(0.1)
42
+ sys.stdout.write("\b\b")
43
+ print(f" {G}[DONE]{RS}\n")
44
+
45
+ def get_labs():
46
+ """Mencari folder lab."""
47
+ return sorted(
48
+ d for d in os.listdir(BASE_DIR)
49
+ if os.path.isdir(os.path.join(BASE_DIR, d)) and d.startswith("lab-")
50
+ )
51
+
52
+ def get_scripts(lab_folder):
53
+ """Mencari folder scripts."""
54
+ scripts_dir = os.path.join(BASE_DIR, lab_folder, "scripts")
55
+ if not os.path.isdir(scripts_dir):
56
+ return []
57
+ return sorted(f for f in os.listdir(scripts_dir) if f.endswith(".py"))
58
+
59
+ def prettify(filename):
60
+ """Ubah nama file dari script_name.py ke Script Name."""
61
+ return filename.replace(".py", "").replace("_", " ").title()
62
+
63
+ def get_python(lab):
64
+ """Cari venv python di dalam folder lab, fallback ke sys.executable."""
65
+ if os.name == "nt":
66
+ venv = os.path.join(BASE_DIR, lab, ".venv", "Scripts", "python.exe")
67
+ else:
68
+ venv = os.path.join(BASE_DIR, lab, ".venv", "bin", "python")
69
+ return venv if os.path.exists(venv) else sys.executable
70
+
71
+
72
+ def create_lab():
73
+ """Membuat folder lab-XX dan scripts secara otomatis."""
74
+ clear()
75
+ print(f"\n{G}{BD} ╔{'═' * 40}╗{RS}")
76
+ print(f"{G}{BD} ║{'CREATE NEW LAB':^40}║{RS}")
77
+ print(f"{G}{BD} ╚{'═' * 40}╝{RS}\n")
78
+
79
+ num = input(f"{BD} Masukkan Nomor Lab (contoh: 3, 04, 12): {RS}").strip()
80
+
81
+ if not num.isdigit():
82
+ print(f"\n{R}[!] Gagal: Masukkan angka yang valid.{RS}")
83
+ time.sleep(1.5)
84
+ return
85
+
86
+ lab_folder = f"lab-{int(num):02d}" # Format selalu menjadi 2 digit (misal: lab-03)
87
+ lab_path = os.path.join(BASE_DIR, lab_folder)
88
+ scripts_path = os.path.join(lab_path, "scripts")
89
+
90
+ if os.path.exists(lab_path):
91
+ print(f"\n{Y}[!] Folder '{lab_folder}' sudah ada!{RS}")
92
+ else:
93
+ os.makedirs(scripts_path, exist_ok=True)
94
+ print(f"\n{G}[+] Berhasil membuat folder: {lab_folder}{RS}")
95
+ print(f"{G}[+] Berhasil membuat folder: {lab_folder}/scripts{RS}")
96
+
97
+ time.sleep(2)
98
+
99
+ def lab_menu(lab_folder):
100
+ """Menu khusus untuk isi di dalam lab yang dipilih"""
101
+ lab_name = lab_folder.upper().replace("-", " ")
102
+
103
+ while True:
104
+ clear()
105
+ print(f"\n{G}{BD} ╔{'═' * 40}╗{RS}")
106
+ print(f"{G}{BD} ║ {lab_name:^36} ║{RS}")
107
+ print(f"{G}{BD} ╚{'═' * 40}╝{RS}\n")
108
+
109
+ scripts = get_scripts(lab_folder)
110
+
111
+ if not scripts:
112
+ print(f" {Y}[!] Tidak ada script di folder '{lab_folder}/scripts/'.{RS}")
113
+ print(f" {Y} Silakan buat foldernya dan tambahkan file .py{RS}\n")
114
+
115
+ print(f"{B}{'=' * 55}{RS}")
116
+ print(f"{BD} LIST OF SCRIPTS ({lab_name}):{RS}")
117
+
118
+ for i, filename in enumerate(scripts, 1):
119
+ print(f" {G}{BD}[{i}]{RS} {prettify(filename)}")
120
+
121
+ print(f" {R}{BD}[0]{RS} Kembali ke Menu Utama")
122
+ print(f"{B}{'=' * 55}{RS}")
123
+
124
+ choice = input(f"{BD} Pilih: {RS}").strip()
125
+
126
+ if choice == "0":
127
+ break
128
+
129
+ if not choice.isdigit():
130
+ print(f"\n{R}Masukkan angka yang valid!{RS}")
131
+ time.sleep(1)
132
+ continue
133
+
134
+ idx = int(choice) - 1
135
+
136
+ if 0 <= idx < len(scripts):
137
+ filename = scripts[idx]
138
+ path = os.path.join(BASE_DIR, lab_folder, "scripts", filename)
139
+
140
+ print(f"\n{Y}>>> Running: {prettify(filename)}...{RS}")
141
+ print(f"{B}{'-' * 55}{RS}")
142
+
143
+ try:
144
+ subprocess.run([get_python(lab_folder), path], check=True)
145
+ except Exception as e:
146
+ print(f"\n{R}[Error] Gagal menjalankan: {e}{RS}")
147
+
148
+ print(f"{B}{'-' * 55}{RS}")
149
+ input(f"\n{Y}Selesai. Tekan Enter untuk kembali...{RS}")
150
+ else:
151
+ print(f"\n{R}Opsi tidak tersedia!{RS}")
152
+ time.sleep(1)
153
+
154
+ def main():
155
+ while True:
156
+ clear()
157
+ print(f"{G}{BD}{BANNER}{RS}")
158
+ print(f"{W}{BD} Copyright (c) 2026 Farid Suryadi{RS}\n")
159
+ print(f"{B}{'=' * 70}{RS}")
160
+ print(f"{BD} SELECT LAB:{RS}")
161
+
162
+ labs = get_labs()
163
+
164
+ if not labs:
165
+ print(f" {Y}[!] Tidak ada folder lab ditemukan.{RS}")
166
+
167
+ for i, lab in enumerate(labs, 1):
168
+ print(f" {G}[{i}]{RS} {lab.upper().replace('-', ' ')}")
169
+
170
+ print(f" {Y}[c]{RS} Create New Lab")
171
+ print(f" {Y}[0]{RS} Exit")
172
+ print(f"{B}{'=' * 70}{RS}")
173
+
174
+ choice = input(f"{BD} Pilih: {RS}").strip().lower()
175
+
176
+ if choice == "0":
177
+ print(f"\n{Y}Bye!{RS}")
178
+ break
179
+
180
+ if choice == "c":
181
+ create_lab()
182
+ continue
183
+
184
+ if not choice.isdigit():
185
+ print(f"{R}[!] Masukkan angka yang valid.{RS}")
186
+ time.sleep(1)
187
+ continue
188
+
189
+ idx = int(choice) - 1
190
+
191
+ if not (0 <= idx < len(labs)):
192
+ print(f"{R}[!] Opsi tidak tersedia.{RS}")
193
+ time.sleep(1)
194
+ continue
195
+
196
+ lab_folder = labs[idx]
197
+ loading(f"Membuka {lab_folder.upper()}")
198
+ lab_menu(lab_folder)
199
+
200
+ def run():
201
+ try:
202
+ main()
203
+ except KeyboardInterrupt:
204
+ print(f"\n{R}Program dihentikan.{RS}")
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: faridlib
3
+ Version: 0.0.1
4
+ Summary: CLI launcher untuk project Machine Learning Labs
5
+ Author-email: Farid Suryadi <nanarananaru2024@gmail.com>
6
+ License: All Rights Reserved
7
+ Project-URL: Homepage, https://github.com/faridSrydi/faridlib
8
+ Project-URL: Repository, https://github.com/faridSrydi/faridlib
9
+ Project-URL: Issues, https://github.com/faridSrydi/faridlib/issues
10
+ Keywords: python,cli,machine-learning,labs,automation
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Operating System :: OS Independent
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+
16
+ # faridLib
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ faridlib/__init__.py
4
+ faridlib/machine_learning.py
5
+ faridlib.egg-info/PKG-INFO
6
+ faridlib.egg-info/SOURCES.txt
7
+ faridlib.egg-info/dependency_links.txt
8
+ faridlib.egg-info/entry_points.txt
9
+ faridlib.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ faridlib = faridlib.machine_learning:run
@@ -0,0 +1 @@
1
+ faridlib
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+
6
+ [project]
7
+ name = "faridlib"
8
+ version = "0.0.1"
9
+ description = "CLI launcher untuk project Machine Learning Labs"
10
+ readme = "README.md"
11
+ requires-python = ">=3.8"
12
+ license = { text = "All Rights Reserved" }
13
+
14
+ authors = [
15
+ { name = "Farid Suryadi", email = "nanarananaru2024@gmail.com" }
16
+ ]
17
+
18
+ keywords = ["python", "cli", "machine-learning", "labs", "automation"]
19
+
20
+ classifiers = [
21
+ "Programming Language :: Python :: 3",
22
+ "Operating System :: OS Independent",
23
+ ]
24
+
25
+ dependencies = []
26
+
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/faridSrydi/faridlib"
30
+ Repository = "https://github.com/faridSrydi/faridlib"
31
+ Issues = "https://github.com/faridSrydi/faridlib/issues"
32
+
33
+
34
+ [project.scripts]
35
+ faridlib = "faridlib.machine_learning:run"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+