jktra 0.1.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.
jktra-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: jktra
3
+ Version: 0.1.0
4
+ Summary: Легкая библиотека для работы с Gemini AI
5
+ Author-email: Твоё Имя <your_email@example.com>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: google-genai
jktra-0.1.0/README.md ADDED
File without changes
@@ -0,0 +1,64 @@
1
+ import os
2
+ import sys
3
+ import time
4
+ import builtins
5
+ import warnings
6
+ import io
7
+
8
+ # Настройка UTF-8 для консоли Windows
9
+ if sys.platform == "win32":
10
+ sys.stdout.reconfigure(encoding='utf-8')
11
+
12
+ # Отключение предупреждений
13
+ os.environ["PYTHONWARNINGS"] = "ignore"
14
+ warnings.filterwarnings("ignore")
15
+
16
+ from google import genai
17
+
18
+ GEMINI_API_KEY = "AQ.Ab8RN6JGt5Agf62ocpWUGSJmhG2BqT-eKrnAQfRxG1VUVaoXlw"
19
+
20
+ class AI:
21
+ """Клиент Gemini API."""
22
+ def __init__(self):
23
+ self.client = genai.Client(api_key=GEMINI_API_KEY)
24
+
25
+ def ask(self, prompt: str) -> str:
26
+ old_stderr = sys.stderr
27
+ sys.stderr = io.StringIO()
28
+
29
+ try:
30
+ sys.stdout.write("\033[90m[ИИ думает...]\033[0m\r")
31
+ sys.stdout.flush()
32
+
33
+ response = self.client.models.generate_content(
34
+ model='gemini-3.6-flash',
35
+ contents=str(prompt)
36
+ )
37
+
38
+ sys.stdout.write(" " * 25 + "\r")
39
+ return response.text
40
+ except Exception as e:
41
+ sys.stdout.write(" " * 25 + "\r")
42
+ return f"[Ошибка Gemini API: {e}]"
43
+ finally:
44
+ sys.stderr = old_stderr
45
+
46
+ # Регистрируем ai глобально
47
+ builtins.ai = AI()
48
+
49
+ def print_stream(text: str, delay: float = 0.02):
50
+ """Печать текста с эффектом печатной машинки."""
51
+ text_str = str(text)
52
+ sys.stdout.write("\033[96m")
53
+ for char in text_str:
54
+ sys.stdout.write(char)
55
+ sys.stdout.flush()
56
+ time.sleep(delay)
57
+ sys.stdout.write("\033[0m\n")
58
+
59
+ # Делаем сам модуль вызываемым jktra(...)
60
+ class CallableModule(sys.modules[__name__].__class__):
61
+ def __call__(self, text: str, delay: float = 0.02):
62
+ print_stream(text, delay=delay)
63
+
64
+ sys.modules[__name__].__class__ = CallableModule
@@ -0,0 +1,24 @@
1
+ import sys
2
+ import time
3
+ from typing import Any
4
+
5
+ def print_stream(text: Any, delay: float = 0.03, color: str = "\033[96m") -> None:
6
+ """
7
+ Красиво выводит текст (например, ответ ИИ) с эффектом печати.
8
+ """
9
+ text_str = str(text)
10
+ reset_color = "\033[0m"
11
+
12
+ sys.stdout.write(color)
13
+ for char in text_str:
14
+ sys.stdout.write(char)
15
+ sys.stdout.flush()
16
+ time.sleep(delay)
17
+ sys.stdout.write(reset_color + "\n")
18
+
19
+ class JKTra:
20
+ def __call__(self, text: Any, delay: float = 0.03):
21
+ print_stream(text, delay=delay)
22
+
23
+ # Экземпляр для вызова напрямую через jktra(...)
24
+ jktra_instance = JKTra()
File without changes
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.4
2
+ Name: jktra
3
+ Version: 0.1.0
4
+ Summary: Легкая библиотека для работы с Gemini AI
5
+ Author-email: Твоё Имя <your_email@example.com>
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Operating System :: OS Independent
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+ Requires-Dist: google-genai
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ jktra/__init__.py
4
+ jktra/core.py
5
+ jktra/main.py
6
+ jktra.egg-info/PKG-INFO
7
+ jktra.egg-info/SOURCES.txt
8
+ jktra.egg-info/dependency_links.txt
9
+ jktra.egg-info/requires.txt
10
+ jktra.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ google-genai
@@ -0,0 +1 @@
1
+ jktra
@@ -0,0 +1,21 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "jktra"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Твоё Имя", email="your_email@example.com" },
10
+ ]
11
+ description = "Легкая библиотека для работы с Gemini AI"
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = [
20
+ "google-genai"
21
+ ]
jktra-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+