erdscope 0.3.0__tar.gz → 0.4.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.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: erdscope
3
- Version: 0.3.0
4
- Summary: Interactive, self-contained ER-diagram HTML and Excel table definitions from a live MySQL or PostgreSQL database — single file, zero required dependencies
3
+ Version: 0.4.0
4
+ Summary: Interactive, self-contained ER-diagram HTML and Excel table definitions from a MySQL, PostgreSQL, or SQLite database and/or application code (Rails / Prisma / Django) — single file, zero required dependencies
5
5
  Author: tas6
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/orapli/erdscope
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://orapli.github.io/erdscope/manual.html
9
9
  Project-URL: Live demo, https://orapli.github.io/erdscope/
10
10
  Project-URL: Repository, https://github.com/orapli/erdscope
11
11
  Project-URL: Issues, https://github.com/orapli/erdscope/issues
12
- Keywords: erd,er-diagram,database,schema,mysql,rails,prisma,django,documentation
12
+ Keywords: erd,er-diagram,database,schema,mysql,postgresql,postgres,sqlite,rails,prisma,django,documentation
13
13
  Classifier: Development Status :: 4 - Beta
14
14
  Classifier: Environment :: Console
15
15
  Classifier: Intended Audience :: Developers
@@ -43,6 +43,8 @@ zero-dependency Python CLI.
43
43
 
44
44
  ```bash
45
45
  pip install erdscope
46
+ erdscope demo # no database of your own? try it right now — opens a sample diagram
47
+
46
48
  erdscope mysql://readonly@127.0.0.1:3306/myapp_production -o erd.html
47
49
  erdscope postgres://readonly@127.0.0.1:5432/myapp_production -o erd.html
48
50
  erdscope sqlite:///path/to/app.db -o erd.html
@@ -87,6 +89,18 @@ curl -O https://raw.githubusercontent.com/orapli/erdscope/main/erd.py
87
89
  python3 erd.py ... # identical to the erdscope command below
88
90
  ```
89
91
 
92
+ No database of your own to point it at yet? `erdscope demo` builds a small sample
93
+ e-commerce SQLite database in a temp directory, generates the diagram, and opens it in
94
+ your browser — nothing to download or set up:
95
+
96
+ ```bash
97
+ erdscope demo
98
+ ```
99
+
100
+ It's a normal run under the hood, so every other flag still applies
101
+ (`erdscope demo --excel defs.xlsx`, `erdscope demo --only 'order*'`, ...); add
102
+ `--no-open` to skip launching the browser.
103
+
90
104
  ```bash
91
105
  erdscope mysql://readonly@127.0.0.1:3306/myapp_production -o erd.html
92
106
 
@@ -114,9 +128,10 @@ erdscope --config schema.yml -o erd.html
114
128
  erdscope --models /path/to/rails/app --models /path/to/schema.prisma -o erd.html
115
129
  ```
116
130
 
117
- Want to try it right now with no database of your own? A ready-to-run SQLite
118
- sample ships in [`examples/`](examples/) `python3 erd.py
119
- sqlite:///examples/demo_shop.db -o shop.html`. See [examples/README.md](examples/README.md).
131
+ Cloned the repository instead of installing from PyPI? A ready-to-run SQLite sample
132
+ (the same schema `erdscope demo` uses) also ships committed in
133
+ [`examples/`](examples/) — `python3 erd.py sqlite:///examples/demo_shop.db -o shop.html`.
134
+ See [examples/README.md](examples/README.md).
120
135
 
121
136
  Behind a bastion? Open an SSH tunnel first and point at localhost:
122
137
 
@@ -134,7 +149,8 @@ itself is made.
134
149
 
135
150
  | Option | Description |
136
151
  |---|---|
137
- | `-o FILE` | Output HTML path (default: `erd.html`) |
152
+ | `demo` | Positional value: generate from a bundled sample database instead of a real one — no database of your own needed. Every other flag below still applies |
153
+ | `-o FILE` | Output HTML path (default: `erd.html`; `erd_demo.html` for `demo`, so it never overwrites a real run's output) |
138
154
  | `--models PATH` | Merge associations parsed from code: a Rails project (or `app/models` dir), a `schema.prisma`, or a Django project — auto-detected. **Repeatable** — multiple sources merge in the order given (later wins). Usable with no database URL |
139
155
  | `--excel FILE.xlsx` | Also write a table-definition workbook: an overview sheet plus one sheet per table (columns, defaults, keys, comments, indexes, associations) |
140
156
  | `--excel-template FILE.xlsx` | Override the workbook's colors/fonts/borders from a template `.xlsx` — see `excel-template.xlsx` and its `Styles` sheet for the 5-cell contract (default: built-in styling) |
@@ -145,6 +161,7 @@ itself is made.
145
161
  | `--table-map 'Widget=crm_widgets'` | Rails only: override a model's table when static analysis can't determine it (e.g. `table_name` set inside a concern that lives in a gem, not the app). Repeatable; comma-separated lists accepted |
146
162
  | `--config PATH` | Load defaults from a config file instead of repeating flags — see below. Auto-discovered as `.erdscope.json`/`.yml`/`.yaml` in the current directory if not given |
147
163
  | `--no-config` | Skip config auto-discovery even if `.erdscope.*` exists in the cwd |
164
+ | `--no-open` | Skip automatically opening a browser after generating. Only relevant to `demo` (which opens one by default); accepted but has no effect on a normal run |
148
165
 
149
166
  ## Config file
150
167
 
@@ -153,7 +170,8 @@ Once the flag list above gets long, put it in a config file instead — `.erdsco
153
170
  Most keys mirror a CLI option (an explicit flag always wins over the config); the DB
154
171
  connection is config-only as `engine`/`host`/`port`/`user`/`database` — deliberately with
155
172
  no password field — and `relations` manually declares relations no FK, code, or inference
156
- can find. See the [Config file chapter of the manual](https://orapli.github.io/erdscope/manual.html#config-file) for the full key
173
+ can find. `engine` can also be `"sqlite"`, in which case `database` is a local file path
174
+ (not a database name) and `host`/`port`/`user` don't apply. See the [Config file chapter of the manual](https://orapli.github.io/erdscope/manual.html#config-file) for the full key
157
175
  list and semantics, and [`erdscope.example.yml`](erdscope.example.yml) for a fully
158
176
  annotated sample based on the live demo's schema.
159
177
 
@@ -275,6 +293,45 @@ pip install playwright && playwright install chromium
275
293
  python3 -m unittest tests.test_e2e -v
276
294
  ```
277
295
 
296
+ ## Performance
297
+
298
+ Measured against synthetic SQLite schemas (`benchmarks/gen_schema.py`, ~2 FK edges per
299
+ table) at three sizes:
300
+
301
+ | Tables | Edges | CLI gen (median) | HTML size | Initial paint (median) | Re-layout (median) | Python RSS | JS heap |
302
+ |---|---|---|---|---|---|---|---|
303
+ | 100 | 190 | 0.05 s | 292 KB | 91 ms | 37 ms | 37 MB | 2.0 MB |
304
+ | 300 | 592 | 0.06 s | 533 KB | 206 ms | 131 ms | 42 MB | 1.9 MB |
305
+ | 1,000 | 2,015 | 0.11 s | 1.35 MB | 1.18 s | 1.04 s | 59 MB | 3.2 MB |
306
+
307
+ Notes: measured in a sandboxed Linux environment against headless Chromium
308
+ (Playwright), not dedicated hardware — treat these as relative/order-of-magnitude
309
+ numbers rather than absolute guarantees for your machine. "CLI gen" and the browser
310
+ timings are each the median of 3 runs; Python RSS/JS heap are single best-effort
311
+ samples. Generation itself (`erd.py sqlite:///... -o out.html`) stays fast at every
312
+ size tested — SQLite parsing isn't the bottleneck.
313
+
314
+ **Recommendation:** the constraint at scale is the browser-side interactive
315
+ re-layout, not generation. Linear interpolation between the 300- and 1,000-table
316
+ measurements above puts the 1-second crossing at roughly 970 tables; we round that
317
+ down to **~900 tables** as a deliberately conservative rule of thumb, since these
318
+ are single-environment numbers (initial paint itself stays comfortably under 3
319
+ seconds through 1,000 tables). Past that rough threshold, narrow the diagram with
320
+ `--only`/`--exclude` instead of
321
+ rendering the whole schema at once — see the [manual's Large
322
+ schemas section](https://orapli.github.io/erdscope/manual.html#large-schemas) for
323
+ details.
324
+
325
+ Reproduce or re-run at other sizes with:
326
+
327
+ ```bash
328
+ python3 benchmarks/gen_schema.py --tables 300 --out /tmp/bench_300.db
329
+ python3 benchmarks/run_bench.py --tables 100,300,1000 # generates, benchmarks, prints JSON + a summary table
330
+ ```
331
+
332
+ `run_bench.py` is a manual script (not part of the `unittest` suite) — see its
333
+ docstring for the full methodology and the Playwright venv it expects.
334
+
278
335
  ## Extending
279
336
 
280
337
  Everything downstream (UI, layouts, exports) consumes the intermediate representation
@@ -1,37 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: erdscope
3
- Version: 0.3.0
4
- Summary: Interactive, self-contained ER-diagram HTML and Excel table definitions from a live MySQL or PostgreSQL database — single file, zero required dependencies
5
- Author: tas6
6
- License-Expression: MIT
7
- Project-URL: Homepage, https://github.com/orapli/erdscope
8
- Project-URL: Documentation, https://orapli.github.io/erdscope/manual.html
9
- Project-URL: Live demo, https://orapli.github.io/erdscope/
10
- Project-URL: Repository, https://github.com/orapli/erdscope
11
- Project-URL: Issues, https://github.com/orapli/erdscope/issues
12
- Keywords: erd,er-diagram,database,schema,mysql,rails,prisma,django,documentation
13
- Classifier: Development Status :: 4 - Beta
14
- Classifier: Environment :: Console
15
- Classifier: Intended Audience :: Developers
16
- Classifier: Programming Language :: Python :: 3
17
- Classifier: Topic :: Database
18
- Classifier: Topic :: Documentation
19
- Classifier: Topic :: Software Development :: Documentation
20
- Requires-Python: >=3.9
21
- Description-Content-Type: text/markdown
22
- License-File: LICENSE
23
- Provides-Extra: mysql
24
- Requires-Dist: PyMySQL; extra == "mysql"
25
- Provides-Extra: postgres
26
- Requires-Dist: psycopg[binary]; extra == "postgres"
27
- Provides-Extra: yaml
28
- Requires-Dist: PyYAML; extra == "yaml"
29
- Provides-Extra: all
30
- Requires-Dist: PyMySQL; extra == "all"
31
- Requires-Dist: psycopg[binary]; extra == "all"
32
- Requires-Dist: PyYAML; extra == "all"
33
- Dynamic: license-file
34
-
35
1
  # erdscope
36
2
 
37
3
  [![CI](https://github.com/orapli/erdscope/actions/workflows/ci.yml/badge.svg)](https://github.com/orapli/erdscope/actions/workflows/ci.yml)
@@ -43,6 +9,8 @@ zero-dependency Python CLI.
43
9
 
44
10
  ```bash
45
11
  pip install erdscope
12
+ erdscope demo # no database of your own? try it right now — opens a sample diagram
13
+
46
14
  erdscope mysql://readonly@127.0.0.1:3306/myapp_production -o erd.html
47
15
  erdscope postgres://readonly@127.0.0.1:5432/myapp_production -o erd.html
48
16
  erdscope sqlite:///path/to/app.db -o erd.html
@@ -87,6 +55,18 @@ curl -O https://raw.githubusercontent.com/orapli/erdscope/main/erd.py
87
55
  python3 erd.py ... # identical to the erdscope command below
88
56
  ```
89
57
 
58
+ No database of your own to point it at yet? `erdscope demo` builds a small sample
59
+ e-commerce SQLite database in a temp directory, generates the diagram, and opens it in
60
+ your browser — nothing to download or set up:
61
+
62
+ ```bash
63
+ erdscope demo
64
+ ```
65
+
66
+ It's a normal run under the hood, so every other flag still applies
67
+ (`erdscope demo --excel defs.xlsx`, `erdscope demo --only 'order*'`, ...); add
68
+ `--no-open` to skip launching the browser.
69
+
90
70
  ```bash
91
71
  erdscope mysql://readonly@127.0.0.1:3306/myapp_production -o erd.html
92
72
 
@@ -114,9 +94,10 @@ erdscope --config schema.yml -o erd.html
114
94
  erdscope --models /path/to/rails/app --models /path/to/schema.prisma -o erd.html
115
95
  ```
116
96
 
117
- Want to try it right now with no database of your own? A ready-to-run SQLite
118
- sample ships in [`examples/`](examples/) `python3 erd.py
119
- sqlite:///examples/demo_shop.db -o shop.html`. See [examples/README.md](examples/README.md).
97
+ Cloned the repository instead of installing from PyPI? A ready-to-run SQLite sample
98
+ (the same schema `erdscope demo` uses) also ships committed in
99
+ [`examples/`](examples/) — `python3 erd.py sqlite:///examples/demo_shop.db -o shop.html`.
100
+ See [examples/README.md](examples/README.md).
120
101
 
121
102
  Behind a bastion? Open an SSH tunnel first and point at localhost:
122
103
 
@@ -134,7 +115,8 @@ itself is made.
134
115
 
135
116
  | Option | Description |
136
117
  |---|---|
137
- | `-o FILE` | Output HTML path (default: `erd.html`) |
118
+ | `demo` | Positional value: generate from a bundled sample database instead of a real one — no database of your own needed. Every other flag below still applies |
119
+ | `-o FILE` | Output HTML path (default: `erd.html`; `erd_demo.html` for `demo`, so it never overwrites a real run's output) |
138
120
  | `--models PATH` | Merge associations parsed from code: a Rails project (or `app/models` dir), a `schema.prisma`, or a Django project — auto-detected. **Repeatable** — multiple sources merge in the order given (later wins). Usable with no database URL |
139
121
  | `--excel FILE.xlsx` | Also write a table-definition workbook: an overview sheet plus one sheet per table (columns, defaults, keys, comments, indexes, associations) |
140
122
  | `--excel-template FILE.xlsx` | Override the workbook's colors/fonts/borders from a template `.xlsx` — see `excel-template.xlsx` and its `Styles` sheet for the 5-cell contract (default: built-in styling) |
@@ -145,6 +127,7 @@ itself is made.
145
127
  | `--table-map 'Widget=crm_widgets'` | Rails only: override a model's table when static analysis can't determine it (e.g. `table_name` set inside a concern that lives in a gem, not the app). Repeatable; comma-separated lists accepted |
146
128
  | `--config PATH` | Load defaults from a config file instead of repeating flags — see below. Auto-discovered as `.erdscope.json`/`.yml`/`.yaml` in the current directory if not given |
147
129
  | `--no-config` | Skip config auto-discovery even if `.erdscope.*` exists in the cwd |
130
+ | `--no-open` | Skip automatically opening a browser after generating. Only relevant to `demo` (which opens one by default); accepted but has no effect on a normal run |
148
131
 
149
132
  ## Config file
150
133
 
@@ -153,7 +136,8 @@ Once the flag list above gets long, put it in a config file instead — `.erdsco
153
136
  Most keys mirror a CLI option (an explicit flag always wins over the config); the DB
154
137
  connection is config-only as `engine`/`host`/`port`/`user`/`database` — deliberately with
155
138
  no password field — and `relations` manually declares relations no FK, code, or inference
156
- can find. See the [Config file chapter of the manual](https://orapli.github.io/erdscope/manual.html#config-file) for the full key
139
+ can find. `engine` can also be `"sqlite"`, in which case `database` is a local file path
140
+ (not a database name) and `host`/`port`/`user` don't apply. See the [Config file chapter of the manual](https://orapli.github.io/erdscope/manual.html#config-file) for the full key
157
141
  list and semantics, and [`erdscope.example.yml`](erdscope.example.yml) for a fully
158
142
  annotated sample based on the live demo's schema.
159
143
 
@@ -275,6 +259,45 @@ pip install playwright && playwright install chromium
275
259
  python3 -m unittest tests.test_e2e -v
276
260
  ```
277
261
 
262
+ ## Performance
263
+
264
+ Measured against synthetic SQLite schemas (`benchmarks/gen_schema.py`, ~2 FK edges per
265
+ table) at three sizes:
266
+
267
+ | Tables | Edges | CLI gen (median) | HTML size | Initial paint (median) | Re-layout (median) | Python RSS | JS heap |
268
+ |---|---|---|---|---|---|---|---|
269
+ | 100 | 190 | 0.05 s | 292 KB | 91 ms | 37 ms | 37 MB | 2.0 MB |
270
+ | 300 | 592 | 0.06 s | 533 KB | 206 ms | 131 ms | 42 MB | 1.9 MB |
271
+ | 1,000 | 2,015 | 0.11 s | 1.35 MB | 1.18 s | 1.04 s | 59 MB | 3.2 MB |
272
+
273
+ Notes: measured in a sandboxed Linux environment against headless Chromium
274
+ (Playwright), not dedicated hardware — treat these as relative/order-of-magnitude
275
+ numbers rather than absolute guarantees for your machine. "CLI gen" and the browser
276
+ timings are each the median of 3 runs; Python RSS/JS heap are single best-effort
277
+ samples. Generation itself (`erd.py sqlite:///... -o out.html`) stays fast at every
278
+ size tested — SQLite parsing isn't the bottleneck.
279
+
280
+ **Recommendation:** the constraint at scale is the browser-side interactive
281
+ re-layout, not generation. Linear interpolation between the 300- and 1,000-table
282
+ measurements above puts the 1-second crossing at roughly 970 tables; we round that
283
+ down to **~900 tables** as a deliberately conservative rule of thumb, since these
284
+ are single-environment numbers (initial paint itself stays comfortably under 3
285
+ seconds through 1,000 tables). Past that rough threshold, narrow the diagram with
286
+ `--only`/`--exclude` instead of
287
+ rendering the whole schema at once — see the [manual's Large
288
+ schemas section](https://orapli.github.io/erdscope/manual.html#large-schemas) for
289
+ details.
290
+
291
+ Reproduce or re-run at other sizes with:
292
+
293
+ ```bash
294
+ python3 benchmarks/gen_schema.py --tables 300 --out /tmp/bench_300.db
295
+ python3 benchmarks/run_bench.py --tables 100,300,1000 # generates, benchmarks, prints JSON + a summary table
296
+ ```
297
+
298
+ `run_bench.py` is a manual script (not part of the `unittest` suite) — see its
299
+ docstring for the full methodology and the Playwright venv it expects.
300
+
278
301
  ## Extending
279
302
 
280
303
  Everything downstream (UI, layouts, exports) consumes the intermediate representation