beautifulerror 0.1.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.
@@ -0,0 +1,11 @@
1
+ from rich.console import Console
2
+ from rich.traceback import Traceback
3
+ from .cli import main
4
+ import sys
5
+
6
+ console = Console()
7
+ def run(code):
8
+ try:
9
+ exec(code)
10
+ except Exception as e:
11
+ console.print(Traceback(show_locals=False))
beautifulerror/cli.py ADDED
@@ -0,0 +1,25 @@
1
+ import click
2
+ from rich.console import Console
3
+ from rich.traceback import Traceback
4
+ import sys
5
+
6
+ console = Console()
7
+
8
+ def compile(n):
9
+ try:
10
+ with open(n) as f:
11
+ exec(f.read())
12
+ except Exception:
13
+ console.print(Traceback(show_locals=False))
14
+
15
+ @click.command()
16
+ @click.option('--version', is_flag=True, help='显示版本号')
17
+ @click.option('--run', default='main.py', help='运行文件')
18
+ def main(version, run):
19
+ if version:
20
+ print('0.1.0')
21
+ else:
22
+ compile(run)
23
+
24
+ if __name__ == '__main__':
25
+ main()
@@ -0,0 +1,10 @@
1
+ Metadata-Version: 2.4
2
+ Name: beautifulerror
3
+ Version: 0.1.0
4
+ Summary: 一个带Rich炫酷报错的Python代码执行器
5
+ Requires-Python: >=3.8
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: click>=8.0.0
8
+ Requires-Dist: rich>=13.0.0
9
+
10
+ 下载才知道
@@ -0,0 +1,7 @@
1
+ beautifulerror/__init__.py,sha256=ER5Bvt4bm0vfTkTltsjWAXg7xX2GdnsdPGPZijQNhMI,246
2
+ beautifulerror/cli.py,sha256=OsYnwXl5AWl37SjBmEHILSo_HgkeTw5H8oHef0phBGY,548
3
+ beautifulerror-0.1.0.dist-info/METADATA,sha256=2pfgncZ2Sda8QENphhpPQnxsTzP2xJ-uYBQe8Wgkwps,253
4
+ beautifulerror-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
5
+ beautifulerror-0.1.0.dist-info/entry_points.txt,sha256=ODw0MI2oAhygOZ_HNwqG2Uf0AuWhDsIj0_NI-PvfFxg,49
6
+ beautifulerror-0.1.0.dist-info/top_level.txt,sha256=14do3jTAmWG_LZtBBCCa_0uEM1dzYhVfx2m7bgF0tPk,15
7
+ beautifulerror-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ brpy = beautifulerror.cli:main
@@ -0,0 +1 @@
1
+ beautifulerror