pykernel-cli 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pykernel/__init__.py +0 -0
- pykernel/__main__.py +2 -0
- pykernel/commands/__init__.py +0 -0
- pykernel/commands/builtins.py +144 -0
- pykernel/commands/inspector.py +164 -0
- pykernel/commands/shell.py +101 -0
- pykernel/commands/snippets.py +257 -0
- pykernel/core/__init__.py +0 -0
- pykernel/core/config.py +118 -0
- pykernel/core/context.py +64 -0
- pykernel/core/painter.py +119 -0
- pykernel/core/registry.py +159 -0
- pykernel/core/repl.py +215 -0
- pykernel/kernel.py +38 -0
- pykernel_cli-1.0.0.dist-info/METADATA +74 -0
- pykernel_cli-1.0.0.dist-info/RECORD +20 -0
- pykernel_cli-1.0.0.dist-info/WHEEL +5 -0
- pykernel_cli-1.0.0.dist-info/entry_points.txt +2 -0
- pykernel_cli-1.0.0.dist-info/licenses/LICENSE +21 -0
- pykernel_cli-1.0.0.dist-info/top_level.txt +1 -0
pykernel/kernel.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
PyKernel — A hackable Python REPL with first-class command support.
|
|
4
|
+
Run: python kernel.py
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys, os
|
|
8
|
+
|
|
9
|
+
from pykernel.core.repl import REPL
|
|
10
|
+
from pykernel.core.registry import CommandRegistry
|
|
11
|
+
from pykernel.core.config import Config
|
|
12
|
+
|
|
13
|
+
# ── built-in command packs ──────────────────────────────────────────────────
|
|
14
|
+
from pykernel.commands.builtins import register as register_builtins
|
|
15
|
+
from pykernel.commands.inspector import register as register_inspector
|
|
16
|
+
from pykernel.commands.shell import register as register_shell
|
|
17
|
+
from pykernel.commands.snippets import register as register_snippets
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main():
|
|
21
|
+
cfg = Config() # loads ~/.pykernel/config.toml
|
|
22
|
+
registry = CommandRegistry()
|
|
23
|
+
|
|
24
|
+
# register built-in command packs
|
|
25
|
+
register_builtins(registry)
|
|
26
|
+
register_inspector(registry)
|
|
27
|
+
register_shell(registry)
|
|
28
|
+
register_snippets(registry)
|
|
29
|
+
|
|
30
|
+
# load user plugins from ~/.pykernel/plugins/
|
|
31
|
+
registry.load_plugins(cfg.plugin_dir)
|
|
32
|
+
|
|
33
|
+
repl = REPL(registry, cfg)
|
|
34
|
+
repl.run()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
main()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pykernel-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A hackable Python REPL with first-class command support
|
|
5
|
+
Author-email: zKaiden <odrekzinho@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: repl,shell,interactive,python
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Interpreters
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build; extra == "dev"
|
|
21
|
+
Requires-Dist: twine; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# PyKernel
|
|
25
|
+
|
|
26
|
+
A hackable Python REPL with first-class command support.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install pykernel
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pykernel
|
|
38
|
+
# or
|
|
39
|
+
python -m pykernel
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Type `/help` to see all commands.
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
| Command | Description |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `/help` | List all commands |
|
|
49
|
+
| `/vars` | List variables in the namespace |
|
|
50
|
+
| `/run <file>` | Execute a Python file |
|
|
51
|
+
| `/sh <cmd>` | Run a shell command |
|
|
52
|
+
| `/snip` | Manage code snippets |
|
|
53
|
+
| `/timeit <expr>` | Time an expression |
|
|
54
|
+
|
|
55
|
+
## Plugins
|
|
56
|
+
|
|
57
|
+
Drop a `.py` file with a `register(registry)` function into `~/.pykernel/plugins/`:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
def register(reg):
|
|
61
|
+
@reg.command("hello", help="Say hello")
|
|
62
|
+
def cmd_hello(ctx, *args):
|
|
63
|
+
ctx.print("Hello!")
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Config
|
|
67
|
+
|
|
68
|
+
Edit `~/.pykernel/config.toml`:
|
|
69
|
+
|
|
70
|
+
```toml
|
|
71
|
+
[kernel]
|
|
72
|
+
prompt = ">>> "
|
|
73
|
+
theme = "dark" # dark | light | none
|
|
74
|
+
```
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
pykernel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
pykernel/__main__.py,sha256=3eGeT6_IikJWA7abQF4yZCkWNPN4BXepN--drsI-KGU,42
|
|
3
|
+
pykernel/kernel.py,sha256=2xPRnLt0KrIIK2Z6gXMJHEOadtwWx6uBz6QApQM2z5o,1236
|
|
4
|
+
pykernel/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
pykernel/commands/builtins.py,sha256=wrpp4qacMQOLEEEbmY4T5otOD1D9HlLjRBe0PmcKrx8,6605
|
|
6
|
+
pykernel/commands/inspector.py,sha256=_pSVyZRcL02Jh6boBNiCHC0aTWlvz94TRDQZ4WhhjDg,6912
|
|
7
|
+
pykernel/commands/shell.py,sha256=0s7YfJMFXfJuh-XEwbhJYPin5w0e4ZGDGrgJUEjR0A8,4258
|
|
8
|
+
pykernel/commands/snippets.py,sha256=pRHI0o6ua81yTTc0n6hqdlLe-YFqfCAAYFnDiIMjFDM,10103
|
|
9
|
+
pykernel/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
pykernel/core/config.py,sha256=06k87f5JOTlq8kSPB9nZhlQ80whbpjcel0-JDBpkhBo,3692
|
|
11
|
+
pykernel/core/context.py,sha256=z9vcafVHDUCyoW4rk6vlAtR_cQhCllVviUHNzu848o0,2210
|
|
12
|
+
pykernel/core/painter.py,sha256=EFjt9XRI3oREN2rEsEZXQlVpF2PZEiqAEEjoX8ATAQ4,4414
|
|
13
|
+
pykernel/core/registry.py,sha256=34zHG74KzjwDAu-2y39c1ih0zONF097-Bjok2sgyMZY,6343
|
|
14
|
+
pykernel/core/repl.py,sha256=zRM-of7P575uQmfAWjBZaVxIA8H-ZgJZZVnE9cWWRnY,8589
|
|
15
|
+
pykernel_cli-1.0.0.dist-info/licenses/LICENSE,sha256=v2spsd7N1pKFFh2G8wGP_45iwe5S0DYiJzG4im8Rupc,1066
|
|
16
|
+
pykernel_cli-1.0.0.dist-info/METADATA,sha256=WFyNR8c4irr6Fm3CaG2OZx9jTRlt01v0La5a-X1L3ic,1724
|
|
17
|
+
pykernel_cli-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
18
|
+
pykernel_cli-1.0.0.dist-info/entry_points.txt,sha256=6uJMN1Yzw7uT8BhpBr5rLLlus55vBE1JISUc03Beo54,50
|
|
19
|
+
pykernel_cli-1.0.0.dist-info/top_level.txt,sha256=G_9gnE3eCoK63CojsmsPLNOUva1CFwKWfzHhjUUwnEM,9
|
|
20
|
+
pykernel_cli-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pykernel
|