liveConsole 1.4.1__py3-none-any.whl → 1.5.1__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.
- __init__.py +1 -0
- liveConsole.py +8 -126
- {liveconsole-1.4.1.dist-info → liveconsole-1.5.1.dist-info}/METADATA +12 -5
- liveconsole-1.5.1.dist-info/RECORD +14 -0
- liveconsole-1.5.1.dist-info/entry_points.txt +3 -0
- {liveconsole-1.4.1.dist-info → liveconsole-1.5.1.dist-info}/top_level.txt +1 -0
- pysole.py +132 -0
- liveconsole-1.4.1.dist-info/RECORD +0 -12
- {liveconsole-1.4.1.dist-info → liveconsole-1.5.1.dist-info}/WHEEL +0 -0
- {liveconsole-1.4.1.dist-info → liveconsole-1.5.1.dist-info}/licenses/LICENSE +0 -0
__init__.py
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
from pysole import probe, InteractiveConsole
|
liveConsole.py
CHANGED
@@ -1,126 +1,8 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
class StdoutRedirect(io.StringIO):
|
11
|
-
"""Redirects stdout/stderr to a callback function."""
|
12
|
-
|
13
|
-
def __init__(self, writeCallback):
|
14
|
-
super().__init__()
|
15
|
-
self.writeCallback = writeCallback
|
16
|
-
|
17
|
-
def write(self, s):
|
18
|
-
if s.strip():
|
19
|
-
self.writeCallback(s, "output")
|
20
|
-
|
21
|
-
def flush(self):
|
22
|
-
pass
|
23
|
-
|
24
|
-
class StdinRedirect(io.StringIO):
|
25
|
-
"""Redirects stdin to capture input() from the console."""
|
26
|
-
def __init__(self, readCallback):
|
27
|
-
super().__init__()
|
28
|
-
self.readCallback = readCallback
|
29
|
-
|
30
|
-
def readline(self, *args, **kwargs):
|
31
|
-
return(self.readCallback())
|
32
|
-
|
33
|
-
|
34
|
-
class InteractiveConsole(ctk.CTk):
|
35
|
-
"""Main console window application."""
|
36
|
-
|
37
|
-
def __init__(self, userGlobals=None, userLocals=None):
|
38
|
-
super().__init__()
|
39
|
-
|
40
|
-
# Window setup
|
41
|
-
self.title("Live Interactive Console")
|
42
|
-
self.geometry("900x600")
|
43
|
-
|
44
|
-
ctk.set_appearance_mode("dark")
|
45
|
-
ctk.set_default_color_theme("blue")
|
46
|
-
|
47
|
-
# Get namespace from caller if not provided
|
48
|
-
if userGlobals is None or userLocals is None:
|
49
|
-
callerFrame = inspect.currentframe().f_back
|
50
|
-
if userGlobals is None:
|
51
|
-
userGlobals = callerFrame.f_globals
|
52
|
-
if userLocals is None:
|
53
|
-
userLocals = callerFrame.f_locals
|
54
|
-
|
55
|
-
self.userGlobals = userGlobals
|
56
|
-
self.userLocals = userLocals
|
57
|
-
|
58
|
-
# Create UI
|
59
|
-
self._createUi()
|
60
|
-
|
61
|
-
# Redirect stdout/stderr
|
62
|
-
self._setupOutputRedirect()
|
63
|
-
self._setupInputRedirect()
|
64
|
-
|
65
|
-
def _createUi(self):
|
66
|
-
"""Create UI with console and help tab."""
|
67
|
-
frame = ctk.CTkFrame(self)
|
68
|
-
frame.pack(padx=10, pady=10, fill="both", expand=True)
|
69
|
-
|
70
|
-
# Horizontal frame
|
71
|
-
self.horizFrame = ctk.CTkFrame(frame)
|
72
|
-
self.horizFrame.pack(fill="both", expand=True)
|
73
|
-
|
74
|
-
# Right: Help Tab
|
75
|
-
self.helpTab = HelpTab(self.horizFrame, width=500)
|
76
|
-
|
77
|
-
# Left: Console
|
78
|
-
self.consoleFrame = ctk.CTkFrame(self.horizFrame, width=600)
|
79
|
-
self.consoleFrame.pack(side="left", fill="both", expand=True)
|
80
|
-
self.consoleFrame.pack_propagate(False) # prevent shrinking to fit contents
|
81
|
-
|
82
|
-
self.console = InteractiveConsoleText(
|
83
|
-
self.consoleFrame,
|
84
|
-
self.helpTab,
|
85
|
-
userGlobals=self.userGlobals,
|
86
|
-
userLocals=self.userLocals,
|
87
|
-
wrap="word",
|
88
|
-
bg="#1e1e1e",
|
89
|
-
fg="white",
|
90
|
-
insertbackground="white",
|
91
|
-
font=("Consolas", 12)
|
92
|
-
)
|
93
|
-
self.console.pack(fill="both", expand=True, padx=5, pady=5)
|
94
|
-
self.console.master = self
|
95
|
-
|
96
|
-
|
97
|
-
def _setupOutputRedirect(self):
|
98
|
-
"""Setup stdout/stderr redirection to console."""
|
99
|
-
sys.stdout = StdoutRedirect(self.console.writeOutput)
|
100
|
-
sys.stderr = StdoutRedirect(
|
101
|
-
lambda text, tag: self.console.writeOutput(text, "error")
|
102
|
-
)
|
103
|
-
|
104
|
-
def _setupInputRedirect(self):
|
105
|
-
"""Setup stdin redirection to console."""
|
106
|
-
sys.stdin = StdinRedirect(self.console.readInput)
|
107
|
-
|
108
|
-
def probe(self, *args, **kwargs):
|
109
|
-
"""Start the console main loop."""
|
110
|
-
self.mainloop(*args, **kwargs)
|
111
|
-
|
112
|
-
|
113
|
-
# Example usage
|
114
|
-
if __name__ == "__main__":
|
115
|
-
# Example variables and functions for testing
|
116
|
-
foo = 42
|
117
|
-
|
118
|
-
def greet(name):
|
119
|
-
print(f"Hello {name}!")
|
120
|
-
return(f"Greeted {name}")
|
121
|
-
|
122
|
-
# Create the list for testing autocomplete
|
123
|
-
exampleList = [1, 2, 3, 4, 5]
|
124
|
-
|
125
|
-
# Start the console
|
126
|
-
InteractiveConsole().probe()
|
1
|
+
import warnings
|
2
|
+
warnings.warn(
|
3
|
+
"Module 'liveConsole' is deprecated. Use 'pysole' instead.",
|
4
|
+
DeprecationWarning,
|
5
|
+
stacklevel=2
|
6
|
+
)
|
7
|
+
|
8
|
+
from pysole import *
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: liveConsole
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.5.1
|
4
4
|
Summary: An IDLE-like debugger to allow for real-time command injection for debugging and testing python code
|
5
5
|
Author-email: Tzur Soffer <tzur.soffer@gmail.com>
|
6
6
|
License: MIT
|
@@ -11,9 +11,10 @@ Requires-Dist: customtkinter
|
|
11
11
|
Requires-Dist: pygments
|
12
12
|
Dynamic: license-file
|
13
13
|
|
14
|
-
#
|
14
|
+
# PYSOLE
|
15
15
|
|
16
16
|
## You can finally test your code in real time without using idle!
|
17
|
+
### If you found [this repository](https://github.com/TzurSoffer/LiveDebugger) useful, please give it a ⭐!.
|
17
18
|
|
18
19
|
A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
|
19
20
|
|
@@ -27,7 +28,7 @@ A fully-featured, **live Python console GUI** built with **CustomTkinter** and *
|
|
27
28
|
|
28
29
|
* Multi-line input with auto-indentation
|
29
30
|
|
30
|
-
*
|
31
|
+
* History of previous commands
|
31
32
|
|
32
33
|
* **Integrated Help Panel** for quick access to Python object documentation
|
33
34
|
|
@@ -39,6 +40,12 @@ A fully-featured, **live Python console GUI** built with **CustomTkinter** and *
|
|
39
40
|
|
40
41
|
## Features
|
41
42
|
|
43
|
+
### Standalone Launch
|
44
|
+
|
45
|
+
* Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
|
46
|
+
|
47
|
+
* This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
|
48
|
+
|
42
49
|
### Syntax Highlighting
|
43
50
|
|
44
51
|
* Real-time syntax highlighting using **Pygments** and the **Monokai** style.
|
@@ -100,8 +107,8 @@ A fully-featured, **live Python console GUI** built with **CustomTkinter** and *
|
|
100
107
|
## Usage
|
101
108
|
|
102
109
|
```
|
103
|
-
|
104
|
-
|
110
|
+
import pysole
|
111
|
+
pysole.probe()
|
105
112
|
```
|
106
113
|
|
107
114
|
* Type Python commands in the `>>>` prompt and see live output.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
__init__.py,sha256=YbwIrtllO_QzxGjBzZfQp45oA2xI0sU9mXRyCq28wVE,44
|
2
|
+
commandHistory.py,sha256=xJtWbJ_vgJo2QGgaZJsApTOi_Hm8Yz0V9_zqQUCItj8,1084
|
3
|
+
helpTab.py,sha256=5Fxj_wTNTbuF6sBIN8GdbE6i_zbAEdlrFnbfhnDk5ms,2360
|
4
|
+
liveConsole.py,sha256=dqYaCvBs_aDfqrbhXYBp5vLkksmAiUv0DWwsbu1R3B4,167
|
5
|
+
mainConsole.py,sha256=MxgJJihgbPtKZ8FqXSFczj5neRVGRiM8RX4lcm0ewk0,12973
|
6
|
+
pysole.py,sha256=WFN08BWn9qyhwM7IAa51kCqsYVnuNXVDb1zfv2xw-NE,3924
|
7
|
+
styledTextbox.py,sha256=pc-7gaq_pGTZGZmtr_ARbPuKlKgJYqzD6HTR7tFhx7k,1989
|
8
|
+
suggestionManager.py,sha256=GRde3c1gFAWt_3rvBoFt_-Xl0aOzzloBMD7MHJA2W8U,6256
|
9
|
+
liveconsole-1.5.1.dist-info/licenses/LICENSE,sha256=7dZ0zL72aGaFE0C9DxacOpnaSkC5jajhG6iL7lqhWmU,1064
|
10
|
+
liveconsole-1.5.1.dist-info/METADATA,sha256=n35T_2d-PGq6Byzer8b29yRYIT1o18vE8pzhzKycQjo,3942
|
11
|
+
liveconsole-1.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
+
liveconsole-1.5.1.dist-info/entry_points.txt,sha256=3Vh3D8cI-UjuJYL1td66m0SShJzD9G-7Xnvt46Yr-ek,70
|
13
|
+
liveconsole-1.5.1.dist-info/top_level.txt,sha256=yEmcEVam34LgZbQWtT6RdrdJVzsXwElx6Wpsn3eR2as,95
|
14
|
+
liveconsole-1.5.1.dist-info/RECORD,,
|
pysole.py
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
import customtkinter as ctk
|
2
|
+
import inspect
|
3
|
+
import sys
|
4
|
+
import io
|
5
|
+
|
6
|
+
from helpTab import HelpTab
|
7
|
+
from mainConsole import InteractiveConsoleText
|
8
|
+
|
9
|
+
|
10
|
+
class StdoutRedirect(io.StringIO):
|
11
|
+
"""Redirects stdout/stderr to a callback function."""
|
12
|
+
|
13
|
+
def __init__(self, writeCallback):
|
14
|
+
super().__init__()
|
15
|
+
self.writeCallback = writeCallback
|
16
|
+
|
17
|
+
def write(self, s):
|
18
|
+
if s.strip():
|
19
|
+
self.writeCallback(s, "output")
|
20
|
+
|
21
|
+
def flush(self):
|
22
|
+
pass
|
23
|
+
|
24
|
+
class StdinRedirect(io.StringIO):
|
25
|
+
"""Redirects stdin to capture input() from the console."""
|
26
|
+
def __init__(self, readCallback):
|
27
|
+
super().__init__()
|
28
|
+
self.readCallback = readCallback
|
29
|
+
|
30
|
+
def readline(self, *args, **kwargs):
|
31
|
+
return(self.readCallback())
|
32
|
+
|
33
|
+
|
34
|
+
class InteractiveConsole(ctk.CTk):
|
35
|
+
"""Main console window application."""
|
36
|
+
|
37
|
+
def __init__(self, userGlobals=None, userLocals=None):
|
38
|
+
super().__init__()
|
39
|
+
|
40
|
+
# Window setup
|
41
|
+
self.title("Live Interactive Console")
|
42
|
+
self.geometry("900x600")
|
43
|
+
|
44
|
+
ctk.set_appearance_mode("dark")
|
45
|
+
ctk.set_default_color_theme("blue")
|
46
|
+
|
47
|
+
# Get namespace from caller if not provided
|
48
|
+
if userGlobals is None or userLocals is None:
|
49
|
+
callerFrame = inspect.currentframe().f_back
|
50
|
+
if userGlobals is None:
|
51
|
+
userGlobals = callerFrame.f_globals
|
52
|
+
if userLocals is None:
|
53
|
+
userLocals = callerFrame.f_locals
|
54
|
+
|
55
|
+
self.userGlobals = userGlobals
|
56
|
+
self.userLocals = userLocals
|
57
|
+
|
58
|
+
# Create UI
|
59
|
+
self._createUi()
|
60
|
+
|
61
|
+
# Redirect stdout/stderr
|
62
|
+
self._setupOutputRedirect()
|
63
|
+
self._setupInputRedirect()
|
64
|
+
|
65
|
+
def _createUi(self):
|
66
|
+
"""Create UI with console and help tab."""
|
67
|
+
frame = ctk.CTkFrame(self)
|
68
|
+
frame.pack(padx=10, pady=10, fill="both", expand=True)
|
69
|
+
|
70
|
+
# Horizontal frame
|
71
|
+
self.horizFrame = ctk.CTkFrame(frame)
|
72
|
+
self.horizFrame.pack(fill="both", expand=True)
|
73
|
+
|
74
|
+
# Right: Help Tab
|
75
|
+
self.helpTab = HelpTab(self.horizFrame, width=500)
|
76
|
+
|
77
|
+
# Left: Console
|
78
|
+
self.consoleFrame = ctk.CTkFrame(self.horizFrame, width=600)
|
79
|
+
self.consoleFrame.pack(side="left", fill="both", expand=True)
|
80
|
+
self.consoleFrame.pack_propagate(False) # prevent shrinking to fit contents
|
81
|
+
|
82
|
+
self.console = InteractiveConsoleText(
|
83
|
+
self.consoleFrame,
|
84
|
+
self.helpTab,
|
85
|
+
userGlobals=self.userGlobals,
|
86
|
+
userLocals=self.userLocals,
|
87
|
+
wrap="word",
|
88
|
+
bg="#1e1e1e",
|
89
|
+
fg="white",
|
90
|
+
insertbackground="white",
|
91
|
+
font=("Consolas", 12)
|
92
|
+
)
|
93
|
+
self.console.pack(fill="both", expand=True, padx=5, pady=5)
|
94
|
+
self.console.master = self
|
95
|
+
|
96
|
+
|
97
|
+
def _setupOutputRedirect(self):
|
98
|
+
"""Setup stdout/stderr redirection to console."""
|
99
|
+
sys.stdout = StdoutRedirect(self.console.writeOutput)
|
100
|
+
sys.stderr = StdoutRedirect(
|
101
|
+
lambda text, tag: self.console.writeOutput(text, "error")
|
102
|
+
)
|
103
|
+
|
104
|
+
def _setupInputRedirect(self):
|
105
|
+
"""Setup stdin redirection to console."""
|
106
|
+
sys.stdin = StdinRedirect(self.console.readInput)
|
107
|
+
|
108
|
+
def probe(self, *args, **kwargs):
|
109
|
+
"""Start the console main loop."""
|
110
|
+
self.mainloop(*args, **kwargs)
|
111
|
+
|
112
|
+
def probe():
|
113
|
+
InteractiveConsole().probe()
|
114
|
+
|
115
|
+
def main():
|
116
|
+
from pysole import probe
|
117
|
+
probe()
|
118
|
+
|
119
|
+
# Example usage
|
120
|
+
if __name__ == "__main__":
|
121
|
+
# Example variables and functions for testing
|
122
|
+
foo = 42
|
123
|
+
|
124
|
+
def greet(name):
|
125
|
+
print(f"Hello {name}!")
|
126
|
+
return(f"Greeted {name}")
|
127
|
+
|
128
|
+
# Create the list for testing autocomplete
|
129
|
+
exampleList = [1, 2, 3, 4, 5]
|
130
|
+
|
131
|
+
# Start the console
|
132
|
+
probe()
|
@@ -1,12 +0,0 @@
|
|
1
|
-
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
commandHistory.py,sha256=xJtWbJ_vgJo2QGgaZJsApTOi_Hm8Yz0V9_zqQUCItj8,1084
|
3
|
-
helpTab.py,sha256=5Fxj_wTNTbuF6sBIN8GdbE6i_zbAEdlrFnbfhnDk5ms,2360
|
4
|
-
liveConsole.py,sha256=9Gwevh3q52Qirig9VJ_qnbTuCda2ydyZnUR29kl7Zlw,3839
|
5
|
-
mainConsole.py,sha256=MxgJJihgbPtKZ8FqXSFczj5neRVGRiM8RX4lcm0ewk0,12973
|
6
|
-
styledTextbox.py,sha256=pc-7gaq_pGTZGZmtr_ARbPuKlKgJYqzD6HTR7tFhx7k,1989
|
7
|
-
suggestionManager.py,sha256=GRde3c1gFAWt_3rvBoFt_-Xl0aOzzloBMD7MHJA2W8U,6256
|
8
|
-
liveconsole-1.4.1.dist-info/licenses/LICENSE,sha256=7dZ0zL72aGaFE0C9DxacOpnaSkC5jajhG6iL7lqhWmU,1064
|
9
|
-
liveconsole-1.4.1.dist-info/METADATA,sha256=fg47oHebYtfDRKCZaFvYOaSHqCTxzTYYWWq87W5_WO0,3648
|
10
|
-
liveconsole-1.4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
-
liveconsole-1.4.1.dist-info/top_level.txt,sha256=QkTpA-HOQwPQRHYwLKYJOhu_zwarar6tdVSuPwYPvl8,88
|
12
|
-
liveconsole-1.4.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|