liveConsole 1.7.4__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.4 → 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.4 → liveconsole-1.7.6}/src/pysole/pysole.py +6 -1
  6. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/utils.py +5 -2
  7. liveconsole-1.7.4/PKG-INFO +0 -158
  8. liveconsole-1.7.4/README.md +0 -145
  9. liveconsole-1.7.4/src/liveConsole.egg-info/PKG-INFO +0 -158
  10. {liveconsole-1.7.4 → liveconsole-1.7.6}/LICENSE +0 -0
  11. {liveconsole-1.7.4 → liveconsole-1.7.6}/MANIFEST.in +0 -0
  12. {liveconsole-1.7.4 → liveconsole-1.7.6}/setup.cfg +0 -0
  13. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole/__init__.py +0 -0
  14. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole.egg-info/SOURCES.txt +0 -0
  15. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole.egg-info/dependency_links.txt +0 -0
  16. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole.egg-info/entry_points.txt +0 -0
  17. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole.egg-info/requires.txt +0 -0
  18. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/liveConsole.egg-info/top_level.txt +0 -0
  19. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/__init__.py +0 -0
  20. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/__main__.py +0 -0
  21. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/commandHistory.py +0 -0
  22. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/helpTab.py +0 -0
  23. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/liveConsole.py +0 -0
  24. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/mainConsole.py +0 -0
  25. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/settings.json +0 -0
  26. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/styledTextbox.py +0 -0
  27. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/suggestionManager.py +0 -0
  28. {liveconsole-1.7.4 → liveconsole-1.7.6}/src/pysole/themes.json +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.4"
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():
@@ -6,5 +6,8 @@ themesPath = os.path.join(os.path.dirname(__file__), "themes.json")
6
6
 
7
7
  def stdPrint(text):
8
8
  """Print text to the terminal."""
9
- sys.__stdout__.write(f"{text}\n")
10
- sys.__stdout__.flush()
9
+ try:
10
+ sys.__stdout__.write(f"{text}\n")
11
+ sys.__stdout__.flush()
12
+ except:
13
+ pass
@@ -1,158 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: liveConsole
3
- Version: 1.7.4
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
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
20
-
21
- * Python syntax highlighting via **Pygments**
22
-
23
- * Autocomplete for **keywords, built-ins, and local/global variables**
24
-
25
- * Run code at startup for easier debugging
26
-
27
- * Thread-safe execution of Python code
28
-
29
- * Output capturing for `stdout` and `stderr`
30
-
31
- * Multi-line input with auto-indentation
32
-
33
- * History of previous commands
34
-
35
- * **Integrated Help Panel** for quick access to Python object documentation
36
-
37
-
38
- ## Installation
39
-
40
- `pip install liveConsole`
41
-
42
-
43
- ## Features
44
-
45
- ### Standalone Launch
46
-
47
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
48
-
49
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
50
-
51
- ### Syntax Highlighting
52
-
53
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
54
-
55
- * Highlights Python keywords, built-ins, and expressions in the console.
56
-
57
- ### Run Code at Startup
58
-
59
- * Pysole can automatically execute Python code when the console launches.
60
-
61
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
62
-
63
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
64
-
65
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
66
-
67
- ### Autocomplete
68
-
69
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
70
-
71
- * Popup list appears after typing at least 2 characters.
72
-
73
- * Only inserts the **missing portion** of a word.
74
-
75
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
76
-
77
-
78
- ### Multi-Line Input
79
-
80
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
81
-
82
- * Automatically detects incomplete statements and continues the prompt.
83
-
84
-
85
- ### Thread-Safe Execution
86
-
87
- * Executes user code in a separate thread to prevent GUI freezing.
88
-
89
- * Captures both `stdout` and `stderr` output and prints them in the console.
90
-
91
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
92
-
93
-
94
- ### Clickable History
95
-
96
- * Hover previous commands to see them highlighted.
97
-
98
- * Click to copy them back to the prompt for editing or re-execution.
99
-
100
-
101
- ### Help Panel
102
-
103
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
104
-
105
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
106
-
107
- * Scrollable and syntax-styled.
108
-
109
- * Perfect for quick reference without leaving the console.
110
-
111
-
112
- ### Easy Integration
113
-
114
- * Automatically grabs **caller frame globals and locals** if not provided.
115
-
116
- * Can be used standalone or embedded in larger CustomTkinter applications.
117
-
118
- ## Usage
119
-
120
- ```
121
- import pysole
122
- pysole.probe()
123
- ```
124
- or for also running some code at the startup of the pysole
125
- ```
126
- import pysole
127
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
128
- printStartupCode=True #< for printing the command as well as it output
129
- )
130
- x = 1 #< initialize some variable
131
- print(x) #< print the variable on the console
132
- ```
133
-
134
- * Type Python commands in the `>>>` prompt and see live output.
135
-
136
- ## Keyboard Shortcuts
137
-
138
- | Key | Action |
139
- | --- | --- |
140
- | `Enter` | Execute command (if complete) |
141
- | `Shift+Enter` | Insert newline with auto-indent |
142
- | `Tab` | Complete the current word / show suggestions |
143
- | `Up/Down` | Navigate suggestion list |
144
- | `Escape` | Hide suggestions |
145
- | `Mouse Click` | Select previous command from history |
146
-
147
-
148
- ## Customization
149
-
150
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
151
-
152
- * **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.
153
-
154
-
155
-
156
- ## License
157
-
158
- MIT License – free to use, modify, and distribute.
@@ -1,145 +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
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
7
-
8
- * Python syntax highlighting via **Pygments**
9
-
10
- * Autocomplete for **keywords, built-ins, and local/global variables**
11
-
12
- * Run code at startup for easier debugging
13
-
14
- * Thread-safe execution of Python code
15
-
16
- * Output capturing for `stdout` and `stderr`
17
-
18
- * Multi-line input with auto-indentation
19
-
20
- * History of previous commands
21
-
22
- * **Integrated Help Panel** for quick access to Python object documentation
23
-
24
-
25
- ## Installation
26
-
27
- `pip install liveConsole`
28
-
29
-
30
- ## Features
31
-
32
- ### Standalone Launch
33
-
34
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
35
-
36
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
37
-
38
- ### Syntax Highlighting
39
-
40
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
41
-
42
- * Highlights Python keywords, built-ins, and expressions in the console.
43
-
44
- ### Run Code at Startup
45
-
46
- * Pysole can automatically execute Python code when the console launches.
47
-
48
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
49
-
50
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
51
-
52
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
53
-
54
- ### Autocomplete
55
-
56
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
57
-
58
- * Popup list appears after typing at least 2 characters.
59
-
60
- * Only inserts the **missing portion** of a word.
61
-
62
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
63
-
64
-
65
- ### Multi-Line Input
66
-
67
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
68
-
69
- * Automatically detects incomplete statements and continues the prompt.
70
-
71
-
72
- ### Thread-Safe Execution
73
-
74
- * Executes user code in a separate thread to prevent GUI freezing.
75
-
76
- * Captures both `stdout` and `stderr` output and prints them in the console.
77
-
78
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
79
-
80
-
81
- ### Clickable History
82
-
83
- * Hover previous commands to see them highlighted.
84
-
85
- * Click to copy them back to the prompt for editing or re-execution.
86
-
87
-
88
- ### Help Panel
89
-
90
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
91
-
92
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
93
-
94
- * Scrollable and syntax-styled.
95
-
96
- * Perfect for quick reference without leaving the console.
97
-
98
-
99
- ### Easy Integration
100
-
101
- * Automatically grabs **caller frame globals and locals** if not provided.
102
-
103
- * Can be used standalone or embedded in larger CustomTkinter applications.
104
-
105
- ## Usage
106
-
107
- ```
108
- import pysole
109
- pysole.probe()
110
- ```
111
- or for also running some code at the startup of the pysole
112
- ```
113
- import pysole
114
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
115
- printStartupCode=True #< for printing the command as well as it output
116
- )
117
- x = 1 #< initialize some variable
118
- print(x) #< print the variable on the console
119
- ```
120
-
121
- * Type Python commands in the `>>>` prompt and see live output.
122
-
123
- ## Keyboard Shortcuts
124
-
125
- | Key | Action |
126
- | --- | --- |
127
- | `Enter` | Execute command (if complete) |
128
- | `Shift+Enter` | Insert newline with auto-indent |
129
- | `Tab` | Complete the current word / show suggestions |
130
- | `Up/Down` | Navigate suggestion list |
131
- | `Escape` | Hide suggestions |
132
- | `Mouse Click` | Select previous command from history |
133
-
134
-
135
- ## Customization
136
-
137
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
138
-
139
- * **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.
140
-
141
-
142
-
143
- ## License
144
-
145
- MIT License – free to use, modify, and distribute.
@@ -1,158 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: liveConsole
3
- Version: 1.7.4
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
- A fully-featured, **live Python console GUI** built with **CustomTkinter** and **Tkinter**, featuring:
20
-
21
- * Python syntax highlighting via **Pygments**
22
-
23
- * Autocomplete for **keywords, built-ins, and local/global variables**
24
-
25
- * Run code at startup for easier debugging
26
-
27
- * Thread-safe execution of Python code
28
-
29
- * Output capturing for `stdout` and `stderr`
30
-
31
- * Multi-line input with auto-indentation
32
-
33
- * History of previous commands
34
-
35
- * **Integrated Help Panel** for quick access to Python object documentation
36
-
37
-
38
- ## Installation
39
-
40
- `pip install liveConsole`
41
-
42
-
43
- ## Features
44
-
45
- ### Standalone Launch
46
-
47
- * Once installed, you can launch the console directly by simply typing ```pysole``` or ```liveconsole``` in the terminal
48
-
49
- * This opens the full GUI without needing to write any code. Perfect for quick debugging and experimenting.
50
-
51
- ### Syntax Highlighting
52
-
53
- * Real-time syntax highlighting using **Pygments** and the **Monokai** style.
54
-
55
- * Highlights Python keywords, built-ins, and expressions in the console.
56
-
57
- ### Run Code at Startup
58
-
59
- * Pysole can automatically execute Python code when the console launches.
60
-
61
- * Use the runRemainingCode=True argument in pysole.probe() to run all remaining lines in the calling script after the probe() call.
62
-
63
- * The printStartupCode flag controls whether these lines are printed in the console as they execute (True) or run silently (False).
64
-
65
- * Useful for initializing variables, importing libraries, or setting up your environment automatically.
66
-
67
- ### Autocomplete
68
-
69
- * Suggests **keywords**, **built-in functions**, and **variables** in scope.
70
-
71
- * Popup list appears after typing at least 2 characters.
72
-
73
- * Only inserts the **missing portion** of a word.
74
-
75
- * Navigate suggestions with **Up/Down arrows**, confirm with **Tab/Return**.
76
-
77
-
78
- ### Multi-Line Input
79
-
80
- * Supports **Shift+Enter** for inserting a new line with proper indentation.
81
-
82
- * Automatically detects incomplete statements and continues the prompt.
83
-
84
-
85
- ### Thread-Safe Execution
86
-
87
- * Executes user code in a separate thread to prevent GUI freezing.
88
-
89
- * Captures both `stdout` and `stderr` output and prints them in the console.
90
-
91
- * Supports both **expressions (`eval`)** and **statements (`exec`)**.
92
-
93
-
94
- ### Clickable History
95
-
96
- * Hover previous commands to see them highlighted.
97
-
98
- * Click to copy them back to the prompt for editing or re-execution.
99
-
100
-
101
- ### Help Panel
102
-
103
- * A resizable right-hand panel that displays Python documentation (help()) for any object.
104
-
105
- * Opens when clicking ctrl+click on a function/method and can be closed with the "X" button.
106
-
107
- * Scrollable and syntax-styled.
108
-
109
- * Perfect for quick reference without leaving the console.
110
-
111
-
112
- ### Easy Integration
113
-
114
- * Automatically grabs **caller frame globals and locals** if not provided.
115
-
116
- * Can be used standalone or embedded in larger CustomTkinter applications.
117
-
118
- ## Usage
119
-
120
- ```
121
- import pysole
122
- pysole.probe()
123
- ```
124
- or for also running some code at the startup of the pysole
125
- ```
126
- import pysole
127
- pysole.probe(runRemainingCode=True, #< for executing the code below probe
128
- printStartupCode=True #< for printing the command as well as it output
129
- )
130
- x = 1 #< initialize some variable
131
- print(x) #< print the variable on the console
132
- ```
133
-
134
- * Type Python commands in the `>>>` prompt and see live output.
135
-
136
- ## Keyboard Shortcuts
137
-
138
- | Key | Action |
139
- | --- | --- |
140
- | `Enter` | Execute command (if complete) |
141
- | `Shift+Enter` | Insert newline with auto-indent |
142
- | `Tab` | Complete the current word / show suggestions |
143
- | `Up/Down` | Navigate suggestion list |
144
- | `Escape` | Hide suggestions |
145
- | `Mouse Click` | Select previous command from history |
146
-
147
-
148
- ## Customization
149
-
150
- * **Appearance mode**: Dark mode is default, but can be changed via files menu
151
-
152
- * **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.
153
-
154
-
155
-
156
- ## License
157
-
158
- MIT License – free to use, modify, and distribute.
File without changes
File without changes
File without changes