scripttrace 0.1.0__tar.gz → 0.1.1__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.
Files changed (25) hide show
  1. scripttrace-0.1.1/PKG-INFO +233 -0
  2. scripttrace-0.1.1/README.md +208 -0
  3. {scripttrace-0.1.0 → scripttrace-0.1.1}/pyproject.toml +4 -2
  4. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/__init__.py +1 -1
  5. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/server.py +1 -1
  6. scripttrace-0.1.1/src/scripttrace.egg-info/PKG-INFO +233 -0
  7. scripttrace-0.1.0/PKG-INFO +0 -323
  8. scripttrace-0.1.0/README.md +0 -300
  9. scripttrace-0.1.0/src/scripttrace.egg-info/PKG-INFO +0 -323
  10. {scripttrace-0.1.0 → scripttrace-0.1.1}/LICENSE +0 -0
  11. {scripttrace-0.1.0 → scripttrace-0.1.1}/setup.cfg +0 -0
  12. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/__main__.py +0 -0
  13. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/cli.py +0 -0
  14. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/diff.py +0 -0
  15. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/parse.py +0 -0
  16. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/static/app.js +0 -0
  17. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/static/index.html +0 -0
  18. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/static/styles.css +0 -0
  19. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace/store.py +0 -0
  20. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace.egg-info/SOURCES.txt +0 -0
  21. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace.egg-info/dependency_links.txt +0 -0
  22. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace.egg-info/entry_points.txt +0 -0
  23. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace.egg-info/requires.txt +0 -0
  24. {scripttrace-0.1.0 → scripttrace-0.1.1}/src/scripttrace.egg-info/top_level.txt +0 -0
  25. {scripttrace-0.1.0 → scripttrace-0.1.1}/tests/test_scripttrace.py +0 -0
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.4
2
+ Name: scripttrace
3
+ Version: 0.1.1
4
+ Summary: Local screenplay labeling: upload Markdown/Word, side-by-side edit with change traces, export JSON.
5
+ Author: yundong Wu
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/windowssr/scripttrace
8
+ Project-URL: Repository, https://github.com/windowssr/scripttrace
9
+ Project-URL: Issues, https://github.com/windowssr/scripttrace/issues
10
+ Keywords: screenplay,annotation,diff,sft,labeling
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Environment :: Web Environment
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: fastapi>=0.110
19
+ Requires-Dist: uvicorn[standard]>=0.27
20
+ Requires-Dist: python-docx>=1.1
21
+ Requires-Dist: python-multipart>=0.0.9
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=8; extra == "dev"
24
+ Dynamic: license-file
25
+
26
+ # scripttrace
27
+
28
+ [English](README.md) | [中文](README.zh-CN.md)
29
+
30
+ Local screenplay labeling tool. Import Markdown, plain text, or Word; keep the original on the left and rewrite lines on the right. Deletions are marked red, insertions green. Each line can take a “why this change” note and a 1–5 score. Export full JSON or SFT training data.
31
+
32
+ Everything runs on your machine. **Nothing is uploaded to the cloud.** Projects are stored under `~/.scripttrace/projects/` by default.
33
+
34
+ Author: yundong Wu · Package: [PyPI](https://pypi.org/project/scripttrace/) · Source: [GitHub](https://github.com/windowssr/scripttrace)
35
+
36
+ Requires **Python 3.10+** and a modern browser (Chrome / Edge / Firefox). The app UI is currently Chinese.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install scripttrace
42
+ scripttrace serve
43
+ ```
44
+
45
+ Open the URL printed in the terminal (default [http://127.0.0.1:8765](http://127.0.0.1:8765)).
46
+
47
+ Upgrade:
48
+
49
+ ```bash
50
+ pip install -U scripttrace
51
+ ```
52
+
53
+ With Conda:
54
+
55
+ ```bash
56
+ conda create -n scripttrace python=3.11 -y
57
+ conda activate scripttrace
58
+ pip install scripttrace
59
+ ```
60
+
61
+ ## Run
62
+
63
+ ```bash
64
+ scripttrace serve
65
+ ```
66
+
67
+ Change port or data directory:
68
+
69
+ ```bash
70
+ scripttrace serve --port 9000
71
+ scripttrace serve -p 9000 --data-dir D:\labels
72
+ scripttrace serve --host 0.0.0.0 --port 9000
73
+ ```
74
+
75
+ `--host 0.0.0.0` allows LAN access. Use that only on a trusted network.
76
+
77
+ ```bash
78
+ scripttrace --help
79
+ scripttrace serve --help
80
+ ```
81
+
82
+ | Flag | Environment variable | Default | Meaning |
83
+ |------|----------------------|---------|---------|
84
+ | `--host` | `SCRIPTTRACE_HOST` | `127.0.0.1` | Bind address |
85
+ | `-p` / `--port` | `SCRIPTTRACE_PORT` | `8765` | Port (1–65535) |
86
+ | `--data-dir` | `SCRIPTTRACE_HOME` | `~/.scripttrace/projects` | Project data directory |
87
+
88
+ ## Usage
89
+
90
+ 1. Import a screenplay on the left (`.md` / `.txt` / `.docx`; `.fountain` may work). The project name defaults to the filename; you can rename or delete projects in the list.
91
+ 2. Three columns:
92
+ - **Original**: read-only, never overwritten. Deleted text is red.
93
+ - **Revised**: edit dialogue here. Inserted text is green.
94
+ - **Notes / score**: explain why it changed; 1–5 stars (click again to clear).
95
+ 3. Search, filter All / Changed / Unchanged, show annotated only, and jump with Prev / Next.
96
+ 4. Edits auto-save after about a second. You can also click Save or press `Ctrl+S`.
97
+ 5. **Preview / Export** shows stats and a sample, then download the format you need.
98
+
99
+ The sidebar can collapse (‹ / ☰). That state is remembered.
100
+
101
+ | Shortcut | Action |
102
+ |----------|--------|
103
+ | `Ctrl+S` (`⌘S` on macOS) | Save now |
104
+ | `Ctrl+↓` / `Ctrl+↑` | Next / previous changed line |
105
+ | `Esc` | Close the preview dialog |
106
+
107
+ A short sample lives in [`samples/demo.md`](samples/demo.md).
108
+
109
+ ## Screenplay format
110
+
111
+ The parser splits text into episode / scene / dialogue / action blocks. This shape is recognized most reliably:
112
+
113
+ ```markdown
114
+ # Title
115
+
116
+ ## Episode 3
117
+
118
+ 场景:地下车库 夜
119
+
120
+ **林深**
121
+ 此事我已知晓,你不必再解释。
122
+
123
+ 苏晚:我只是希望你能理解我的难处。
124
+
125
+ △ 车灯扫过水泥柱。
126
+ ```
127
+
128
+ - Episode: `第3集` or `EPISODE 3`
129
+ - Scene: `场景:…` / `場次` / `SCENE`, or `INT.` / `EXT.` / `内景` / `外景`
130
+ - Dialogue: a speaker name on its own line (optionally bold), then the line; or `Speaker: line`
131
+ - Action: a line starting with `△`
132
+
133
+ Text files are decoded as UTF-8 (with or without BOM) or GB18030. Max upload size is 20MB.
134
+
135
+ ## Export formats
136
+
137
+ **Preview / Export** switches among three formats. Preview shows only the first few records; **download is the full file**.
138
+
139
+ ### 1. Full JSON (`*.scripttrace.json`)
140
+
141
+ `schema: scripttrace.v1`. All blocks, character-level `ops`, and an SFT array of changed dialogue. Good for archives and downstream tools.
142
+
143
+ ```json
144
+ {
145
+ "schema": "scripttrace.v1",
146
+ "title": "示例短剧",
147
+ "blocks": [
148
+ {
149
+ "id": "b0007",
150
+ "kind": "dialogue",
151
+ "speaker": "林深",
152
+ "episode": "3",
153
+ "original": "此事我已知晓,你不必再解释。",
154
+ "revised": "我知道了。别解释。",
155
+ "changed": true,
156
+ "note": "太文言,改口语",
157
+ "score": 4,
158
+ "ops": [
159
+ {"op": "delete", "text": "此事我已知晓,你不必再解释。"},
160
+ {"op": "insert", "text": "我知道了。别解释。"}
161
+ ]
162
+ }
163
+ ],
164
+ "sft": [
165
+ {
166
+ "instruction": "Rewrite the lines so they sound like speech. …",
167
+ "input": "第3集 场次 地下车库 角色 林深\n【原文台词】\n此事我已知晓,你不必再解释。",
168
+ "output": "我知道了。别解释。",
169
+ "note": "太文言,改口语",
170
+ "score": 4
171
+ }
172
+ ]
173
+ }
174
+ ```
175
+
176
+ `ops` are character-level traces: `equal` / `delete` / `insert`.
177
+
178
+ ### 2. Change trace (`*.trace.json`)
179
+
180
+ `schema: scripttrace.trace.v1`. **Changed lines only**: `deleted` / `inserted` / `ops`, plus `note` and `score`.
181
+
182
+ ### 3. SFT JSONL (`*.sft.jsonl`)
183
+
184
+ **Changed dialogue only**. One training row per line: `instruction` / `input` / `output`, plus `note` and `score`.
185
+
186
+ Unchanged lines are omitted from the trace and SFT exports.
187
+
188
+ ## Where data lives
189
+
190
+ Each project is a folder under the data directory, with `project.json` and a copy of the imported file. The original text is immutable on the server; saves only write the rewrite, note, and score.
191
+
192
+ On Windows the default looks like:
193
+
194
+ `C:\Users\<you>\.scripttrace\projects\`
195
+
196
+ Copy that folder to back up or move machines. `--data-dir` can point at a drive or share.
197
+
198
+ ## FAQ
199
+
200
+ **`pip` cannot find the package / not the latest version**
201
+ Use Python ≥ 3.10, then `pip install -U scripttrace`. If you have several Pythons, use `python -m pip install scripttrace`.
202
+
203
+ **Page will not load / port in use**
204
+ Try another port: `scripttrace serve -p 9000`.
205
+
206
+ **Code changes do not show up**
207
+ Restart `scripttrace serve` after Python edits. Hard-refresh the page with Ctrl+F5 so old JS/CSS is not cached.
208
+
209
+ **Preview / Export does nothing**
210
+ Confirm the server is still running, then Ctrl+F5. Restart the server after an upgrade.
211
+
212
+ **Word layout looks wrong**
213
+ `.docx` import keeps paragraph text only. Tables and text boxes may be dropped. Prefer `.md` or `.txt` for important scripts.
214
+
215
+ ## Develop from source
216
+
217
+ ```bash
218
+ pip install -e ".[dev]"
219
+ pytest
220
+ ```
221
+
222
+ Code is under `src/scripttrace/`; the UI is under `src/scripttrace/static/`. An editable install picks up Python changes, but you still need to restart the server.
223
+
224
+ To publish a new version, bump `version` in `pyproject.toml` (e.g. `0.1.1`; a version can be uploaded only once), then:
225
+
226
+ ```bash
227
+ python -m build
228
+ twine upload dist/*
229
+ ```
230
+
231
+ ## License
232
+
233
+ [MIT](LICENSE) © yundong Wu
@@ -0,0 +1,208 @@
1
+ # scripttrace
2
+
3
+ [English](README.md) | [中文](README.zh-CN.md)
4
+
5
+ Local screenplay labeling tool. Import Markdown, plain text, or Word; keep the original on the left and rewrite lines on the right. Deletions are marked red, insertions green. Each line can take a “why this change” note and a 1–5 score. Export full JSON or SFT training data.
6
+
7
+ Everything runs on your machine. **Nothing is uploaded to the cloud.** Projects are stored under `~/.scripttrace/projects/` by default.
8
+
9
+ Author: yundong Wu · Package: [PyPI](https://pypi.org/project/scripttrace/) · Source: [GitHub](https://github.com/windowssr/scripttrace)
10
+
11
+ Requires **Python 3.10+** and a modern browser (Chrome / Edge / Firefox). The app UI is currently Chinese.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ pip install scripttrace
17
+ scripttrace serve
18
+ ```
19
+
20
+ Open the URL printed in the terminal (default [http://127.0.0.1:8765](http://127.0.0.1:8765)).
21
+
22
+ Upgrade:
23
+
24
+ ```bash
25
+ pip install -U scripttrace
26
+ ```
27
+
28
+ With Conda:
29
+
30
+ ```bash
31
+ conda create -n scripttrace python=3.11 -y
32
+ conda activate scripttrace
33
+ pip install scripttrace
34
+ ```
35
+
36
+ ## Run
37
+
38
+ ```bash
39
+ scripttrace serve
40
+ ```
41
+
42
+ Change port or data directory:
43
+
44
+ ```bash
45
+ scripttrace serve --port 9000
46
+ scripttrace serve -p 9000 --data-dir D:\labels
47
+ scripttrace serve --host 0.0.0.0 --port 9000
48
+ ```
49
+
50
+ `--host 0.0.0.0` allows LAN access. Use that only on a trusted network.
51
+
52
+ ```bash
53
+ scripttrace --help
54
+ scripttrace serve --help
55
+ ```
56
+
57
+ | Flag | Environment variable | Default | Meaning |
58
+ |------|----------------------|---------|---------|
59
+ | `--host` | `SCRIPTTRACE_HOST` | `127.0.0.1` | Bind address |
60
+ | `-p` / `--port` | `SCRIPTTRACE_PORT` | `8765` | Port (1–65535) |
61
+ | `--data-dir` | `SCRIPTTRACE_HOME` | `~/.scripttrace/projects` | Project data directory |
62
+
63
+ ## Usage
64
+
65
+ 1. Import a screenplay on the left (`.md` / `.txt` / `.docx`; `.fountain` may work). The project name defaults to the filename; you can rename or delete projects in the list.
66
+ 2. Three columns:
67
+ - **Original**: read-only, never overwritten. Deleted text is red.
68
+ - **Revised**: edit dialogue here. Inserted text is green.
69
+ - **Notes / score**: explain why it changed; 1–5 stars (click again to clear).
70
+ 3. Search, filter All / Changed / Unchanged, show annotated only, and jump with Prev / Next.
71
+ 4. Edits auto-save after about a second. You can also click Save or press `Ctrl+S`.
72
+ 5. **Preview / Export** shows stats and a sample, then download the format you need.
73
+
74
+ The sidebar can collapse (‹ / ☰). That state is remembered.
75
+
76
+ | Shortcut | Action |
77
+ |----------|--------|
78
+ | `Ctrl+S` (`⌘S` on macOS) | Save now |
79
+ | `Ctrl+↓` / `Ctrl+↑` | Next / previous changed line |
80
+ | `Esc` | Close the preview dialog |
81
+
82
+ A short sample lives in [`samples/demo.md`](samples/demo.md).
83
+
84
+ ## Screenplay format
85
+
86
+ The parser splits text into episode / scene / dialogue / action blocks. This shape is recognized most reliably:
87
+
88
+ ```markdown
89
+ # Title
90
+
91
+ ## Episode 3
92
+
93
+ 场景:地下车库 夜
94
+
95
+ **林深**
96
+ 此事我已知晓,你不必再解释。
97
+
98
+ 苏晚:我只是希望你能理解我的难处。
99
+
100
+ △ 车灯扫过水泥柱。
101
+ ```
102
+
103
+ - Episode: `第3集` or `EPISODE 3`
104
+ - Scene: `场景:…` / `場次` / `SCENE`, or `INT.` / `EXT.` / `内景` / `外景`
105
+ - Dialogue: a speaker name on its own line (optionally bold), then the line; or `Speaker: line`
106
+ - Action: a line starting with `△`
107
+
108
+ Text files are decoded as UTF-8 (with or without BOM) or GB18030. Max upload size is 20MB.
109
+
110
+ ## Export formats
111
+
112
+ **Preview / Export** switches among three formats. Preview shows only the first few records; **download is the full file**.
113
+
114
+ ### 1. Full JSON (`*.scripttrace.json`)
115
+
116
+ `schema: scripttrace.v1`. All blocks, character-level `ops`, and an SFT array of changed dialogue. Good for archives and downstream tools.
117
+
118
+ ```json
119
+ {
120
+ "schema": "scripttrace.v1",
121
+ "title": "示例短剧",
122
+ "blocks": [
123
+ {
124
+ "id": "b0007",
125
+ "kind": "dialogue",
126
+ "speaker": "林深",
127
+ "episode": "3",
128
+ "original": "此事我已知晓,你不必再解释。",
129
+ "revised": "我知道了。别解释。",
130
+ "changed": true,
131
+ "note": "太文言,改口语",
132
+ "score": 4,
133
+ "ops": [
134
+ {"op": "delete", "text": "此事我已知晓,你不必再解释。"},
135
+ {"op": "insert", "text": "我知道了。别解释。"}
136
+ ]
137
+ }
138
+ ],
139
+ "sft": [
140
+ {
141
+ "instruction": "Rewrite the lines so they sound like speech. …",
142
+ "input": "第3集 场次 地下车库 角色 林深\n【原文台词】\n此事我已知晓,你不必再解释。",
143
+ "output": "我知道了。别解释。",
144
+ "note": "太文言,改口语",
145
+ "score": 4
146
+ }
147
+ ]
148
+ }
149
+ ```
150
+
151
+ `ops` are character-level traces: `equal` / `delete` / `insert`.
152
+
153
+ ### 2. Change trace (`*.trace.json`)
154
+
155
+ `schema: scripttrace.trace.v1`. **Changed lines only**: `deleted` / `inserted` / `ops`, plus `note` and `score`.
156
+
157
+ ### 3. SFT JSONL (`*.sft.jsonl`)
158
+
159
+ **Changed dialogue only**. One training row per line: `instruction` / `input` / `output`, plus `note` and `score`.
160
+
161
+ Unchanged lines are omitted from the trace and SFT exports.
162
+
163
+ ## Where data lives
164
+
165
+ Each project is a folder under the data directory, with `project.json` and a copy of the imported file. The original text is immutable on the server; saves only write the rewrite, note, and score.
166
+
167
+ On Windows the default looks like:
168
+
169
+ `C:\Users\<you>\.scripttrace\projects\`
170
+
171
+ Copy that folder to back up or move machines. `--data-dir` can point at a drive or share.
172
+
173
+ ## FAQ
174
+
175
+ **`pip` cannot find the package / not the latest version**
176
+ Use Python ≥ 3.10, then `pip install -U scripttrace`. If you have several Pythons, use `python -m pip install scripttrace`.
177
+
178
+ **Page will not load / port in use**
179
+ Try another port: `scripttrace serve -p 9000`.
180
+
181
+ **Code changes do not show up**
182
+ Restart `scripttrace serve` after Python edits. Hard-refresh the page with Ctrl+F5 so old JS/CSS is not cached.
183
+
184
+ **Preview / Export does nothing**
185
+ Confirm the server is still running, then Ctrl+F5. Restart the server after an upgrade.
186
+
187
+ **Word layout looks wrong**
188
+ `.docx` import keeps paragraph text only. Tables and text boxes may be dropped. Prefer `.md` or `.txt` for important scripts.
189
+
190
+ ## Develop from source
191
+
192
+ ```bash
193
+ pip install -e ".[dev]"
194
+ pytest
195
+ ```
196
+
197
+ Code is under `src/scripttrace/`; the UI is under `src/scripttrace/static/`. An editable install picks up Python changes, but you still need to restart the server.
198
+
199
+ To publish a new version, bump `version` in `pyproject.toml` (e.g. `0.1.1`; a version can be uploaded only once), then:
200
+
201
+ ```bash
202
+ python -m build
203
+ twine upload dist/*
204
+ ```
205
+
206
+ ## License
207
+
208
+ [MIT](LICENSE) © yundong Wu
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "scripttrace"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "Local screenplay labeling: upload Markdown/Word, side-by-side edit with change traces, export JSON."
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -31,7 +31,9 @@ dev = ["pytest>=8"]
31
31
  scripttrace = "scripttrace.cli:main"
32
32
 
33
33
  [project.urls]
34
- Homepage = "https://github.com/example/scripttrace"
34
+ Homepage = "https://github.com/windowssr/scripttrace"
35
+ Repository = "https://github.com/windowssr/scripttrace"
36
+ Issues = "https://github.com/windowssr/scripttrace/issues"
35
37
 
36
38
  [tool.setuptools.packages.find]
37
39
  where = ["src"]
@@ -1,3 +1,3 @@
1
1
  """Local screenplay labeling with side-by-side change traces."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
@@ -40,7 +40,7 @@ def attachment_headers(filename: str, fallback: str) -> dict[str, str]:
40
40
  }
41
41
 
42
42
 
43
- app = FastAPI(title="scripttrace", version="0.1.0")
43
+ app = FastAPI(title="scripttrace", version="0.1.1")
44
44
  app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
45
45
 
46
46