liveConsole 1.7.5__tar.gz → 1.7.6__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.

Potentially problematic release.


This version of liveConsole might be problematic. Click here for more details.

Files changed (28) hide show
  1. liveconsole-1.7.6/PKG-INFO +217 -0
  2. liveconsole-1.7.6/README.md +202 -0
  3. {liveconsole-1.7.5 → liveconsole-1.7.6}/pyproject.toml +5 -1
  4. liveconsole-1.7.6/src/liveConsole.egg-info/PKG-INFO +217 -0
  5. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/pysole.py +6 -1
  6. liveconsole-1.7.5/PKG-INFO +0 -161
  7. liveconsole-1.7.5/README.md +0 -148
  8. liveconsole-1.7.5/src/liveConsole.egg-info/PKG-INFO +0 -161
  9. {liveconsole-1.7.5 → liveconsole-1.7.6}/LICENSE +0 -0
  10. {liveconsole-1.7.5 → liveconsole-1.7.6}/MANIFEST.in +0 -0
  11. {liveconsole-1.7.5 → liveconsole-1.7.6}/setup.cfg +0 -0
  12. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole/__init__.py +0 -0
  13. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole.egg-info/SOURCES.txt +0 -0
  14. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole.egg-info/dependency_links.txt +0 -0
  15. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole.egg-info/entry_points.txt +0 -0
  16. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole.egg-info/requires.txt +0 -0
  17. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/liveConsole.egg-info/top_level.txt +0 -0
  18. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/__init__.py +0 -0
  19. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/__main__.py +0 -0
  20. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/commandHistory.py +0 -0
  21. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/helpTab.py +0 -0
  22. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/liveConsole.py +0 -0
  23. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/mainConsole.py +0 -0
  24. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/settings.json +0 -0
  25. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/styledTextbox.py +0 -0
  26. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/suggestionManager.py +0 -0
  27. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/themes.json +0 -0
  28. {liveconsole-1.7.5 → liveconsole-1.7.6}/src/pysole/utils.py +0 -0
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: liveConsole
3
+ Version: 1.7.6
4
+ Summary: An IDLE-like debugger to allow for real-time command injection for debugging and testing python code
5
+ Author-email: Tzur Soffer <tzur.soffer@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/TzurSoffer/Pysole
8
+ Project-URL: Repository, https://github.com/TzurSoffer/Pysole
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: customtkinter
13
+ Requires-Dist: pygments
14
+ Dynamic: license-file
15
+
16
+ # PYSOLE
17
+
18
+ ## You can finally test your code in real time without using idle!
19
+ ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
20
+
21
+ ## Showcase (click to watch on Youtube)
22
+ [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
23
+
24
+
25
+ Table of contents
26
+
27
+ - Features
28
+ - Installation
29
+ - Usage
30
+ - Parameters
31
+ - Keyboard Shortcuts
32
+ - Troubleshooting/Notes
33
+ - Contributing
34
+ - License
35
+
36
+ ## Features
37
+
38
+ Pysole provides a compact but powerful set of features designed to make interactive debugging and live testing fast and pleasant.
39
+
40
+ 1. Live GUI console (syntax highlighting)
41
+ - Real-time syntax highlighting using Pygments.
42
+ - Monokai style by default, configurable through themes.
43
+
44
+ 2. Autocomplete & suggestions
45
+ - Autocomplete for Python keywords, built-ins and variables in scope.
46
+ - Popup suggestions after typing (configurable behavior) and insert-on-confirm.
47
+
48
+ 3. Run remaining script code at startup
49
+ - `runRemainingCode=True` will execute the remainder of the calling script after `probe()` is invoked.
50
+ - `printStartupCode=True` prints the captured code chunks as they execute.
51
+
52
+ 4. Thread-safe execution + output capture
53
+ - User code runs in a background thread to avoid blocking the GUI.
54
+ - `stdout` and `stderr` are redirected into the GUI console output area.
55
+
56
+ 5. Multi-line input, indentation & history
57
+ - Shift+Enter inserts a newline with proper indentation.
58
+ - Command history with clickable entries for easy reuse.
59
+
60
+ 6. Integrated Help Panel and Features tab
61
+ - Right-hand help panel shows `help(obj)` output.
62
+ - A Features view is available from the File menu and shows the built-in features summary.
63
+
64
+ 7. Themes & persistent settings
65
+ - Theme picker in the File menu; selected theme is written to `settings.json`.
66
+ - Settings (THEME, BEHAVIOR, FONT) are loaded at startup from `src/pysole/settings.json`.
67
+
68
+
69
+ ## Installation
70
+
71
+ Quick install
72
+
73
+ ```powershell
74
+ pip install liveConsole
75
+ ```
76
+
77
+ Notes: the package is published under the name `liveConsole` (see `pyproject.toml`).
78
+
79
+ If you prefer to install from source, clone this repo and run:
80
+
81
+ ```powershell
82
+ pip install -e .
83
+ ```
84
+
85
+ Command-line entry points
86
+
87
+ After installation, two console commands are provided:
88
+
89
+ - `pysole` — open the GUI console (same as `liveconsole`)
90
+ - `liveconsole` — open the GUI console
91
+
92
+
93
+ ## Usage
94
+
95
+ Programmatic usage (embed in scripts):
96
+
97
+ - Basic, automatic caller capture:
98
+ ```python
99
+ import pysole
100
+ pysole.probe()
101
+ ```
102
+
103
+ - Run the remaining code in the current file inside the console and print the code as it executes
104
+ ```python
105
+ pysole.probe(runRemainingCode=True, printStartupCode=True)
106
+ ```
107
+
108
+ - Override appearance and prompt
109
+ ```python
110
+ pysole.probe(primaryPrompt='PY> ', font='Consolas', fontSize=14)
111
+ ```
112
+
113
+ ## Parameters
114
+
115
+ This section documents the parameters accepted by `pysole.probe()` and the `InteractiveConsole` constructor in `src/pysole/pysole.py`. Most of these parameters are optional; reasonable defaults are taken from the calling frame and `settings.json`.
116
+
117
+ Note: `probe(...)` forwards its arguments to `InteractiveConsole(...)` so you can pass any of the parameters below to `probe()` directly.
118
+
119
+ runRemainingCode
120
+ - Meaning: When `True`, Pysole will read the remainder of the source file that contains the `probe()` call and run those lines inside the console's namespace.
121
+ - Type: bool
122
+ - Default: `False`
123
+ - Behavior: The implementation inspects `callerFrame.f_code.co_filename` for the filename and `callerFrame.f_lineno` for the line number where `probe()` was called. Lines after that line are captured into `startupCode` and executed on console startup.
124
+ - Caution: This requires the source file to be readable from disk (not packaged/compiled away). Large files will be read into memory.
125
+
126
+ printStartupCode
127
+ - Meaning: Controls how the startup code (captured by `runRemainingCode=True`) is executed: printed chunk-by-chunk to the console and executed interactively, or executed silently.
128
+ - Type: bool
129
+ - Default: `False`
130
+ - Behavior: If `True`, the startup code is split into logical top-level chunks (top-level statements and their indented blocks). Each chunk is printed and executed sequentially so you can see what runs. If `False`, the entire remaining code is executed silently in one go (but output is still captured and shown).
131
+
132
+ primaryPrompt
133
+ - Meaning: Overrides the primary prompt string (for example `>>>`). This updates the in-memory `BEHAVIOR['PRIMARY_PROMPT']` used by the console and the default can also be changed in the settings file directly.
134
+ - Type: string
135
+ - Default: The prompt value defined in `settings.json` under `BEHAVIOR -> PRIMARY_PROMPT`.
136
+ - Notes: Passing this parameter changes the prompt for the current session only.
137
+
138
+ font
139
+ - Meaning: Overrides the font family used in console widgets.
140
+ - Type: string (font family name, e.g. "Consolas", "Courier New")
141
+ - Default: The font specified by `settings.json` -> `THEME` -> `FONT`.
142
+
143
+ fontSize
144
+ - Meaning: Overrides the font size used in console widgets.
145
+ - Type: int (font size in points / pixels depending on the platform and Tk configuration)
146
+ - Default: Value from `settings.json` -> `THEME` -> `FONT_SIZE`.
147
+
148
+ removeWaterMark
149
+ - Meaning: Controls whether a short welcome watermark message (with a GitHub link and request to star the project) is printed at startup.
150
+ - Type: bool
151
+ - Default: `False` (watermark shown)
152
+
153
+ userGlobals
154
+ - Meaning: The `globals()` mapping that the console will use as its global namespace. Variables, functions, and imports in this mapping will be visible to code executed in the console.
155
+ - Type: dict-like (typically the dict returned by `globals()`)
156
+ - Default: If omitted, the console infers the caller's globals using `callerFrame.f_globals` (or from `inspect.currentframe().f_back` if `callerFrame` is also omitted).
157
+ - When to pass: Provide this when you want the console to operate on a specific module or custom namespace.
158
+
159
+ userLocals
160
+ - Meaning: The `locals()` mapping used as the console's local namespace. Local variables available at the call site will be visible here.
161
+ - Type: dict-like (typically the dict returned by `locals()`)
162
+ - Default: Inferred from the caller's frame (`callerFrame.f_locals`) if not provided.
163
+
164
+ callerFrame
165
+ - Meaning: An `inspect` frame object used to infer both `userGlobals` and `userLocals` when they are not supplied. It's also used to determine the source file and line number for the "run remaining code" feature.
166
+ - Type: frame object (as returned by `inspect.currentframe()` and `frame.f_back`)
167
+ - Default: If omitted, `probe()` sets `callerFrame = inspect.currentframe().f_back` to automatically capture the frame of the caller.
168
+ - When to pass: Use an explicit frame when calling `probe()` from helper wrappers or non-standard contexts where automatic frame detection would be wrong.
169
+
170
+ Behavioral notes and edge cases
171
+ - `probe()` replaces `sys.stdout`, `sys.stderr`, and `sys.stdin` with console-aware redirectors while the console is running. These streams are restored when the console's `onClose()` runs (but be mindful when embedding Pysole in larger apps).
172
+ - If `runRemainingCode=True` but the source file cannot be read (packaged app, missing file, permission issues), the attempt to read the file will fail — in that case either run Pysole without `runRemainingCode` or pass an explicit `startupCode` (if you extend the API).
173
+ - When `printStartupCode=True`, chunks are determined by top-level lines (zero indent) and their following indented lines. This makes printed execution easier to follow for functions, classes and loops.
174
+
175
+ ## Keyboard Shortcuts
176
+
177
+ | Key | Action |
178
+ | --- | --- |
179
+ | `Enter` | Execute command (if complete) |
180
+ | `Shift+Enter` | Insert newline with auto-indent |
181
+ | `Tab` | Complete the current word / show suggestions |
182
+ | `Up/Down` | Navigate suggestion list |
183
+ | `Escape` | Hide suggestions |
184
+ | `Ctrl Click` | open help panel on the current method/func/class... |
185
+
186
+
187
+ ## Troubleshooting/Notes
188
+
189
+ Behavioral notes and edge cases
190
+
191
+ - `probe()` temporarily replaces `sys.stdout`, `sys.stderr` and `sys.stdin` with redirectors that send text to the GUI console. These are restored on close (`onClose()`). Embedding Pysole in larger apps should take this into account.
192
+ - `runRemainingCode=True` requires the calling module's source file to be available on disk. Running this in frozen/packaged environments may fail.
193
+ - `printStartupCode=True` prints chunks determined by top-level statements (zero indent) and their indented blocks so function/class/loop definitions are grouped with their bodies.
194
+
195
+ Settings and themes
196
+
197
+ Default UI and behavior settings are loaded from `src/pysole/settings.json` (path built from `src/pysole/utils.py`). Themes are listed in `src/pysole/themes.json`. The in-app Theme Picker writes the selected theme back to `settings.json` to persist across sessions.
198
+
199
+ Troubleshooting
200
+
201
+ - If the GUI doesn't start, make sure `customtkinter` is installed for your Python version.
202
+ - On Linux, ensure your Tk/Tcl support is present (system package) and `DISPLAY` is set when running headful UIs.
203
+ - If `runRemainingCode` appears to run the wrong code, check where `probe()` is called (wrappers can shift the caller frame). Use `callerFrame=` to pass an explicit frame if needed.
204
+
205
+ ## Contributing
206
+
207
+ - Bug reports and PRs welcome. Please open issues on the upstream GitHub repository: https://github.com/TzurSoffer/Pysole
208
+ - Keep test changes small and focused. Include a short description of the error / feature and steps to reproduce.
209
+
210
+ Changelog (high level)
211
+
212
+ - See `pyproject.toml` for the current package version.
213
+
214
+ ## License
215
+
216
+ This project is available under the MIT license — see the `LICENSE` file in the repository root.
217
+
@@ -0,0 +1,202 @@
1
+ # PYSOLE
2
+
3
+ ## You can finally test your code in real time without using idle!
4
+ ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
5
+
6
+ ## Showcase (click to watch on Youtube)
7
+ [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
8
+
9
+
10
+ Table of contents
11
+
12
+ - Features
13
+ - Installation
14
+ - Usage
15
+ - Parameters
16
+ - Keyboard Shortcuts
17
+ - Troubleshooting/Notes
18
+ - Contributing
19
+ - License
20
+
21
+ ## Features
22
+
23
+ Pysole provides a compact but powerful set of features designed to make interactive debugging and live testing fast and pleasant.
24
+
25
+ 1. Live GUI console (syntax highlighting)
26
+ - Real-time syntax highlighting using Pygments.
27
+ - Monokai style by default, configurable through themes.
28
+
29
+ 2. Autocomplete & suggestions
30
+ - Autocomplete for Python keywords, built-ins and variables in scope.
31
+ - Popup suggestions after typing (configurable behavior) and insert-on-confirm.
32
+
33
+ 3. Run remaining script code at startup
34
+ - `runRemainingCode=True` will execute the remainder of the calling script after `probe()` is invoked.
35
+ - `printStartupCode=True` prints the captured code chunks as they execute.
36
+
37
+ 4. Thread-safe execution + output capture
38
+ - User code runs in a background thread to avoid blocking the GUI.
39
+ - `stdout` and `stderr` are redirected into the GUI console output area.
40
+
41
+ 5. Multi-line input, indentation & history
42
+ - Shift+Enter inserts a newline with proper indentation.
43
+ - Command history with clickable entries for easy reuse.
44
+
45
+ 6. Integrated Help Panel and Features tab
46
+ - Right-hand help panel shows `help(obj)` output.
47
+ - A Features view is available from the File menu and shows the built-in features summary.
48
+
49
+ 7. Themes & persistent settings
50
+ - Theme picker in the File menu; selected theme is written to `settings.json`.
51
+ - Settings (THEME, BEHAVIOR, FONT) are loaded at startup from `src/pysole/settings.json`.
52
+
53
+
54
+ ## Installation
55
+
56
+ Quick install
57
+
58
+ ```powershell
59
+ pip install liveConsole
60
+ ```
61
+
62
+ Notes: the package is published under the name `liveConsole` (see `pyproject.toml`).
63
+
64
+ If you prefer to install from source, clone this repo and run:
65
+
66
+ ```powershell
67
+ pip install -e .
68
+ ```
69
+
70
+ Command-line entry points
71
+
72
+ After installation, two console commands are provided:
73
+
74
+ - `pysole` — open the GUI console (same as `liveconsole`)
75
+ - `liveconsole` — open the GUI console
76
+
77
+
78
+ ## Usage
79
+
80
+ Programmatic usage (embed in scripts):
81
+
82
+ - Basic, automatic caller capture:
83
+ ```python
84
+ import pysole
85
+ pysole.probe()
86
+ ```
87
+
88
+ - Run the remaining code in the current file inside the console and print the code as it executes
89
+ ```python
90
+ pysole.probe(runRemainingCode=True, printStartupCode=True)
91
+ ```
92
+
93
+ - Override appearance and prompt
94
+ ```python
95
+ pysole.probe(primaryPrompt='PY> ', font='Consolas', fontSize=14)
96
+ ```
97
+
98
+ ## Parameters
99
+
100
+ This section documents the parameters accepted by `pysole.probe()` and the `InteractiveConsole` constructor in `src/pysole/pysole.py`. Most of these parameters are optional; reasonable defaults are taken from the calling frame and `settings.json`.
101
+
102
+ Note: `probe(...)` forwards its arguments to `InteractiveConsole(...)` so you can pass any of the parameters below to `probe()` directly.
103
+
104
+ runRemainingCode
105
+ - Meaning: When `True`, Pysole will read the remainder of the source file that contains the `probe()` call and run those lines inside the console's namespace.
106
+ - Type: bool
107
+ - Default: `False`
108
+ - Behavior: The implementation inspects `callerFrame.f_code.co_filename` for the filename and `callerFrame.f_lineno` for the line number where `probe()` was called. Lines after that line are captured into `startupCode` and executed on console startup.
109
+ - Caution: This requires the source file to be readable from disk (not packaged/compiled away). Large files will be read into memory.
110
+
111
+ printStartupCode
112
+ - Meaning: Controls how the startup code (captured by `runRemainingCode=True`) is executed: printed chunk-by-chunk to the console and executed interactively, or executed silently.
113
+ - Type: bool
114
+ - Default: `False`
115
+ - Behavior: If `True`, the startup code is split into logical top-level chunks (top-level statements and their indented blocks). Each chunk is printed and executed sequentially so you can see what runs. If `False`, the entire remaining code is executed silently in one go (but output is still captured and shown).
116
+
117
+ primaryPrompt
118
+ - Meaning: Overrides the primary prompt string (for example `>>>`). This updates the in-memory `BEHAVIOR['PRIMARY_PROMPT']` used by the console and the default can also be changed in the settings file directly.
119
+ - Type: string
120
+ - Default: The prompt value defined in `settings.json` under `BEHAVIOR -> PRIMARY_PROMPT`.
121
+ - Notes: Passing this parameter changes the prompt for the current session only.
122
+
123
+ font
124
+ - Meaning: Overrides the font family used in console widgets.
125
+ - Type: string (font family name, e.g. "Consolas", "Courier New")
126
+ - Default: The font specified by `settings.json` -> `THEME` -> `FONT`.
127
+
128
+ fontSize
129
+ - Meaning: Overrides the font size used in console widgets.
130
+ - Type: int (font size in points / pixels depending on the platform and Tk configuration)
131
+ - Default: Value from `settings.json` -> `THEME` -> `FONT_SIZE`.
132
+
133
+ removeWaterMark
134
+ - Meaning: Controls whether a short welcome watermark message (with a GitHub link and request to star the project) is printed at startup.
135
+ - Type: bool
136
+ - Default: `False` (watermark shown)
137
+
138
+ userGlobals
139
+ - Meaning: The `globals()` mapping that the console will use as its global namespace. Variables, functions, and imports in this mapping will be visible to code executed in the console.
140
+ - Type: dict-like (typically the dict returned by `globals()`)
141
+ - Default: If omitted, the console infers the caller's globals using `callerFrame.f_globals` (or from `inspect.currentframe().f_back` if `callerFrame` is also omitted).
142
+ - When to pass: Provide this when you want the console to operate on a specific module or custom namespace.
143
+
144
+ userLocals
145
+ - Meaning: The `locals()` mapping used as the console's local namespace. Local variables available at the call site will be visible here.
146
+ - Type: dict-like (typically the dict returned by `locals()`)
147
+ - Default: Inferred from the caller's frame (`callerFrame.f_locals`) if not provided.
148
+
149
+ callerFrame
150
+ - Meaning: An `inspect` frame object used to infer both `userGlobals` and `userLocals` when they are not supplied. It's also used to determine the source file and line number for the "run remaining code" feature.
151
+ - Type: frame object (as returned by `inspect.currentframe()` and `frame.f_back`)
152
+ - Default: If omitted, `probe()` sets `callerFrame = inspect.currentframe().f_back` to automatically capture the frame of the caller.
153
+ - When to pass: Use an explicit frame when calling `probe()` from helper wrappers or non-standard contexts where automatic frame detection would be wrong.
154
+
155
+ Behavioral notes and edge cases
156
+ - `probe()` replaces `sys.stdout`, `sys.stderr`, and `sys.stdin` with console-aware redirectors while the console is running. These streams are restored when the console's `onClose()` runs (but be mindful when embedding Pysole in larger apps).
157
+ - If `runRemainingCode=True` but the source file cannot be read (packaged app, missing file, permission issues), the attempt to read the file will fail — in that case either run Pysole without `runRemainingCode` or pass an explicit `startupCode` (if you extend the API).
158
+ - When `printStartupCode=True`, chunks are determined by top-level lines (zero indent) and their following indented lines. This makes printed execution easier to follow for functions, classes and loops.
159
+
160
+ ## Keyboard Shortcuts
161
+
162
+ | Key | Action |
163
+ | --- | --- |
164
+ | `Enter` | Execute command (if complete) |
165
+ | `Shift+Enter` | Insert newline with auto-indent |
166
+ | `Tab` | Complete the current word / show suggestions |
167
+ | `Up/Down` | Navigate suggestion list |
168
+ | `Escape` | Hide suggestions |
169
+ | `Ctrl Click` | open help panel on the current method/func/class... |
170
+
171
+
172
+ ## Troubleshooting/Notes
173
+
174
+ Behavioral notes and edge cases
175
+
176
+ - `probe()` temporarily replaces `sys.stdout`, `sys.stderr` and `sys.stdin` with redirectors that send text to the GUI console. These are restored on close (`onClose()`). Embedding Pysole in larger apps should take this into account.
177
+ - `runRemainingCode=True` requires the calling module's source file to be available on disk. Running this in frozen/packaged environments may fail.
178
+ - `printStartupCode=True` prints chunks determined by top-level statements (zero indent) and their indented blocks so function/class/loop definitions are grouped with their bodies.
179
+
180
+ Settings and themes
181
+
182
+ Default UI and behavior settings are loaded from `src/pysole/settings.json` (path built from `src/pysole/utils.py`). Themes are listed in `src/pysole/themes.json`. The in-app Theme Picker writes the selected theme back to `settings.json` to persist across sessions.
183
+
184
+ Troubleshooting
185
+
186
+ - If the GUI doesn't start, make sure `customtkinter` is installed for your Python version.
187
+ - On Linux, ensure your Tk/Tcl support is present (system package) and `DISPLAY` is set when running headful UIs.
188
+ - If `runRemainingCode` appears to run the wrong code, check where `probe()` is called (wrappers can shift the caller frame). Use `callerFrame=` to pass an explicit frame if needed.
189
+
190
+ ## Contributing
191
+
192
+ - Bug reports and PRs welcome. Please open issues on the upstream GitHub repository: https://github.com/TzurSoffer/Pysole
193
+ - Keep test changes small and focused. Include a short description of the error / feature and steps to reproduce.
194
+
195
+ Changelog (high level)
196
+
197
+ - See `pyproject.toml` for the current package version.
198
+
199
+ ## License
200
+
201
+ This project is available under the MIT license — see the `LICENSE` file in the repository root.
202
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "liveConsole"
3
- version = "1.7.5"
3
+ version = "1.7.6"
4
4
  description = "An IDLE-like debugger to allow for real-time command injection for debugging and testing python code"
5
5
  authors = [{ name="Tzur Soffer", email="tzur.soffer@gmail.com" }]
6
6
  license = {text = "MIT"}
@@ -8,6 +8,10 @@ readme = "README.md"
8
8
  requires-python = ">=3.7"
9
9
  dependencies = ["customtkinter", "pygments"]
10
10
 
11
+ [project.urls]
12
+ Homepage = "https://github.com/TzurSoffer/Pysole"
13
+ Repository = "https://github.com/TzurSoffer/Pysole"
14
+
11
15
  [project.scripts]
12
16
  liveconsole = "liveConsole:_standalone"
13
17
  pysole = "pysole:_standalone"
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: liveConsole
3
+ Version: 1.7.6
4
+ Summary: An IDLE-like debugger to allow for real-time command injection for debugging and testing python code
5
+ Author-email: Tzur Soffer <tzur.soffer@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/TzurSoffer/Pysole
8
+ Project-URL: Repository, https://github.com/TzurSoffer/Pysole
9
+ Requires-Python: >=3.7
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: customtkinter
13
+ Requires-Dist: pygments
14
+ Dynamic: license-file
15
+
16
+ # PYSOLE
17
+
18
+ ## You can finally test your code in real time without using idle!
19
+ ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
20
+
21
+ ## Showcase (click to watch on Youtube)
22
+ [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
23
+
24
+
25
+ Table of contents
26
+
27
+ - Features
28
+ - Installation
29
+ - Usage
30
+ - Parameters
31
+ - Keyboard Shortcuts
32
+ - Troubleshooting/Notes
33
+ - Contributing
34
+ - License
35
+
36
+ ## Features
37
+
38
+ Pysole provides a compact but powerful set of features designed to make interactive debugging and live testing fast and pleasant.
39
+
40
+ 1. Live GUI console (syntax highlighting)
41
+ - Real-time syntax highlighting using Pygments.
42
+ - Monokai style by default, configurable through themes.
43
+
44
+ 2. Autocomplete & suggestions
45
+ - Autocomplete for Python keywords, built-ins and variables in scope.
46
+ - Popup suggestions after typing (configurable behavior) and insert-on-confirm.
47
+
48
+ 3. Run remaining script code at startup
49
+ - `runRemainingCode=True` will execute the remainder of the calling script after `probe()` is invoked.
50
+ - `printStartupCode=True` prints the captured code chunks as they execute.
51
+
52
+ 4. Thread-safe execution + output capture
53
+ - User code runs in a background thread to avoid blocking the GUI.
54
+ - `stdout` and `stderr` are redirected into the GUI console output area.
55
+
56
+ 5. Multi-line input, indentation & history
57
+ - Shift+Enter inserts a newline with proper indentation.
58
+ - Command history with clickable entries for easy reuse.
59
+
60
+ 6. Integrated Help Panel and Features tab
61
+ - Right-hand help panel shows `help(obj)` output.
62
+ - A Features view is available from the File menu and shows the built-in features summary.
63
+
64
+ 7. Themes & persistent settings
65
+ - Theme picker in the File menu; selected theme is written to `settings.json`.
66
+ - Settings (THEME, BEHAVIOR, FONT) are loaded at startup from `src/pysole/settings.json`.
67
+
68
+
69
+ ## Installation
70
+
71
+ Quick install
72
+
73
+ ```powershell
74
+ pip install liveConsole
75
+ ```
76
+
77
+ Notes: the package is published under the name `liveConsole` (see `pyproject.toml`).
78
+
79
+ If you prefer to install from source, clone this repo and run:
80
+
81
+ ```powershell
82
+ pip install -e .
83
+ ```
84
+
85
+ Command-line entry points
86
+
87
+ After installation, two console commands are provided:
88
+
89
+ - `pysole` — open the GUI console (same as `liveconsole`)
90
+ - `liveconsole` — open the GUI console
91
+
92
+
93
+ ## Usage
94
+
95
+ Programmatic usage (embed in scripts):
96
+
97
+ - Basic, automatic caller capture:
98
+ ```python
99
+ import pysole
100
+ pysole.probe()
101
+ ```
102
+
103
+ - Run the remaining code in the current file inside the console and print the code as it executes
104
+ ```python
105
+ pysole.probe(runRemainingCode=True, printStartupCode=True)
106
+ ```
107
+
108
+ - Override appearance and prompt
109
+ ```python
110
+ pysole.probe(primaryPrompt='PY> ', font='Consolas', fontSize=14)
111
+ ```
112
+
113
+ ## Parameters
114
+
115
+ This section documents the parameters accepted by `pysole.probe()` and the `InteractiveConsole` constructor in `src/pysole/pysole.py`. Most of these parameters are optional; reasonable defaults are taken from the calling frame and `settings.json`.
116
+
117
+ Note: `probe(...)` forwards its arguments to `InteractiveConsole(...)` so you can pass any of the parameters below to `probe()` directly.
118
+
119
+ runRemainingCode
120
+ - Meaning: When `True`, Pysole will read the remainder of the source file that contains the `probe()` call and run those lines inside the console's namespace.
121
+ - Type: bool
122
+ - Default: `False`
123
+ - Behavior: The implementation inspects `callerFrame.f_code.co_filename` for the filename and `callerFrame.f_lineno` for the line number where `probe()` was called. Lines after that line are captured into `startupCode` and executed on console startup.
124
+ - Caution: This requires the source file to be readable from disk (not packaged/compiled away). Large files will be read into memory.
125
+
126
+ printStartupCode
127
+ - Meaning: Controls how the startup code (captured by `runRemainingCode=True`) is executed: printed chunk-by-chunk to the console and executed interactively, or executed silently.
128
+ - Type: bool
129
+ - Default: `False`
130
+ - Behavior: If `True`, the startup code is split into logical top-level chunks (top-level statements and their indented blocks). Each chunk is printed and executed sequentially so you can see what runs. If `False`, the entire remaining code is executed silently in one go (but output is still captured and shown).
131
+
132
+ primaryPrompt
133
+ - Meaning: Overrides the primary prompt string (for example `>>>`). This updates the in-memory `BEHAVIOR['PRIMARY_PROMPT']` used by the console and the default can also be changed in the settings file directly.
134
+ - Type: string
135
+ - Default: The prompt value defined in `settings.json` under `BEHAVIOR -> PRIMARY_PROMPT`.
136
+ - Notes: Passing this parameter changes the prompt for the current session only.
137
+
138
+ font
139
+ - Meaning: Overrides the font family used in console widgets.
140
+ - Type: string (font family name, e.g. "Consolas", "Courier New")
141
+ - Default: The font specified by `settings.json` -> `THEME` -> `FONT`.
142
+
143
+ fontSize
144
+ - Meaning: Overrides the font size used in console widgets.
145
+ - Type: int (font size in points / pixels depending on the platform and Tk configuration)
146
+ - Default: Value from `settings.json` -> `THEME` -> `FONT_SIZE`.
147
+
148
+ removeWaterMark
149
+ - Meaning: Controls whether a short welcome watermark message (with a GitHub link and request to star the project) is printed at startup.
150
+ - Type: bool
151
+ - Default: `False` (watermark shown)
152
+
153
+ userGlobals
154
+ - Meaning: The `globals()` mapping that the console will use as its global namespace. Variables, functions, and imports in this mapping will be visible to code executed in the console.
155
+ - Type: dict-like (typically the dict returned by `globals()`)
156
+ - Default: If omitted, the console infers the caller's globals using `callerFrame.f_globals` (or from `inspect.currentframe().f_back` if `callerFrame` is also omitted).
157
+ - When to pass: Provide this when you want the console to operate on a specific module or custom namespace.
158
+
159
+ userLocals
160
+ - Meaning: The `locals()` mapping used as the console's local namespace. Local variables available at the call site will be visible here.
161
+ - Type: dict-like (typically the dict returned by `locals()`)
162
+ - Default: Inferred from the caller's frame (`callerFrame.f_locals`) if not provided.
163
+
164
+ callerFrame
165
+ - Meaning: An `inspect` frame object used to infer both `userGlobals` and `userLocals` when they are not supplied. It's also used to determine the source file and line number for the "run remaining code" feature.
166
+ - Type: frame object (as returned by `inspect.currentframe()` and `frame.f_back`)
167
+ - Default: If omitted, `probe()` sets `callerFrame = inspect.currentframe().f_back` to automatically capture the frame of the caller.
168
+ - When to pass: Use an explicit frame when calling `probe()` from helper wrappers or non-standard contexts where automatic frame detection would be wrong.
169
+
170
+ Behavioral notes and edge cases
171
+ - `probe()` replaces `sys.stdout`, `sys.stderr`, and `sys.stdin` with console-aware redirectors while the console is running. These streams are restored when the console's `onClose()` runs (but be mindful when embedding Pysole in larger apps).
172
+ - If `runRemainingCode=True` but the source file cannot be read (packaged app, missing file, permission issues), the attempt to read the file will fail — in that case either run Pysole without `runRemainingCode` or pass an explicit `startupCode` (if you extend the API).
173
+ - When `printStartupCode=True`, chunks are determined by top-level lines (zero indent) and their following indented lines. This makes printed execution easier to follow for functions, classes and loops.
174
+
175
+ ## Keyboard Shortcuts
176
+
177
+ | Key | Action |
178
+ | --- | --- |
179
+ | `Enter` | Execute command (if complete) |
180
+ | `Shift+Enter` | Insert newline with auto-indent |
181
+ | `Tab` | Complete the current word / show suggestions |
182
+ | `Up/Down` | Navigate suggestion list |
183
+ | `Escape` | Hide suggestions |
184
+ | `Ctrl Click` | open help panel on the current method/func/class... |
185
+
186
+
187
+ ## Troubleshooting/Notes
188
+
189
+ Behavioral notes and edge cases
190
+
191
+ - `probe()` temporarily replaces `sys.stdout`, `sys.stderr` and `sys.stdin` with redirectors that send text to the GUI console. These are restored on close (`onClose()`). Embedding Pysole in larger apps should take this into account.
192
+ - `runRemainingCode=True` requires the calling module's source file to be available on disk. Running this in frozen/packaged environments may fail.
193
+ - `printStartupCode=True` prints chunks determined by top-level statements (zero indent) and their indented blocks so function/class/loop definitions are grouped with their bodies.
194
+
195
+ Settings and themes
196
+
197
+ Default UI and behavior settings are loaded from `src/pysole/settings.json` (path built from `src/pysole/utils.py`). Themes are listed in `src/pysole/themes.json`. The in-app Theme Picker writes the selected theme back to `settings.json` to persist across sessions.
198
+
199
+ Troubleshooting
200
+
201
+ - If the GUI doesn't start, make sure `customtkinter` is installed for your Python version.
202
+ - On Linux, ensure your Tk/Tcl support is present (system package) and `DISPLAY` is set when running headful UIs.
203
+ - If `runRemainingCode` appears to run the wrong code, check where `probe()` is called (wrappers can shift the caller frame). Use `callerFrame=` to pass an explicit frame if needed.
204
+
205
+ ## Contributing
206
+
207
+ - Bug reports and PRs welcome. Please open issues on the upstream GitHub repository: https://github.com/TzurSoffer/Pysole
208
+ - Keep test changes small and focused. Include a short description of the error / feature and steps to reproduce.
209
+
210
+ Changelog (high level)
211
+
212
+ - See `pyproject.toml` for the current package version.
213
+
214
+ ## License
215
+
216
+ This project is available under the MIT license — see the `LICENSE` file in the repository root.
217
+
@@ -327,7 +327,8 @@ class InteractiveConsole(ctk.CTk):
327
327
  self.mainloop(*args, **kwargs)
328
328
 
329
329
  def probe(userGlobals=None, userLocals=None, callerFrame=None,
330
- runRemainingCode=False, printStartupCode=False, **kwargs):
330
+ runRemainingCode=False, printStartupCode=False,
331
+ primaryPrompt=None, font=None, fontSize=None, **kwargs):
331
332
  if callerFrame == None:
332
333
  callerFrame = inspect.currentframe().f_back
333
334
  InteractiveConsole(userGlobals=userGlobals,
@@ -335,6 +336,10 @@ def probe(userGlobals=None, userLocals=None, callerFrame=None,
335
336
  callerFrame=callerFrame,
336
337
  runRemainingCode=runRemainingCode,
337
338
  printStartupCode=printStartupCode,
339
+ primaryPrompt=primaryPrompt,
340
+ font=font,
341
+ fontSize=fontSize,
342
+ removeWaterMark=False,
338
343
  **kwargs).probe()
339
344
 
340
345
  def _standalone():
@@ -1,161 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: liveConsole
3
- Version: 1.7.5
4
- Summary: An IDLE-like debugger to allow for real-time command injection for debugging and testing python code
5
- Author-email: Tzur Soffer <tzur.soffer@gmail.com>
6
- License: MIT
7
- Requires-Python: >=3.7
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: customtkinter
11
- Requires-Dist: pygments
12
- Dynamic: license-file
13
-
14
- # PYSOLE
15
-
16
- ## You can finally test your code in real time without using idle!
17
- ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
18
-
19
- ## Showcase (click to watch on Youtube)
20
- [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
21
-
22
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
23
-
24
- * Python syntax highlighting via **Pygments**
25
-
26
- * Autocomplete for **keywords, built-ins, and local/global variables**
27
-
28
- * Run code at startup for easier debugging
29
-
30
- * Thread-safe execution of Python code
31
-
32
- * Output capturing for `stdout` and `stderr`
33
-
34
- * Multi-line input with auto-indentation
35
-
36
- * History of previous commands
37
-
38
- * **Integrated Help Panel** for quick access to Python object documentation
39
-
40
-
41
- ## Installation
42
-
43
- `pip install liveConsole`
44
-
45
-
46
- ## Features
47
-
48
- ### Standalone Launch
49
-
50
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
51
-
52
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
53
-
54
- ### Syntax Highlighting
55
-
56
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
57
-
58
- * Highlights Python keywords, built-ins, and expressions in the console.
59
-
60
- ### Run Code at Startup
61
-
62
- * Pysole can automatically execute Python code when the console launches.
63
-
64
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
65
-
66
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
67
-
68
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
69
-
70
- ### Autocomplete
71
-
72
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
73
-
74
- * Popup list appears after typing at least 2 characters.
75
-
76
- * Only inserts the **missing portion** of a word.
77
-
78
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
79
-
80
-
81
- ### Multi-Line Input
82
-
83
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
84
-
85
- * Automatically detects incomplete statements and continues the prompt.
86
-
87
-
88
- ### Thread-Safe Execution
89
-
90
- * Executes user code in a separate thread to prevent GUI freezing.
91
-
92
- * Captures both `stdout` and `stderr` output and prints them in the console.
93
-
94
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
95
-
96
-
97
- ### Clickable History
98
-
99
- * Hover previous commands to see them highlighted.
100
-
101
- * Click to copy them back to the prompt for editing or re-execution.
102
-
103
-
104
- ### Help Panel
105
-
106
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
107
-
108
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
109
-
110
- * Scrollable and syntax-styled.
111
-
112
- * Perfect for quick reference without leaving the console.
113
-
114
-
115
- ### Easy Integration
116
-
117
- * Automatically grabs **caller frame globals and locals** if not provided.
118
-
119
- * Can be used standalone or embedded in larger CustomTkinter applications.
120
-
121
- ## Usage
122
-
123
- ```
124
- import pysole
125
- pysole.probe()
126
- ```
127
- or for also running some code at the startup of the pysole
128
- ```
129
- import pysole
130
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
131
- printStartupCode=True #< for printing the command as well as it output
132
- )
133
- x = 1 #< initialize some variable
134
- print(x) #< print the variable on the console
135
- ```
136
-
137
- * Type Python commands in the `>>>` prompt and see live output.
138
-
139
- ## Keyboard Shortcuts
140
-
141
- | Key | Action |
142
- | --- | --- |
143
- | `Enter` | Execute command (if complete) |
144
- | `Shift+Enter` | Insert newline with auto-indent |
145
- | `Tab` | Complete the current word / show suggestions |
146
- | `Up/Down` | Navigate suggestion list |
147
- | `Escape` | Hide suggestions |
148
- | `Mouse Click` | Select previous command from history |
149
-
150
-
151
- ## Customization
152
-
153
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
154
-
155
- * **Themes**: Pysole has multiple preconfigured themes. You can choose a theme via the Theme Picker, which updates the console colors and appearance. Preconfigured themes are loaded from themes.json and the selected theme is saved in settings.json so it persists across sessions.
156
-
157
-
158
-
159
- ## License
160
-
161
- MIT License – free to use, modify, and distribute.
@@ -1,148 +0,0 @@
1
- # PYSOLE
2
-
3
- ## You can finally test your code in real time without using idle!
4
- ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
5
-
6
- ## Showcase (click to watch on Youtube)
7
- [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
8
-
9
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
10
-
11
- * Python syntax highlighting via **Pygments**
12
-
13
- * Autocomplete for **keywords, built-ins, and local/global variables**
14
-
15
- * Run code at startup for easier debugging
16
-
17
- * Thread-safe execution of Python code
18
-
19
- * Output capturing for `stdout` and `stderr`
20
-
21
- * Multi-line input with auto-indentation
22
-
23
- * History of previous commands
24
-
25
- * **Integrated Help Panel** for quick access to Python object documentation
26
-
27
-
28
- ## Installation
29
-
30
- `pip install liveConsole`
31
-
32
-
33
- ## Features
34
-
35
- ### Standalone Launch
36
-
37
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
38
-
39
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
40
-
41
- ### Syntax Highlighting
42
-
43
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
44
-
45
- * Highlights Python keywords, built-ins, and expressions in the console.
46
-
47
- ### Run Code at Startup
48
-
49
- * Pysole can automatically execute Python code when the console launches.
50
-
51
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
52
-
53
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
54
-
55
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
56
-
57
- ### Autocomplete
58
-
59
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
60
-
61
- * Popup list appears after typing at least 2 characters.
62
-
63
- * Only inserts the **missing portion** of a word.
64
-
65
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
66
-
67
-
68
- ### Multi-Line Input
69
-
70
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
71
-
72
- * Automatically detects incomplete statements and continues the prompt.
73
-
74
-
75
- ### Thread-Safe Execution
76
-
77
- * Executes user code in a separate thread to prevent GUI freezing.
78
-
79
- * Captures both `stdout` and `stderr` output and prints them in the console.
80
-
81
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
82
-
83
-
84
- ### Clickable History
85
-
86
- * Hover previous commands to see them highlighted.
87
-
88
- * Click to copy them back to the prompt for editing or re-execution.
89
-
90
-
91
- ### Help Panel
92
-
93
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
94
-
95
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
96
-
97
- * Scrollable and syntax-styled.
98
-
99
- * Perfect for quick reference without leaving the console.
100
-
101
-
102
- ### Easy Integration
103
-
104
- * Automatically grabs **caller frame globals and locals** if not provided.
105
-
106
- * Can be used standalone or embedded in larger CustomTkinter applications.
107
-
108
- ## Usage
109
-
110
- ```
111
- import pysole
112
- pysole.probe()
113
- ```
114
- or for also running some code at the startup of the pysole
115
- ```
116
- import pysole
117
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
118
- printStartupCode=True #< for printing the command as well as it output
119
- )
120
- x = 1 #< initialize some variable
121
- print(x) #< print the variable on the console
122
- ```
123
-
124
- * Type Python commands in the `>>>` prompt and see live output.
125
-
126
- ## Keyboard Shortcuts
127
-
128
- | Key | Action |
129
- | --- | --- |
130
- | `Enter` | Execute command (if complete) |
131
- | `Shift+Enter` | Insert newline with auto-indent |
132
- | `Tab` | Complete the current word / show suggestions |
133
- | `Up/Down` | Navigate suggestion list |
134
- | `Escape` | Hide suggestions |
135
- | `Mouse Click` | Select previous command from history |
136
-
137
-
138
- ## Customization
139
-
140
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
141
-
142
- * **Themes**: Pysole has multiple preconfigured themes. You can choose a theme via the Theme Picker, which updates the console colors and appearance. Preconfigured themes are loaded from themes.json and the selected theme is saved in settings.json so it persists across sessions.
143
-
144
-
145
-
146
- ## License
147
-
148
- MIT License – free to use, modify, and distribute.
@@ -1,161 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: liveConsole
3
- Version: 1.7.5
4
- Summary: An IDLE-like debugger to allow for real-time command injection for debugging and testing python code
5
- Author-email: Tzur Soffer <tzur.soffer@gmail.com>
6
- License: MIT
7
- Requires-Python: >=3.7
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Requires-Dist: customtkinter
11
- Requires-Dist: pygments
12
- Dynamic: license-file
13
-
14
- # PYSOLE
15
-
16
- ## You can finally test your code in real time without using idle!
17
- ### If you found [this repository](https://github.com/TzurSoffer/Pysole) useful, please give it a ⭐!.
18
-
19
- ## Showcase (click to watch on Youtube)
20
- [![Watch the demo](Showcase/thumbnail.png)](https://www.youtube.com/shorts/pjoelNjc3O0)
21
-
22
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
23
-
24
- * Python syntax highlighting via **Pygments**
25
-
26
- * Autocomplete for **keywords, built-ins, and local/global variables**
27
-
28
- * Run code at startup for easier debugging
29
-
30
- * Thread-safe execution of Python code
31
-
32
- * Output capturing for `stdout` and `stderr`
33
-
34
- * Multi-line input with auto-indentation
35
-
36
- * History of previous commands
37
-
38
- * **Integrated Help Panel** for quick access to Python object documentation
39
-
40
-
41
- ## Installation
42
-
43
- `pip install liveConsole`
44
-
45
-
46
- ## Features
47
-
48
- ### Standalone Launch
49
-
50
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
51
-
52
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
53
-
54
- ### Syntax Highlighting
55
-
56
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
57
-
58
- * Highlights Python keywords, built-ins, and expressions in the console.
59
-
60
- ### Run Code at Startup
61
-
62
- * Pysole can automatically execute Python code when the console launches.
63
-
64
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
65
-
66
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
67
-
68
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
69
-
70
- ### Autocomplete
71
-
72
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
73
-
74
- * Popup list appears after typing at least 2 characters.
75
-
76
- * Only inserts the **missing portion** of a word.
77
-
78
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
79
-
80
-
81
- ### Multi-Line Input
82
-
83
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
84
-
85
- * Automatically detects incomplete statements and continues the prompt.
86
-
87
-
88
- ### Thread-Safe Execution
89
-
90
- * Executes user code in a separate thread to prevent GUI freezing.
91
-
92
- * Captures both `stdout` and `stderr` output and prints them in the console.
93
-
94
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
95
-
96
-
97
- ### Clickable History
98
-
99
- * Hover previous commands to see them highlighted.
100
-
101
- * Click to copy them back to the prompt for editing or re-execution.
102
-
103
-
104
- ### Help Panel
105
-
106
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
107
-
108
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
109
-
110
- * Scrollable and syntax-styled.
111
-
112
- * Perfect for quick reference without leaving the console.
113
-
114
-
115
- ### Easy Integration
116
-
117
- * Automatically grabs **caller frame globals and locals** if not provided.
118
-
119
- * Can be used standalone or embedded in larger CustomTkinter applications.
120
-
121
- ## Usage
122
-
123
- ```
124
- import pysole
125
- pysole.probe()
126
- ```
127
- or for also running some code at the startup of the pysole
128
- ```
129
- import pysole
130
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
131
- printStartupCode=True #< for printing the command as well as it output
132
- )
133
- x = 1 #< initialize some variable
134
- print(x) #< print the variable on the console
135
- ```
136
-
137
- * Type Python commands in the `>>>` prompt and see live output.
138
-
139
- ## Keyboard Shortcuts
140
-
141
- | Key | Action |
142
- | --- | --- |
143
- | `Enter` | Execute command (if complete) |
144
- | `Shift+Enter` | Insert newline with auto-indent |
145
- | `Tab` | Complete the current word / show suggestions |
146
- | `Up/Down` | Navigate suggestion list |
147
- | `Escape` | Hide suggestions |
148
- | `Mouse Click` | Select previous command from history |
149
-
150
-
151
- ## Customization
152
-
153
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
154
-
155
- * **Themes**: Pysole has multiple preconfigured themes. You can choose a theme via the Theme Picker, which updates the console colors and appearance. Preconfigured themes are loaded from themes.json and the selected theme is saved in settings.json so it persists across sessions.
156
-
157
-
158
-
159
- ## License
160
-
161
- MIT License – free to use, modify, and distribute.
File without changes
File without changes
File without changes