streamdown 0.15.0__tar.gz → 0.16.0__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.
- {streamdown-0.15.0 → streamdown-0.16.0}/PKG-INFO +18 -17
- {streamdown-0.15.0 → streamdown-0.16.0}/README.md +18 -17
- streamdown-0.16.0/assets/logo.png +0 -0
- streamdown-0.16.0/assets/logo.svg +116 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/pyproject.toml +1 -1
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/sd.py +3 -4
- streamdown-0.16.0/tests/pvgo_512.jpg +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0/tests}/pythonvgo.md +37 -37
- {streamdown-0.15.0 → streamdown-0.16.0}/.gitignore +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/.vimrc +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/24-bit-color.sh +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/LICENSE.MIT +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/configurable.png +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/copyable.png +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/dunder.png +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/error.txt +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/newdir/file_0.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/newdir/file_1.rb +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/newdir/file_2.jl +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/passthrough.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/python-go.png +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/somelog.txt +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/__init__.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/plugins/README.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/plugins/latex.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/scrape/file_0.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/scrape/file_1.js +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/scrape/file_2.cpp +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/streamdown/tt.mds +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/table.png +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/temp.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/test.py +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/test_input.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/README.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/block.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/chunk-buffer.sh +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/code.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/example.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/fizzbuzz.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/inline.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/line-buffer.sh +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/line-wrap.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/line.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/links.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/longer-example.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/mandlebrot.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/markdown.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/nested-example.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/new.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/outline.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/sd.log +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/table-break.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/table.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/table_test.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/test.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/test_input.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/white-space-code.md +0 -0
- {streamdown-0.15.0 → streamdown-0.16.0}/tests/wm.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamdown
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: A streaming markdown renderer for modern terminals with syntax highlighting
|
|
5
5
|
Project-URL: Homepage, https://github.com/kristopolous/Streamdown
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/kristopolous/Streamdown/issues
|
|
@@ -27,44 +27,45 @@ Requires-Dist: term-image
|
|
|
27
27
|
Requires-Dist: toml
|
|
28
28
|
Description-Content-Type: text/markdown
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src=https://github.com/user-attachments/assets/0468eac0-2a00-4e98-82ca-09e6ac679357/>
|
|
32
|
+
<br/>
|
|
33
|
+
<a href=https://pypi.org/project/streamdown><img src=https://badge.fury.io/py/streamdown.svg/></a>
|
|
34
|
+
</p>
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
It's fully streaming and does not block
|
|
36
|
+
The streaming markdown renderer for the terminal that rocks!
|
|
37
|
+
Streamdown works with [simonw's llm](https://github.com/simonw/llm) along with any other streaming markdown. You even get full readline and keyboard navigation support.
|
|
38
|
+
```bash
|
|
39
|
+
$ pip install streamdown
|
|
40
|
+
```
|
|
38
41
|

|
|
39
42
|
|
|
40
43
|
### Provides clean copyable code for long code lines
|
|
41
|
-
You may have noticed
|
|
44
|
+
You may have noticed *inferior* renderers inject line breaks when copying code that wraps around. We're better and now you are too!
|
|
42
45
|

|
|
43
46
|
|
|
44
47
|
### Supports images
|
|
45
48
|
Here's kitty and alacritty. Try to do that in glow...
|
|
46
|
-

|
|
47
50
|
|
|
48
|
-
###
|
|
51
|
+
### Supports hyperlinks (OSC 8) and clipboard (OSC 52)
|
|
49
52
|
[links.webm](https://github.com/user-attachments/assets/a5f71791-7c58-4183-ad3b-309f470c08a3)
|
|
50
53
|
|
|
51
|
-
###
|
|
54
|
+
### Supports tables
|
|
52
55
|

|
|
53
56
|
|
|
54
57
|
As well as everything else...
|
|
55
|
-
|
|
56
58
|

|
|
57
59
|
|
|
58
60
|
### Colors are highly (and quickly) configurable for people who care a lot, or just a little.
|
|
59
|
-

|
|
60
62
|
|
|
61
63
|
### Has a [Plugin](https://github.com/kristopolous/Streamdown/tree/main/streamdown/plugins) system to extend the parser and renderer.
|
|
62
64
|
For instance, here is the [latex plugin](https://github.com/kristopolous/Streamdown/blob/main/streamdown/plugins/latex.py) doing math inside a table:
|
|
63
65
|

|
|
64
66
|
|
|
65
67
|
|
|
66
|
-
## Configuration
|
|
67
|
-
|
|
68
|
+
## TOML Configuration
|
|
68
69
|
|
|
69
70
|
Streamdown uses a TOML configuration file located at `~/.config/streamdown/config.toml` (following the XDG Base Directory Specification). If this file does not exist upon first run, it will be created with default values.
|
|
70
71
|
|
|
@@ -114,7 +115,7 @@ Width = 120
|
|
|
114
115
|
Timeout = 1.0
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
##
|
|
118
|
+
## Command Line
|
|
118
119
|
The most exciting feature here is `--exec` with it you can do full readline support like this:
|
|
119
120
|
|
|
120
121
|
$ sd --exec "llm chat"
|
|
@@ -1,41 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=https://github.com/user-attachments/assets/0468eac0-2a00-4e98-82ca-09e6ac679357/>
|
|
3
|
+
<br/>
|
|
4
|
+
<a href=https://pypi.org/project/streamdown><img src=https://badge.fury.io/py/streamdown.svg/></a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
The streaming markdown renderer for the terminal that rocks!
|
|
8
|
+
Streamdown works with [simonw's llm](https://github.com/simonw/llm) along with any other streaming markdown. You even get full readline and keyboard navigation support.
|
|
9
|
+
```bash
|
|
10
|
+
$ pip install streamdown
|
|
11
|
+
```
|
|
9
12
|

|
|
10
13
|
|
|
11
14
|
### Provides clean copyable code for long code lines
|
|
12
|
-
You may have noticed
|
|
15
|
+
You may have noticed *inferior* renderers inject line breaks when copying code that wraps around. We're better and now you are too!
|
|
13
16
|

|
|
14
17
|
|
|
15
18
|
### Supports images
|
|
16
19
|
Here's kitty and alacritty. Try to do that in glow...
|
|
17
|
-

|
|
18
21
|
|
|
19
|
-
###
|
|
22
|
+
### Supports hyperlinks (OSC 8) and clipboard (OSC 52)
|
|
20
23
|
[links.webm](https://github.com/user-attachments/assets/a5f71791-7c58-4183-ad3b-309f470c08a3)
|
|
21
24
|
|
|
22
|
-
###
|
|
25
|
+
### Supports tables
|
|
23
26
|

|
|
24
27
|
|
|
25
28
|
As well as everything else...
|
|
26
|
-
|
|
27
29
|

|
|
28
30
|
|
|
29
31
|
### Colors are highly (and quickly) configurable for people who care a lot, or just a little.
|
|
30
|
-

|
|
31
33
|
|
|
32
34
|
### Has a [Plugin](https://github.com/kristopolous/Streamdown/tree/main/streamdown/plugins) system to extend the parser and renderer.
|
|
33
35
|
For instance, here is the [latex plugin](https://github.com/kristopolous/Streamdown/blob/main/streamdown/plugins/latex.py) doing math inside a table:
|
|
34
36
|

|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
## Configuration
|
|
38
|
-
|
|
39
|
+
## TOML Configuration
|
|
39
40
|
|
|
40
41
|
Streamdown uses a TOML configuration file located at `~/.config/streamdown/config.toml` (following the XDG Base Directory Specification). If this file does not exist upon first run, it will be created with default values.
|
|
41
42
|
|
|
@@ -85,7 +86,7 @@ Width = 120
|
|
|
85
86
|
Timeout = 1.0
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
##
|
|
89
|
+
## Command Line
|
|
89
90
|
The most exciting feature here is `--exec` with it you can do full readline support like this:
|
|
90
91
|
|
|
91
92
|
$ sd --exec "llm chat"
|
|
Binary file
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Generator: visioncortex VTracer -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
id="svg"
|
|
6
|
+
version="1.1"
|
|
7
|
+
style="display:block"
|
|
8
|
+
viewBox="0 0 389.90754 91.487504"
|
|
9
|
+
sodipodi:docname="logo.svg"
|
|
10
|
+
width="389.90753"
|
|
11
|
+
height="91.487503"
|
|
12
|
+
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
|
|
13
|
+
inkscape:export-filename="logo.png"
|
|
14
|
+
inkscape:export-xdpi="96"
|
|
15
|
+
inkscape:export-ydpi="96"
|
|
16
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
17
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
20
|
+
<defs
|
|
21
|
+
id="defs14" />
|
|
22
|
+
<sodipodi:namedview
|
|
23
|
+
id="namedview14"
|
|
24
|
+
pagecolor="#ffffff"
|
|
25
|
+
bordercolor="#000000"
|
|
26
|
+
borderopacity="0.25"
|
|
27
|
+
inkscape:showpageshadow="2"
|
|
28
|
+
inkscape:pageopacity="0.0"
|
|
29
|
+
inkscape:pagecheckerboard="0"
|
|
30
|
+
inkscape:deskcolor="#d1d1d1"
|
|
31
|
+
inkscape:zoom="7.6562156"
|
|
32
|
+
inkscape:cx="84.702421"
|
|
33
|
+
inkscape:cy="45.126733"
|
|
34
|
+
inkscape:window-width="1239"
|
|
35
|
+
inkscape:window-height="1080"
|
|
36
|
+
inkscape:window-x="515"
|
|
37
|
+
inkscape:window-y="-2"
|
|
38
|
+
inkscape:window-maximized="0"
|
|
39
|
+
inkscape:current-layer="svg" />
|
|
40
|
+
<path
|
|
41
|
+
d="m 53.95,0 h 3.9 l 2.925,0.65 2.4375,0.8125 2.6,1.1375 2.6,1.4625 2.1125,1.4625 1.95,1.4625 1.625,1.4625 1.95,1.7875 1.1375,1.1375 1.1375,1.3 2.1125,2.6 1.3,1.7875 1.625,2.1125 0.975,1.3 1.3,0.65 2.6,0.975 5.2,2.6 2.925,1.7875 2.7625,1.95 2.1125,1.7875 1.7875,1.4625 2.925,2.925 1.4625,1.7875 1.3,1.4625 1.95,2.7625 1.7875,2.925 1.95,3.7375 2.1125,5.3625 1.1375,4.0625 0.975,3.4125 1.4625,2.4375 0.8125,1.625 0.325,1.1375 0.1625,2.1125 -0.65,2.6 -1.4625,2.6 -1.4625,1.7875 -1.7875,1.7875 -2.7625,2.1125 -2.1125,1.3 -3.4125,1.95 -2.6,1.3 -3.4125,1.4625 -3.4125,1.1375 -4.55,0.975 -4.225,0.65 -5.0375,0.325 -4.225,-0.1625 -2.7625,-0.325 -2.4375,1.4625 -2.6,1.4625 -2.7625,0.975 -2.925,0.65 H 62.075 L 60.125,91 57.85,89.8625 56.7125,88.725 55.9,87.1 l -0.4875,-2.4375 -3.0875,-0.975 -1.7875,-0.975 -1.625,-1.3 L 47.45,79.3 46.8,77.5125 46.475,75.4 v -2.925 l -1.4625,-1.7875 -1.95,-2.275 -1.3,-1.625 -1.95,-2.275 -1.4625,-1.625 -1.1375,-1.3 L 35.75,59.9625 34.2875,58.3375 32.825,56.55 32.0125,55.7375 v -0.325 h -0.325 l -1.1375,-1.3 -1.3,-0.65 -1.625,0.1625 -1.95,0.8125 -2.275,1.3 -3.7375,1.7875 -3.25,1.4625 -3.575,1.3 -3.0875,0.65 H 6.175 L 4.0625,60.45 3.0875,59.9625 2.1125,58.825 1.4625,57.0375 V 54.925 L 1.95,52.4875 3.25,48.5875 4.875,44.85 6.6625,41.4375 7.8,39.325 l -0.1625,-1.3 -1.3,-2.6 -2.275,-4.55 -1.95,-4.55 L 0.975,22.9125 0.325,20.15 0,17.7125 V 14.625 l 0.65,-1.7875 1.1375,-1.4625 0.975,-0.65 0.8125,-0.1625 h 1.7875 l 2.7625,0.65 2.6,1.1375 2.6,1.4625 2.6,1.7875 2.1125,1.625 2.1125,1.7875 2.4375,2.275 1.95,1.95 1.1375,1.3 2.1125,2.275 1.7875,2.275 c 0.275719,0.499267 0.393174,0.632565 0.65,0.975 l 0.65,0.325 1.1375,0.8125 0.975,0.1625 2.6,-1.1375 2.7625,-1.625 2.6,-1.4625 0.975,-0.4875 v -1.625 l 0.325,-1.95 0.65,-1.3 1.1375,-1.1375 1.7875,-1.1375 1.7875,-1.3 0.325,-0.4875 V 16.25 L 47.125,12.1875 46.9625,10.725 V 7.15 L 47.45,4.7125 48.5875,2.7625 49.725,1.625 52,0.4875 Z"
|
|
42
|
+
style="fill:#fbb034;stroke-width:0.1625"
|
|
43
|
+
id="path1"
|
|
44
|
+
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
|
|
45
|
+
<path
|
|
46
|
+
d="m 4.0625,13.8125 h 1.3 l 2.1125,0.65 2.7625,1.3 3.9,2.6 1.625,1.3 2.275,1.7875 0.8125,0.8125 4.55,4.55 1.1375,1.3 2.1125,2.4375 1.7875,2.275 0.65,0.8125 1.4625,0.975 0.4875,0.1625 h 2.4375 l 2.6,-1.1375 1.7875,-0.975 3.9,-2.275 4.225,-2.275 L 49.725,26.325 52,25.5125 56.0625,24.375 60.45,23.4 66.1375,22.75 68.575,22.5875 h 6.0125 l 3.4125,0.325 5.0375,0.975 1.7875,0.4875 0.1625,0.65 -2.1125,0.8125 -2.6,1.3 -2.925,2.1125 -2.4375,2.275 -1.1375,1.4625 -1.625,2.1125 -1.625,2.7625 -1.3,2.7625 -0.8125,3.4125 -0.1625,5.3625 -0.325,2.4375 -0.8125,2.6 -1.4625,3.0875 -0.325,1.7875 0.1625,1.95 0.325,1.625 0.325,0.1625 h -0.325 l 0.1625,0.4875 -2.6,-0.65 -1.7875,-0.325 h -4.225 l -2.6,0.4875 -2.1125,0.8125 h -0.325 v 0.325 l -1.4625,0.975 -0.65,0.325 v 0.325 L 49.4,66.625 47.775,68.9 47.45,68.7375 v -0.325 l -0.65,-0.325 -2.1125,-1.95 -1.95,-1.95 L 41.275,62.4 39.65,60.2875 37.8625,58.0125 36.075,55.7375 33.9625,53.1375 32.825,52.1625 32.0125,51.35 30.225,50.2125 29.7375,50.05 h -1.95 l -1.4625,0.325 -2.6,1.4625 -1.625,0.975 -3.4125,1.7875 -3.25,1.3 -3.4125,1.1375 -3.9,0.65 -2.6,-0.1625 -0.65,-0.65 v -1.95 L 5.525,52 l 1.1375,-3.25 0.65,-1.4625 1.3,-2.6 1.95,-3.25 0.65,-1.4625 v -2.1125 l -0.65,-1.625 L 8.775,32.825 7.15,29.7375 6.0125,27.3 4.3875,22.75 3.7375,20.6375 3.4125,18.85 3.25,15.7625 3.575,14.3 Z"
|
|
47
|
+
style="fill:#faaa36;stroke-width:0.1625"
|
|
48
|
+
id="path2" />
|
|
49
|
+
<path
|
|
50
|
+
d="m 53.95,0 h 3.9 l 2.925,0.65 2.4375,0.8125 2.6,1.1375 2.6,1.4625 2.1125,1.4625 1.95,1.4625 1.625,1.4625 1.95,1.7875 1.1375,1.1375 1.1375,1.3 2.1125,2.6 1.3,1.7875 1.625,2.1125 0.975,1.3 1.3,0.65 2.6,0.975 5.2,2.6 2.925,1.7875 2.7625,1.95 2.1125,1.7875 1.7875,1.4625 2.925,2.925 1.4625,1.7875 1.3,1.4625 1.95,2.7625 1.7875,2.925 1.95,3.7375 2.1125,5.3625 1.1375,4.0625 0.975,3.4125 1.4625,2.4375 0.8125,1.625 0.325,1.1375 0.1625,2.1125 -0.65,2.6 -1.4625,2.6 -1.4625,1.7875 -1.7875,1.7875 -2.7625,2.1125 -2.1125,1.3 -3.4125,1.95 -2.6,1.3 -3.4125,1.4625 -3.4125,1.1375 -4.55,0.975 -4.225,0.65 -5.0375,0.325 -4.225,-0.1625 -2.7625,-0.325 -2.4375,1.4625 -2.6,1.4625 -2.7625,0.975 -2.925,0.65 H 62.075 L 60.125,91 57.85,89.8625 56.7125,88.725 55.9,87.1 l -0.4875,-2.4375 -3.0875,-0.975 -1.7875,-0.975 -1.625,-1.3 L 47.45,79.3 46.8,77.5125 46.475,75.4 v -2.925 l -1.4625,-1.7875 -1.95,-2.275 -1.3,-1.625 -1.95,-2.275 -1.4625,-1.625 -1.1375,-1.3 L 35.75,59.9625 34.2875,58.3375 32.825,56.55 32.0125,55.7375 v -0.325 h -0.325 l -1.1375,-1.3 -1.3,-0.65 -1.625,0.1625 -1.95,0.8125 -2.275,1.3 -3.7375,1.7875 -3.25,1.4625 -3.575,1.3 -3.0875,0.65 H 6.175 L 4.0625,60.45 3.0875,59.9625 2.1125,58.825 1.4625,57.0375 V 54.925 L 1.95,52.4875 3.25,48.5875 4.875,44.85 6.6625,41.4375 7.8,39.325 l -0.1625,-1.3 -1.3,-2.6 -2.275,-4.55 -1.95,-4.55 L 0.975,22.9125 0.325,20.15 0,17.7125 V 14.625 l 0.65,-1.7875 1.1375,-1.4625 0.975,-0.65 0.8125,-0.1625 h 1.7875 l 2.7625,0.65 2.6,1.1375 2.6,1.4625 2.6,1.7875 2.1125,1.625 2.1125,1.7875 2.4375,2.275 1.95,1.95 1.1375,1.3 2.1125,2.275 1.7875,2.275 0.325,0.65 c 0.351718,0.267784 0.216666,0.216666 0.325,0.325 l 0.65,0.325 1.1375,0.8125 0.975,0.1625 2.6,-1.1375 2.7625,-1.625 2.6,-1.4625 0.975,-0.4875 v -1.625 l 0.325,-1.95 0.65,-1.3 1.1375,-1.1375 1.7875,-1.1375 1.7875,-1.3 0.325,-0.4875 V 16.25 L 47.125,12.1875 46.9625,10.725 V 7.15 L 47.45,4.7125 48.5875,2.7625 49.725,1.625 52,0.4875 Z M 4.0625,13.8125 3.575,14.3 3.25,16.25 l 0.1625,2.6 0.4875,2.275 1.7875,5.3625 1.3,2.925 1.625,3.25 1.625,2.925 0.8125,1.625 0.1625,0.65 v 2.1125 l -1.3,2.6 L 8.45,45.0125 6.9875,47.775 5.3625,52.4875 4.875,54.925 v 1.95 l 0.65,0.65 2.6,0.1625 3.9,-0.65 4.7125,-1.625 3.25,-1.4625 3.575,-1.95 1.7875,-1.1375 1.3,-0.65 1.1375,-0.1625 h 1.95 l 1.625,0.8125 1.3,0.975 0.8125,0.8125 1.625,1.7875 2.1125,2.7625 2.1125,2.6 1.95,2.6 2.1125,2.4375 2.6,2.6 1.1375,0.975 c 0.238154,0.3062 0.308617,0.308617 0.4875,0.4875 l 0.8125,-0.8125 1.4625,-2.1125 0.325,-0.1625 c -0.0044,-0.457005 0.238774,-0.444387 0.65,-0.65 l 1.4625,-0.975 1.4625,-0.8125 1.625,-0.4875 1.95,-0.325 h 4.225 l 3.0875,0.65 2.275,0.8125 0.975,0.4875 0.4875,0.1625 v 1.1375 l -0.4875,0.65 -1.4625,-0.1625 -3.575,-0.8125 h -4.225 l -2.7625,0.65 -1.95,0.8125 -1.4625,1.1375 -1.3,1.625 -0.975,1.95 -0.325,1.4625 v 2.7625 l 0.4875,1.7875 0.65,1.1375 1.625,1.4625 1.7875,0.8125 L 57.2,81.575 61.5875,81.25 64.35,80.6 66.3,79.7875 68.0875,78.65 l 1.625,-1.4625 1.95,-1.95 0.65,-0.8125 0.65,0.325 h 0.975 l 0.1625,0.975 -1.3,1.7875 -1.625,2.275 -1.625,1.625 v 0.325 l 2.1125,0.8125 3.4125,0.975 2.6,0.4875 4.55,0.325 h 4.225 l 5.525,-0.65 3.7375,-0.8125 4.3875,-1.4625 3.9,-1.625 3.0875,-1.4625 0.975,-0.65 -0.65,-0.325 L 105.3,76.7 104,75.8875 h -0.325 l -0.325,-0.65 -0.975,-1.3 -0.1625,-0.8125 0.8125,-0.1625 1.625,1.1375 1.4625,0.65 0.65,0.1625 h 2.925 l 1.95,-0.4875 2.275,-1.1375 1.625,-1.3 1.3,-1.4625 1.1375,-2.275 0.1625,-0.65 v -2.275 l -0.325,-0.975 -1.3,-1.95 -0.975,-1.625 -0.65,-1.7875 -0.8125,-3.9 -1.3,-3.9 -1.625,-3.9 L 110.175,45.5 109.2,43.875 108.55,42.7375 106.4375,39.65 104.65,37.5375 104,36.5625 103.5125,36.075 c -0.32419,-0.296348 -0.34673,-0.309086 -0.65,-0.65 l -0.65,-0.8125 -0.8125,-0.65 -0.1625,-0.325 c -0.30502,-0.235862 -0.21667,-0.216666 -0.325,-0.325 l -1.625,-1.3 C 99.166039,31.822798 98.921706,31.646706 98.8,31.525 98.439053,31.259572 98.321876,31.176382 98.15,31.0375 L 96.3625,29.9 l -2.6,-1.625 -2.6,-1.4625 L 87.75,25.35 83.6875,24.05 79.625,23.2375 76.5375,22.75 74.5875,22.5875 H 68.575 l -5.6875,0.4875 -4.0625,0.65 -5.2,1.3 -3.0875,0.975 -3.25,1.4625 -4.7125,2.4375 -3.9,2.275 -2.6,1.4625 -2.6,1.1375 h -2.4375 l -1.3,-0.65 L 28.925,33.3125 27.625,31.85 26.1625,30.0625 24.375,27.95 22.9125,26.325 18.85,22.2625 18.0375,21.45 15.4375,19.3375 13,17.55 9.9125,15.6 7.475,14.4625 5.3625,13.8125 Z"
|
|
51
|
+
style="fill:#253949;stroke-width:0.1625;fill-opacity:1"
|
|
52
|
+
id="path3"
|
|
53
|
+
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
|
|
54
|
+
<path
|
|
55
|
+
d="m 4.0625,13.8125 h 1.3 l 2.1125,0.65 2.7625,1.3 3.9,2.6 1.625,1.3 2.275,1.7875 0.8125,0.8125 4.55,4.55 1.1375,1.3 2.1125,2.4375 1.7875,2.275 0.4875,0.4875 -0.1625,0.4875 -0.4875,0.325 v 0.325 l -0.8125,0.65 v 0.4875 L 26.975,36.075 26.65,36.725 H 26.325 L 26,37.5375 l -0.325,0.65 V 39 l -0.65,0.8125 0.325,0.1625 -0.325,0.325 -0.325,3.25 0.1625,2.4375 0.325,0.8125 0.65,2.6 0.1625,1.1375 -2.7625,1.625 -3.575,1.95 -3.7375,1.625 -3.9,1.3 -3.9,0.65 -2.6,-0.1625 -0.65,-0.65 v -1.95 L 5.525,52 l 1.1375,-3.25 0.65,-1.4625 1.3,-2.6 1.95,-3.25 0.65,-1.4625 v -2.1125 l -0.65,-1.625 L 8.775,32.825 7.15,29.7375 6.0125,27.3 4.3875,22.75 3.7375,20.6375 3.4125,18.85 3.25,15.7625 3.575,14.3 Z"
|
|
56
|
+
style="fill:#faa428;stroke-width:0.1625"
|
|
57
|
+
id="path4" />
|
|
58
|
+
<path
|
|
59
|
+
d="m 90.675,45.9875 h 2.1125 l 2.6,0.65 1.625,0.65 2.1125,1.4625 0.4875,0.4875 c 0.208101,0.306981 0.238774,0.444387 0.65,0.65 L 101.725,52 l 0.8125,1.7875 0.65,2.6 v 3.575 l -0.65,2.4375 -1.1375,2.275 -0.975,1.3 -0.975,1.1375 -2.1125,1.4625 -2.275,0.975 -1.3,0.325 h -2.925 L 88.4,69.225 86.125,68.0875 84.6625,66.95 83.2,65.4875 81.9,63.375 81.0875,61.5875 80.6,59.475 v -3.7375 l 0.65,-2.4375 1.1375,-2.275 1.4625,-1.7875 1.4625,-1.3 2.4375,-1.3 z"
|
|
60
|
+
style="fill:#263d50;stroke-width:0.1625"
|
|
61
|
+
id="path5"
|
|
62
|
+
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccc" />
|
|
63
|
+
<path
|
|
64
|
+
d="m 72.6375,22.5875 h 1.95 l 3.4125,0.325 5.0375,0.975 1.7875,0.4875 0.1625,0.65 -2.1125,0.8125 -2.6,1.3 -2.925,2.1125 -2.4375,2.275 -1.1375,1.4625 -1.625,2.1125 -1.625,2.7625 -1.3,2.7625 -0.8125,3.4125 -0.1625,5.3625 -0.325,2.4375 -0.8125,2.6 -1.4625,3.0875 -0.325,1.7875 0.1625,1.95 0.325,1.625 0.325,0.1625 h -0.325 l 0.1625,0.4875 -2.6,-0.65 -1.7875,-0.325 h -4.225 l -1.3,0.1625 L 55.9,62.4 l 0.65,-0.1625 -0.1625,-0.65 h 0.325 l -0.325,-1.4625 v -3.9 l 0.4875,-1.625 1.3,-2.7625 0.8125,-1.95 0.975,-2.925 0.1625,-0.975 0.1625,-4.7125 0.325,-2.4375 L 61.425,36.725 62.4,34.775 63.5375,33.3125 65,31.525 l 1.95,-1.95 1.3,-1.1375 1.1375,-1.1375 1.4625,-1.7875 1.4625,-2.275 z"
|
|
65
|
+
style="fill:#f27b3f;stroke-width:0.1625"
|
|
66
|
+
id="path6" />
|
|
67
|
+
<path
|
|
68
|
+
d="M 54.925,3.0875 H 57.2 l 2.6,0.4875 3.0875,1.1375 1.3,0.65 1.3,0.4875 1.7875,1.1375 2.275,1.625 2.1125,1.625 2.7625,2.6 0.975,1.1375 0.8125,0.8125 c 0.216312,0.279081 0.216666,0.216667 0.325,0.325 l 1.1375,1.7875 1.4625,1.95 0.325,0.975 -0.65,0.1625 -3.0875,-0.325 H 68.25 l -4.875,0.4875 -4.3875,0.65 -5.85,1.4625 -3.575,1.3 -3.7375,1.625 h -0.65 v -0.975 l 0.8125,-0.975 2.6,-1.4625 1.625,-1.3 0.975,-1.4625 0.1625,-0.65 v -1.95 l -0.975,-4.55 -0.1625,-1.625 V 6.5 l 0.65,-1.4625 1.3,-0.975 1.3,-0.65 z"
|
|
69
|
+
style="fill:#fcb031;stroke-width:0.1625"
|
|
70
|
+
id="path7"
|
|
71
|
+
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccc" />
|
|
72
|
+
<path
|
|
73
|
+
d="m 68.575,22.5875 h 4.0625 l -0.325,0.975 -1.7875,2.6 -2.4375,2.6 -2.6,2.4375 -1.4625,1.625 -1.4625,1.95 -1.3,2.6 -0.65,2.275 -0.1625,2.1125 -0.1625,4.225 -0.65,2.6 -1.1375,3.0875 -1.3,2.6 -0.4875,1.1375 -0.1625,0.8125 v 3.9 l 0.1625,1.4625 h -0.325 l 0.325,0.8125 -1.3,0.4875 -2.4375,0.8125 -0.65,0.1625 v 0.325 L 51.35,64.5125 51.1875,63.375 50.7,63.2125 50.5375,62.725 50.2125,62.5625 50.375,61.75 49.5625,61.9125 v -0.325 L 49.075,61.425 49.725,61.2625 49.8875,61.1 49.4,60.775 l -0.1625,-0.1625 -0.325,0.325 -0.325,-0.65 -0.1625,-0.8125 -0.1625,-1.4625 0.325,-2.6 0.325,-1.4625 0.8125,-1.7875 0.975,-2.6 0.8125,-1.7875 0.325,-1.3 V 44.2 l -0.325,-2.4375 v -2.275 L 52,37.05 l 1.1375,-2.4375 1.1375,-1.95 0.975,-1.1375 1.4625,-1.7875 2.1125,-2.1125 0.8125,-0.975 h 0.325 l 0.325,-0.8125 0.975,-1.4625 0.1625,-0.975 1.4625,-0.325 z"
|
|
74
|
+
style="fill:#faaf38;stroke-width:0.1625"
|
|
75
|
+
id="path8" />
|
|
76
|
+
<path
|
|
77
|
+
d="m 60.45,23.4 h 0.975 l 0.1625,0.65 -0.975,1.625 -0.65,0.975 -0.65,0.65 -0.65,0.65 -1.95,1.95 -0.975,1.3 -0.65,0.8125 -0.975,1.1375 -0.975,1.625 -0.975,2.275 -0.4875,2.4375 v 2.275 L 52,44.2 v 2.275 l -0.4875,1.625 -1.1375,2.6 -0.975,2.6 -0.4875,0.975 -0.1625,1.1375 -0.325,2.6 v 1.4625 l 0.325,0.1625 -0.1625,0.65 0.325,0.1625 0.1625,0.1625 0.4875,0.975 v 0.325 l 0.65,0.65 0.4875,0.1625 0.1625,0.4875 0.325,0.1625 0.325,0.8125 -0.1625,0.65 -0.8125,0.65 h -0.325 v 0.325 L 49.4,66.625 47.775,68.9 47.45,68.7375 v -0.325 l -0.65,-0.325 -2.1125,-1.95 -1.95,-1.95 -1.4625,-1.7875 -0.1625,-0.325 1.3,0.1625 0.1625,-0.65 -0.325,-0.65 -0.4875,-0.65 L 41.275,58.6625 40.625,57.2 40.3,54.6 40.95,52 l 1.1375,-2.275 1.625,-2.6 0.65,-1.7875 0.1625,-0.975 V 42.575 l -0.4875,-3.7375 0.1625,-2.925 0.65,-2.4375 0.4875,-0.8125 0.975,-1.625 1.3,-1.625 L 49.4,27.3 49.5625,26.975 h 0.325 V 26.65 l 0.975,-0.8125 5.2,-1.4625 z"
|
|
78
|
+
style="fill:#f07640;stroke-width:0.1625"
|
|
79
|
+
id="path9"
|
|
80
|
+
sodipodi:nodetypes="cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" />
|
|
81
|
+
<path
|
|
82
|
+
d="m 38.35,32.3375 0.325,0.1625 -0.325,3.25 -0.325,5.6875 -0.4875,3.0875 -0.8125,1.95 -1.7875,3.0875 V 50.05 l -0.8125,0.8125 -0.65,1.3 -0.325,0.1625 -1.7875,-1.4625 -1.625,-0.8125 h -1.95 L 26,50.375 25.5125,49.075 24.8625,46.15 24.7,45.5 24.5375,43.0625 24.8625,40.3 l 0.325,-0.975 0.325,-0.65 0.1625,-0.65 0.65,-1.3 0.65,-0.975 c 0.137171,-0.150279 0.216667,-0.433333 0.325,-0.65 l 0.65,-0.65 c 0.148224,-0.179928 0.08941,-0.268234 0.1625,-0.4875 l 0.975,-0.325 1.4625,0.975 0.4875,0.1625 h 2.4375 l 2.6,-1.1375 1.7875,-0.975 z"
|
|
83
|
+
style="fill:#f17840;stroke-width:0.1625"
|
|
84
|
+
id="path10"
|
|
85
|
+
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccc" />
|
|
86
|
+
<path
|
|
87
|
+
d="m 91,47.775 h 1.625 l 2.1125,0.4875 2.275,1.1375 1.95,1.7875 1.4625,2.275 0.65,1.7875 0.325,1.95 -0.1625,2.925 -0.8125,2.6 -0.1625,0.325 h -0.325 L 100.1,62.075 V 58.9875 L 99.45,56.875 98.475,55.25 97.5,54.1125 l -0.8125,-0.65 -0.8125,-0.65 -2.1125,-0.65 H 91.325 l -1.7875,0.65 -1.4625,1.1375 -0.975,1.3 -0.8125,1.7875 -0.325,1.3 V 60.45 l 0.65,2.1125 0.975,1.625 0.975,1.1375 1.3,0.975 1.625,0.8125 1.625,0.4875 v 0.1625 h -2.6 l -2.6,-0.8125 -2.275,-1.625 -1.4625,-1.7875 -1.3,-2.6 -0.4875,-2.275 v -2.275 l 0.65,-2.6 0.975,-1.7875 1.625,-1.95 1.625,-1.1375 1.95,-0.8125 z"
|
|
88
|
+
style="fill:#efe8d8;stroke-width:0.1625"
|
|
89
|
+
id="path11"
|
|
90
|
+
sodipodi:nodetypes="ccccccccccccccccccccccccccccccccccccccccccccccc" />
|
|
91
|
+
<path
|
|
92
|
+
d="m 117.65,18.85 h 2.1125 l 1.7875,0.65 1.625,1.4625 0.8125,1.7875 0.1625,1.3 -0.325,1.95 -0.975,1.625 -1.3,1.1375 -1.7875,0.65 h -1.95 l -1.7875,-0.65 -1.1375,-0.8125 -0.975,-1.4625 -0.4875,-1.1375 v -2.4375 l 0.65,-1.625 1.1375,-1.3 1.95,-0.975 z m 1.7875,3.0875 -0.4875,0.325 -0.1625,0.65 0.4875,0.65 h 0.8125 l 0.325,-0.325 v -0.975 l -0.4875,-0.325 z"
|
|
93
|
+
style="fill:#1c354a;stroke-width:0.1625"
|
|
94
|
+
id="path12" />
|
|
95
|
+
<path
|
|
96
|
+
d="m 74.1,75.725 0.65,0.325 0.4875,0.65 1.3,0.4875 0.975,0.1625 1.95,0.4875 0.325,0.4875 0.8125,0.4875 0.325,0.65 0.8125,0.8125 0.4875,0.4875 0.4875,0.4875 1.1375,2.275 0.325,0.4875 v 0.325 h -1.95 l -4.55,-0.325 -3.4125,-0.65 -4.0625,-1.3 -0.65,-0.325 0.325,-0.65 1.625,-1.625 1.625,-2.4375 z"
|
|
97
|
+
style="fill:#e7683e;stroke-width:0.1625"
|
|
98
|
+
id="path13"
|
|
99
|
+
sodipodi:nodetypes="cccccccccccccccccccccccc" />
|
|
100
|
+
<path
|
|
101
|
+
d="m 124.63749,40.7875 h 2.1125 l 1.4625,0.8125 0.975,1.3 0.1625,0.4875 v 2.275 l -0.65,1.3 -1.1375,0.975 -1.625,0.4875 -1.4625,-0.1625 -1.625,-0.975 -0.8125,-1.1375 -0.325,-1.3 0.1625,-1.4625 0.8125,-1.4625 1.4625,-0.975 z m 0.975,2.275 -0.1625,0.1625 v 0.8125 l 0.1625,0.1625 h 0.8125 l 0.1625,-0.8125 -0.325,-0.325 z"
|
|
102
|
+
style="fill:#1c354a;stroke-width:0.1625"
|
|
103
|
+
id="path14" />
|
|
104
|
+
<text
|
|
105
|
+
xml:space="preserve"
|
|
106
|
+
style="font-size:29.1586px;font-family:'Familjen Grotesk';-inkscape-font-specification:'Familjen Grotesk';text-align:start;writing-mode:lr-tb;direction:ltr;text-anchor:start;fill:#fbb034;fill-opacity:1;stroke:#253949;stroke-width:0.665;stroke-opacity:1;stroke-dasharray:none"
|
|
107
|
+
x="199.5256"
|
|
108
|
+
y="49.812157"
|
|
109
|
+
id="text28"
|
|
110
|
+
transform="scale(0.75332836,1.3274424)"><tspan
|
|
111
|
+
sodipodi:role="line"
|
|
112
|
+
id="tspan28"
|
|
113
|
+
x="199.5256"
|
|
114
|
+
y="49.812157"
|
|
115
|
+
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Sixtyfour;-inkscape-font-specification:Sixtyfour;fill:#fbb034;fill-opacity:1;stroke:#253949;stroke-width:0.665;stroke-opacity:1;stroke-dasharray:none">Streamdown_</tspan></text>
|
|
116
|
+
</svg>
|
|
@@ -22,7 +22,6 @@ import subprocess
|
|
|
22
22
|
import traceback
|
|
23
23
|
import colorsys
|
|
24
24
|
import base64
|
|
25
|
-
import importlib
|
|
26
25
|
from io import BytesIO
|
|
27
26
|
from term_image.image import from_file, from_url
|
|
28
27
|
import pygments.util
|
|
@@ -569,9 +568,10 @@ def parse(stream):
|
|
|
569
568
|
# <code><pre>
|
|
570
569
|
#
|
|
571
570
|
if not state.in_code:
|
|
572
|
-
code_match = re.match(r"
|
|
571
|
+
code_match = re.match(r"^\s*```\s*([^\s]+|$)\s*$", line)
|
|
573
572
|
if code_match:
|
|
574
573
|
state.in_code = Code.Backtick
|
|
574
|
+
state.code_indent = len(line) - len(line.lstrip())
|
|
575
575
|
state.code_language = code_match.group(1) or 'Bash'
|
|
576
576
|
|
|
577
577
|
elif state.CodeSpaces and last_line_empty_cache and not state.in_list:
|
|
@@ -596,6 +596,7 @@ def parse(stream):
|
|
|
596
596
|
|
|
597
597
|
if state.in_code:
|
|
598
598
|
try:
|
|
599
|
+
# This is turning it OFF
|
|
599
600
|
if not state.code_first_line and (
|
|
600
601
|
( state.in_code == Code.Backtick and line.strip() == "```" ) or
|
|
601
602
|
(state.CodeSpaces and state.in_code == Code.Spaces and not line.startswith(' '))
|
|
@@ -625,9 +626,7 @@ def parse(stream):
|
|
|
625
626
|
state.emit_flush = True
|
|
626
627
|
yield RESET
|
|
627
628
|
|
|
628
|
-
|
|
629
629
|
if code_type == Code.Backtick:
|
|
630
|
-
state.code_indent = len(line) - len(line.lstrip())
|
|
631
630
|
continue
|
|
632
631
|
else:
|
|
633
632
|
# otherwise we don't want to consume
|
|
Binary file
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-

|
|
3
|
+
|
|
4
4
|
Python and Go (Golang) are both popular programming languages, but they cater to different needs and philosophies. Here's a detailed comparison:
|
|
5
|
-
🫣
|
|
6
5
|
|
|
7
|
-
**Python:** 🫣
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* **
|
|
13
|
-
* **
|
|
14
|
-
* **
|
|
15
|
-
* **
|
|
7
|
+
**Python:**
|
|
8
|
+
|
|
9
|
+
* **Strengths:**
|
|
10
|
+
* **Readability:** Known for its clean and easy-to-understand syntax, emphasizing code readability.
|
|
11
|
+
* **Large Ecosystem:** Vast library support for data science, machine learning, web development, scripting, and more. Packages like NumPy, Pandas, Django, and Flask make complex tasks simpler.
|
|
12
|
+
* **Rapid Development:** Its dynamic typing and interpreted nature allow for quick prototyping and development.
|
|
13
|
+
* **Dynamic Typing:** The interpreter infers data types at runtime, simplifying code (but potentially hiding errors).
|
|
14
|
+
* **Versatility:** Can be used for a wide range of applications – web backends, data analysis, machine learning, automation, scripting, testing, and more.
|
|
15
|
+
* **Community:** Huge and active community providing ample support, tutorials, and resources.
|
|
16
16
|
* **Weaknesses:**
|
|
17
|
-
* **Performance:** Being an interpreted language, Python is generally slower than compiled languages like Go.
|
|
18
|
-
* **Global Interpreter Lock (GIL):** Limits true multi-threading in CPU-bound operations.
|
|
19
|
-
* **Error Handling:** Runtime errors can be more common because of dynamic typing.
|
|
17
|
+
* **Performance:** Being an interpreted language, Python is generally slower than compiled languages like Go.
|
|
18
|
+
* **Global Interpreter Lock (GIL):** Limits true multi-threading in CPU-bound operations.
|
|
19
|
+
* **Error Handling:** Runtime errors can be more common because of dynamic typing.
|
|
20
20
|
* **Memory Consumption:** Typically has higher memory overhead compared to Go due to its object model and dynamic typing.
|
|
21
21
|
|
|
22
22
|
**Go:**
|
|
@@ -24,16 +24,16 @@ Python and Go (Golang) are both popular programming languages, but they cater to
|
|
|
24
24
|
* **Strengths:**
|
|
25
25
|
* **Performance:** Compiled language that produces efficient, native machine code. Generally much faster than Python.
|
|
26
26
|
* **Concurrency:** Built-in support for concurrency through Goroutines (lightweight threads) and Channels, making it easy to write concurrent and parallel programs.
|
|
27
|
-
|
|
27
|
+
* **Static Typing:** Helps catch errors at compile-time.
|
|
28
28
|
* **Garbage Collection:** Automatic memory management reduces the risk of memory leaks.
|
|
29
|
-
* **Simplicity:** Designed
|
|
29
|
+
* **Simplicity:** Designed to be a simple language with a relatively small number of keywords. Focuses on getting things done efficiently.
|
|
30
30
|
* **Scalability:** Well-suited for building scalable network services and distributed systems.
|
|
31
|
-
* **Tooling:**
|
|
31
|
+
* **Tooling:** Excellent built-in tooling for testing, formatting, and dependency management.
|
|
32
32
|
* **Weaknesses:**
|
|
33
|
-
* **Learning Curve:** Can be slightly steeper than Python initially, particularly regarding
|
|
33
|
+
* **Learning Curve:** Can be slightly steeper than Python initially, particularly regarding concurrency concepts.
|
|
34
34
|
* **Error Handling:** Explicit error handling (returning errors as values) can lead to verbose code. (While necessary, it's less concise than Python's `try...except`)
|
|
35
35
|
* **Generics (Relatively New):** Generics were only added in Go 1.18 (released in 2022). Prior to that, code reusability for different types was more challenging.
|
|
36
|
-
* **
|
|
36
|
+
* **Smaller Ecosystem:** While rapidly growing, Go’s ecosystem is still smaller than Python's, particularly in specialized areas like data science.
|
|
37
37
|
|
|
38
38
|
**Use Cases:**
|
|
39
39
|
|
|
@@ -47,7 +47,7 @@ Python and Go (Golang) are both popular programming languages, but they cater to
|
|
|
47
47
|
**1. Hello World:**
|
|
48
48
|
|
|
49
49
|
**Python:**
|
|
50
|
-
|
|
50
|
+
```python
|
|
51
51
|
print("Hello, World!")
|
|
52
52
|
```
|
|
53
53
|
|
|
@@ -64,7 +64,7 @@ func main() {
|
|
|
64
64
|
|
|
65
65
|
**2. Simple Web Server:**
|
|
66
66
|
|
|
67
|
-
**Python (using Flask
|
|
67
|
+
**Python (using Flask):**
|
|
68
68
|
```python
|
|
69
69
|
from flask import Flask
|
|
70
70
|
|
|
@@ -116,14 +116,14 @@ tasks = [1, 2, 3]
|
|
|
116
116
|
threads = []
|
|
117
117
|
|
|
118
118
|
for task in tasks:
|
|
119
|
-
thread = threading.Thread(
|
|
119
|
+
thread = threading.Thread(target=process_task, args=(task,))
|
|
120
120
|
threads.append(thread)
|
|
121
121
|
thread.start()
|
|
122
122
|
|
|
123
123
|
for thread in threads:
|
|
124
124
|
thread.join()
|
|
125
125
|
|
|
126
|
-
print("All tasks
|
|
126
|
+
print("All tasks completed.")
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
**Go (using Goroutines and Channels):**
|
|
@@ -137,10 +137,10 @@ import (
|
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
func processTask(taskID int, wg *sync.WaitGroup) {
|
|
140
|
-
defer wg.Done() // Decrement the WaitGroup counter when the
|
|
141
|
-
fmt.Printf("Task %d started
|
|
140
|
+
defer wg.Done() // Decrement the WaitGroup counter when the goroutine completes.
|
|
141
|
+
fmt.Printf("Task %d started\n", taskID)
|
|
142
142
|
// Simulate some work
|
|
143
|
-
//time.Sleep(2 * time
|
|
143
|
+
//time.Sleep(2 * time.Second) // Go uses time.Second, etc.
|
|
144
144
|
fmt.Printf("Task %d completed\n", taskID)
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -149,28 +149,28 @@ func main() {
|
|
|
149
149
|
tasks := []int{1, 2, 3}
|
|
150
150
|
|
|
151
151
|
for _, task := range tasks {
|
|
152
|
-
wg.Add(1) // Increment the WaitGroup counter for each
|
|
152
|
+
wg.Add(1) // Increment the WaitGroup counter for each goroutine.
|
|
153
153
|
go processTask(task, &wg)
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
wg.Wait()
|
|
157
|
-
fmt.
|
|
157
|
+
fmt.Println("All tasks completed.")
|
|
158
158
|
}
|
|
159
159
|
```
|
|
160
160
|
|
|
161
161
|
|
|
162
|
-
## Comparative Table
|
|
162
|
+
## Comparative Table of Features:
|
|
163
163
|
|
|
164
164
|
| Feature | Python | Go (Golang) |
|
|
165
165
|
|----------------------|----------------------------------|-------------------------------|
|
|
166
|
-
| **
|
|
166
|
+
| **Typing** | Dynamic, strong | Static, strong |
|
|
167
167
|
| **Compilation** | Interpreted | Compiled |
|
|
168
|
-
| **
|
|
169
|
-
| **Concurrency** | Through threads (GIL limited) | Goroutines &
|
|
170
|
-
| **Error Handling** | Exceptions (try-except) | Explicit error
|
|
168
|
+
| **Performance** | Generally slower | Generally faster |
|
|
169
|
+
| **Concurrency** | Through threads (GIL limited) | Goroutines & Channels (built-in) |
|
|
170
|
+
| **Error Handling** | Exceptions (try-except) | Explicit error values |
|
|
171
171
|
| **Memory Management**| Automatic (Garbage Collection) | Automatic (Garbage Collection) |
|
|
172
172
|
| **Syntax** | Readable, concise | Simple, explicit |
|
|
173
|
-
| **Ecosystem
|
|
173
|
+
| **Ecosystem** | Huge, mature | Growing, focused |
|
|
174
174
|
| **Learning Curve** | Easier | Moderate |
|
|
175
175
|
| **Generics** | Present | Added in 1.18 (relatively new)|
|
|
176
176
|
| **Typical Use Cases**| Data science, web dev, scripting | Cloud, networking, system programming |
|
|
@@ -181,7 +181,7 @@ func main() {
|
|
|
181
181
|
|
|
182
182
|
**In Summary:**
|
|
183
183
|
|
|
184
|
-
* **Choose Python
|
|
184
|
+
* **Choose Python if:** You need rapid development, a large ecosystem of libraries, or are focused on data science, machine learning, or scripting. Readability and ease of use are priorities.
|
|
185
185
|
|
|
186
186
|
* **Choose Go if:** You need high performance, concurrency, scalability, and are building infrastructure, network services, or command-line tools. Deterministic error handling and a simple, efficient language are key.
|
|
187
|
-
|
|
187
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|