streamdown 0.31.0__py3-none-any.whl → 0.33.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.
- streamdown/qwen3.md +25 -0
- streamdown/sd.py +19 -3
- streamdown/ss +1 -0
- streamdown/ss1 +42 -0
- {streamdown-0.31.0.dist-info → streamdown-0.33.0.dist-info}/METADATA +14 -6
- streamdown-0.33.0.dist-info/RECORD +12 -0
- streamdown-0.31.0.dist-info/RECORD +0 -9
- {streamdown-0.31.0.dist-info → streamdown-0.33.0.dist-info}/WHEEL +0 -0
- {streamdown-0.31.0.dist-info → streamdown-0.33.0.dist-info}/entry_points.txt +0 -0
- {streamdown-0.31.0.dist-info → streamdown-0.33.0.dist-info}/licenses/LICENSE.MIT +0 -0
streamdown/qwen3.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
### **3. Integration Strategy**
|
|
3
|
+
**Call Python from Bash for heavy tasks:**
|
|
4
|
+
```bash
|
|
5
|
+
# Bash calls Python for UUID generation
|
|
6
|
+
uuid=$(python3 -c "from uuid import uuid4; print(uuid4())")
|
|
7
|
+
|
|
8
|
+
# Bash calls Python for structured logging
|
|
9
|
+
python3 -c "
|
|
10
|
+
from log_utils import log_input
|
|
11
|
+
log_input('$(echo "$input" | sed 's/'\''/\\'\''/g')', '$pane_id')
|
|
12
|
+
"
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
**Pass state between layers via env vars:**
|
|
16
|
+
```bash
|
|
17
|
+
# Bash sets env vars
|
|
18
|
+
export PANE_ID="$pane_id"
|
|
19
|
+
export CAPTURE="$capture"
|
|
20
|
+
|
|
21
|
+
# Python reads them
|
|
22
|
+
import os
|
|
23
|
+
pane_id = os.getenv("PANE_ID")
|
|
24
|
+
```
|
|
25
|
+
|
streamdown/sd.py
CHANGED
|
@@ -37,6 +37,8 @@ from term_image.image import from_file, from_url
|
|
|
37
37
|
import pygments.util
|
|
38
38
|
from wcwidth import wcwidth
|
|
39
39
|
from functools import reduce
|
|
40
|
+
import textwrap
|
|
41
|
+
import argparse
|
|
40
42
|
from argparse import ArgumentParser
|
|
41
43
|
from pygments import highlight
|
|
42
44
|
from pygments.lexers import get_lexer_by_name
|
|
@@ -119,7 +121,12 @@ split_up = lambda line: re.findall(r'(\x1b[^m]*m|[^\x1b]*)', line)
|
|
|
119
121
|
def gettmpdir():
|
|
120
122
|
tmp_dir_all = os.path.join(tempfile.gettempdir(), "sd")
|
|
121
123
|
os.makedirs(tmp_dir_all, mode=0o777, exist_ok=True)
|
|
122
|
-
|
|
124
|
+
|
|
125
|
+
if os.name != 'nt':
|
|
126
|
+
tmp_dir = os.path.join(tmp_dir_all, str(os.getuid()))
|
|
127
|
+
else:
|
|
128
|
+
tmp_dir = tmp_dir_all
|
|
129
|
+
|
|
123
130
|
os.makedirs(tmp_dir, exist_ok=True)
|
|
124
131
|
return tmp_dir
|
|
125
132
|
|
|
@@ -154,7 +161,7 @@ class ParseState:
|
|
|
154
161
|
self.buffer = b''
|
|
155
162
|
self.current_line = ''
|
|
156
163
|
self.first_line = True
|
|
157
|
-
self.last_line_empty =
|
|
164
|
+
self.last_line_empty = True
|
|
158
165
|
self.is_pty = False
|
|
159
166
|
self.is_exec = False
|
|
160
167
|
self.maybe_prompt = False
|
|
@@ -1079,7 +1086,15 @@ def width_calc():
|
|
|
1079
1086
|
]
|
|
1080
1087
|
|
|
1081
1088
|
def main():
|
|
1082
|
-
parser = ArgumentParser(
|
|
1089
|
+
parser = ArgumentParser(
|
|
1090
|
+
formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent(f"""
|
|
1091
|
+
Streamdown is a streaming markdown renderer for modern terminals.
|
|
1092
|
+
https://github.com/day50-dev/Streamdown
|
|
1093
|
+
|
|
1094
|
+
paths:
|
|
1095
|
+
config {os.path.join(appdirs.user_config_dir('streamdown'), 'config.toml')}
|
|
1096
|
+
logs {gettmpdir()}
|
|
1097
|
+
"""))
|
|
1083
1098
|
parser.add_argument("filenameList", nargs="*", help="Input file to process (also takes stdin)")
|
|
1084
1099
|
parser.add_argument("-l", "--loglevel", default="INFO", help="Set the logging level")
|
|
1085
1100
|
parser.add_argument("-b", "--base", default=None, help="Set the hsv base: h,s,v")
|
|
@@ -1175,6 +1190,7 @@ def main():
|
|
|
1175
1190
|
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, state.terminal)
|
|
1176
1191
|
logging.warning(f"Exception thrown: {type(ex)} {ex}")
|
|
1177
1192
|
traceback.print_exc()
|
|
1193
|
+
state.exit = 1
|
|
1178
1194
|
|
|
1179
1195
|
if os.isatty(sys.stdout.fileno()) and state.Clipboard and state.code_buffer_raw:
|
|
1180
1196
|
code = state.code_buffer_raw
|
streamdown/ss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* **Model Card:** Always read the model card on the Hugging Face Hub ([https://huggingface.co/microsoft/bitnet-b1.58-2B-4T](https://huggingface.co/microsoft/bitnet-b1.58-2B-4T)) for important information about the model, its intended use, limitations, and potential biases.
|
streamdown/ss1
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
* `model.safetensors`: The name of the file you want to download. You'll need to know the exact filename. You can find the files in the model repository on the Hugging Face Hub website ([https://huggingface.co/microsoft/bitnet-b1.58-2B-4T](https://huggingface.co/microsoft/bitnet-b1.58-2B-4T)). Look under the "Files and versions" tab. `safetensors` is the preferred format for model weights now. If it's a `.bin` file, you can download that instead.
|
|
2
|
+
* `--local-dir ./bitnet-b1.58-2B-4T`: The directory to save the file to.
|
|
3
|
+
|
|
4
|
+
* **Download using `transformers` library (recommended for most use cases):**
|
|
5
|
+
|
|
6
|
+
The `transformers` library provides a convenient way to download and cache models. This is often the easiest approach if you're using the model with `transformers`. You don't *directly* use the `huggingface-cli` for this, but it's worth knowing.
|
|
7
|
+
|
|
8
|
+
```python
|
|
9
|
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
10
|
+
|
|
11
|
+
model_name = "microsoft/bitnet-b1.58-2B-4T"
|
|
12
|
+
|
|
13
|
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
14
|
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
|
15
|
+
|
|
16
|
+
# The model and tokenizer will be downloaded and cached in your
|
|
17
|
+
# transformers cache directory (usually ~/.cache/huggingface/transformers).
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
This approach automatically handles downloading the necessary files and caching them for future use. It also handles the correct file formats and configurations.
|
|
21
|
+
|
|
22
|
+
**4. Checking the Download**
|
|
23
|
+
|
|
24
|
+
After the download completes, verify that the files are in the specified directory. You can use `ls` (Linux/macOS) or `dir` (Windows) to list the contents of the directory.
|
|
25
|
+
|
|
26
|
+
**Important Considerations:**
|
|
27
|
+
|
|
28
|
+
* **Disk Space:** The `bitnet-b1.58-2B-4T` model is quite large (several gigabytes). Make sure you have enough free disk space before downloading.
|
|
29
|
+
* **Network Connection:** A stable and fast internet connection is essential for a smooth download.
|
|
30
|
+
* **Caching:** The Hugging Face Hub and `transformers` library use caching to avoid re-downloading models unnecessarily. The default cache directory is usually `~/.cache/huggingface/transformers`.
|
|
31
|
+
* **File Formats:** Models are often stored in `safetensors` or `.bin` formats. `safetensors` is generally preferred for security and performance.
|
|
32
|
+
* **Model Card:** Always read the model card on the Hugging Face Hub ([https://huggingface.co/microsoft/bitnet-b1.58-2B-4T](https://huggingface.co/microsoft/bitnet-b1.58-2B-4T)) for important information about the model, its intended use, limitations, and potential biases.
|
|
33
|
+
* **Gated Models:** Some models require you to accept terms of use before you can download them. The `huggingface-cli login` command will guide you through this process if necessary.
|
|
34
|
+
|
|
35
|
+
**Example Workflow (Recommended):**
|
|
36
|
+
|
|
37
|
+
1. `huggingface-cli login` (if not already logged in)
|
|
38
|
+
2. Use the `transformers` library in a Python script to download and load the model (as shown in the example above). This is the most convenient and reliable method for most use cases.
|
|
39
|
+
|
|
40
|
+
Let me know if you have any other questions or if you'd like help with a specific task related to this model!
|
|
41
|
+
|
|
42
|
+
>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamdown
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.33.0
|
|
4
4
|
Summary: A streaming markdown renderer for modern terminals with syntax highlighting
|
|
5
5
|
Project-URL: Homepage, https://github.com/day50-dev/Streamdown
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/day50-dev/Streamdown/issues
|
|
@@ -39,7 +39,7 @@ Description-Content-Type: text/markdown
|
|
|
39
39
|
|
|
40
40
|
Streamdown works with any streaming markdown such as [simonw's llm](https://github.com/simonw/llm) or even something basic like curl.
|
|
41
41
|
|
|
42
|
-
It
|
|
42
|
+
It's designed for compatibility with the wide variety of markdown from various LLM models.
|
|
43
43
|
|
|
44
44
|
It supports standard piping and files as arguments like any normal pager but can also run as a wrapper so you retain full keyboard interactivity. Arrow keys, control, alt, all still work.
|
|
45
45
|
```bash
|
|
@@ -97,7 +97,7 @@ It is designed for AI and can be used to do parser based sophisticated pipelines
|
|
|
97
97
|
You can also just use it like a normal person.
|
|
98
98
|
## Configuration
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
The location it's stored is platform specific and can be seen with the `-h` flag. If this file does not exist upon first run, it will be created with default values.
|
|
101
101
|
|
|
102
102
|
Here are the sections:
|
|
103
103
|
|
|
@@ -138,7 +138,7 @@ Controls optional features:
|
|
|
138
138
|
* `CodeSpaces` (boolean, default: `true`): Enables detection of code blocks indented with 4 spaces. Set to `false` to disable this detection method (triple-backtick blocks still work).
|
|
139
139
|
* `Clipboard` (boolean, default: `true`): Enables copying the last code block encountered to the system clipboard using OSC 52 escape sequences upon exit. Set to `false` to disable.
|
|
140
140
|
* `Logging` (boolean, default: `false`): Enables logging to tmpdir (/tmp/sd) of the raw markdown for debugging and bug reporting. The logging uses an emoji as a record separator so the actual streaming delays can be simulated and replayed. If you use the `filename` based invocation, that is to say, `sd <filename>`, this type of logging is always off.
|
|
141
|
-
* `Savebrace` (boolean, default: `true`): Saves the code blocks of a conversation to the append file
|
|
141
|
+
* `Savebrace` (boolean, default: `true`): Saves the code blocks of a conversation to the append file `$TMP/sd/$UID/savebrace` so you can `fzf` or whatever you want through it. See how it's used in DAY50's [sidechat](https://github.com/day50-dev/sidechat).
|
|
142
142
|
|
|
143
143
|
Example:
|
|
144
144
|
```toml
|
|
@@ -154,7 +154,7 @@ The most exciting feature here is `--exec` with it you can do full readline supp
|
|
|
154
154
|
$ sd --exec "llm chat"
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
-
And now you have all your readline stuff. It's pretty great. (Also see the
|
|
157
|
+
And now you have all your readline stuff. It's pretty great. (Also see the DAY50 shellwrap project.)
|
|
158
158
|
|
|
159
159
|
It's also worth noting that things like the `-c` aren't "broken" with regard to file input. You can do something like this:
|
|
160
160
|
|
|
@@ -168,7 +168,12 @@ To override the margin.
|
|
|
168
168
|
usage: sd [-h] [-l LOGLEVEL] [-b BASE] [-c CONFIG] [-w WIDTH] [-e EXEC]
|
|
169
169
|
[-s SCRAPE] [filenameList ...]
|
|
170
170
|
|
|
171
|
-
Streamdown
|
|
171
|
+
Streamdown is a streaming markdown renderer for modern terminals.
|
|
172
|
+
https://github.com/day50-dev/Streamdown
|
|
173
|
+
|
|
174
|
+
paths:
|
|
175
|
+
config /home/chris/.config/streamdown/config.toml
|
|
176
|
+
logs /tmp/sd/1000
|
|
172
177
|
|
|
173
178
|
positional arguments:
|
|
174
179
|
filenameList Input file to process (also takes stdin)
|
|
@@ -185,8 +190,11 @@ optional arguments:
|
|
|
185
190
|
-e EXEC, --exec EXEC Wrap a program EXEC for more 'proper' i/o handling
|
|
186
191
|
-s SCRAPE, --scrape SCRAPE
|
|
187
192
|
Scrape code snippets to a directory SCRAPE
|
|
193
|
+
-v, --version Show version information
|
|
188
194
|
```
|
|
189
195
|
|
|
196
|
+
**Note**: Some features are not supported on some OSs. Please file a ticket if you need a feature on your platform that isn't working.
|
|
197
|
+
|
|
190
198
|
## Demo
|
|
191
199
|
Do this
|
|
192
200
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
streamdown/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
streamdown/qwen3.md,sha256=1e7ELkK-quwUeOmBDwXodFH-DlnfAcQWj32rjK6Zex4,542
|
|
3
|
+
streamdown/sd.py,sha256=jdMBN1iQ-L-t4h2yjETGS97s-6e50BEFv4C14ToS5AM,44961
|
|
4
|
+
streamdown/ss,sha256=sel_phpaecrw6WGIHRLROsD7BFShf0rSDHheflwdUn8,277
|
|
5
|
+
streamdown/ss1,sha256=CUVf86_2zeAle2oQCeTfWYqtHBrAFR_UgvptuYMQzFU,3151
|
|
6
|
+
streamdown/plugins/README.md,sha256=KWqYELs9WkKJmuDzYv3cvPlZMkArsNCBUe4XDoTLjLA,1143
|
|
7
|
+
streamdown/plugins/latex.py,sha256=xZMGMdx_Sw4X1piZejXFHfEG9qazU4fGeceiMI0h13Y,648
|
|
8
|
+
streamdown-0.33.0.dist-info/METADATA,sha256=Xq6ccpX4MUuXKwXOAVWV09WXuqYdEpTj52-QRVQZB9E,10216
|
|
9
|
+
streamdown-0.33.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
10
|
+
streamdown-0.33.0.dist-info/entry_points.txt,sha256=HroKFsFMGf_h9PRTE96NjvjJQWupMW5TGP5RGUr1O_Q,74
|
|
11
|
+
streamdown-0.33.0.dist-info/licenses/LICENSE.MIT,sha256=SnY46EPirUsF20dZDR8HpyVgS2_4Tjxuc6f-4OdqO7U,1070
|
|
12
|
+
streamdown-0.33.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
streamdown/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
streamdown/sd.py,sha256=HE5ajd-afganv6xGuZv6RsCpYgaxY7qk9qB-BAM7nxQ,44599
|
|
3
|
-
streamdown/plugins/README.md,sha256=KWqYELs9WkKJmuDzYv3cvPlZMkArsNCBUe4XDoTLjLA,1143
|
|
4
|
-
streamdown/plugins/latex.py,sha256=xZMGMdx_Sw4X1piZejXFHfEG9qazU4fGeceiMI0h13Y,648
|
|
5
|
-
streamdown-0.31.0.dist-info/METADATA,sha256=tIowHrsBcZyoMCExO0OW61iTEQmQTKEt_FSn6FrMEZQ,9892
|
|
6
|
-
streamdown-0.31.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
streamdown-0.31.0.dist-info/entry_points.txt,sha256=HroKFsFMGf_h9PRTE96NjvjJQWupMW5TGP5RGUr1O_Q,74
|
|
8
|
-
streamdown-0.31.0.dist-info/licenses/LICENSE.MIT,sha256=SnY46EPirUsF20dZDR8HpyVgS2_4Tjxuc6f-4OdqO7U,1070
|
|
9
|
-
streamdown-0.31.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|