Pythoner 0.2.2__tar.gz → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Pythoner
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: A custom python REPL
5
5
  Author: Cade
6
6
  Author-email: Cade <cadey.matignas@gmail.com>
File without changes
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "Pythoner"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "A custom python REPL"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "Pythoner"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  authors = [{ name = "Cade", email = "cadey.matignas@gmail.com" }]
9
9
  description = "A custom python REPL"
10
10
  readme = "README.md"
@@ -0,0 +1,56 @@
1
+ import sys
2
+ from os import name
3
+ from subprocess import run
4
+
5
+ from prompt_toolkit import prompt
6
+ from prompt_toolkit.lexers import PygmentsLexer
7
+ from pygments.lexers import PythonLexer
8
+ from termcolor import colored
9
+
10
+
11
+ def main():
12
+ platform = name
13
+
14
+ print(sys.version)
15
+
16
+ while True:
17
+ try:
18
+ pyi = prompt("> ", lexer=PygmentsLexer(PythonLexer))
19
+
20
+ if pyi.lower() in ("exit", "exit()"):
21
+ break
22
+
23
+ elif pyi.lower() in ("cls", "clear"):
24
+ if platform == "nt":
25
+ run("cls", shell=True)
26
+ else:
27
+ run("clear", shell=True)
28
+
29
+ elif pyi.startswith(("pip ", "uv ")):
30
+ run(
31
+ pyi,
32
+ shell=True,
33
+ stdin=sys.stdin,
34
+ stdout=sys.stdout,
35
+ stderr=sys.stderr,
36
+ )
37
+
38
+ else:
39
+ try:
40
+ exec(pyi)
41
+
42
+ except IndentationError:
43
+ block = [pyi]
44
+
45
+ while True:
46
+ extra = prompt("-> ", lexer=PygmentsLexer(PythonLexer))
47
+
48
+ if not extra:
49
+ break
50
+
51
+ block.append(extra)
52
+
53
+ exec("\n".join(block))
54
+
55
+ except BaseException as e:
56
+ print(colored(f"Pythoner encountered an error: {type(e)}: {e}", "red"))
@@ -1,55 +0,0 @@
1
- import sys
2
- from os import name
3
- from subprocess import run
4
-
5
- from prompt_toolkit import prompt
6
- from prompt_toolkit.lexers import PygmentsLexer
7
- from pygments.lexers import PythonLexer
8
- from termcolor import colored
9
-
10
-
11
- def main():
12
- platform = name
13
-
14
- print(sys.version)
15
-
16
- while True:
17
- pyi = prompt("> ", lexer=PygmentsLexer(PythonLexer))
18
-
19
- if pyi.lower() in ("exit", "exit()"):
20
- break
21
-
22
- elif pyi.lower() in ("cls", "clear"):
23
- if platform == "nt":
24
- run("cls", shell=True)
25
- else:
26
- run("clear", shell=True)
27
-
28
- elif pyi.startswith(("pip ", "uv ")):
29
- run(
30
- pyi,
31
- shell=True,
32
- stdin=sys.stdin,
33
- stdout=sys.stdout,
34
- stderr=sys.stderr,
35
- )
36
-
37
- else:
38
- try:
39
- exec(pyi)
40
-
41
- except IndentationError:
42
- block = [pyi]
43
-
44
- while True:
45
- extra = prompt("-> ", lexer=PygmentsLexer(PythonLexer))
46
-
47
- if not extra:
48
- break
49
-
50
- block.append(extra)
51
-
52
- exec("\n".join(block))
53
-
54
- except BaseException as e:
55
- print(colored(f"Pythoner encountered an error: {type(e)}: {e}", "red"))