quickdbd-cli 0.2.3__py3-none-any.whl → 0.2.4__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.
quickdbd_cli/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.3"
1
+ __version__ = "0.2.4"
quickdbd_cli/diff.py CHANGED
@@ -123,7 +123,7 @@ def diff_schemas(old: Schema, new: Schema) -> SchemaDiff:
123
123
 
124
124
  def _git(args: list[str], cwd: Path) -> str:
125
125
  try:
126
- r = subprocess.run(["git", *args], cwd=cwd, capture_output=True, text=True, check=False)
126
+ r = subprocess.run(["git", *args], cwd=cwd, capture_output=True, text=True, encoding="utf-8", check=False)
127
127
  except FileNotFoundError:
128
128
  raise DiffError("git is not installed") from None
129
129
  if r.returncode != 0:
quickdbd_cli/measure.py CHANGED
@@ -9,7 +9,7 @@ from __future__ import annotations
9
9
  import json
10
10
  from functools import cache
11
11
  from importlib import resources
12
- from pathlib import PurePosixPath
12
+ from pathlib import PurePath, PurePosixPath
13
13
 
14
14
  from . import tags
15
15
  from .model import Column, Schema, Table
@@ -33,7 +33,7 @@ STYLE = {
33
33
 
34
34
  @cache
35
35
  def _metrics() -> dict:
36
- return json.loads(resources.files("quickdbd_cli").joinpath("assets/font-metrics.json").read_text())
36
+ return json.loads(resources.files("quickdbd_cli").joinpath("assets/font-metrics.json").read_text(encoding="utf-8"))
37
37
 
38
38
 
39
39
  def text_width(text: str, size: float, bold: bool = False) -> float:
@@ -129,7 +129,7 @@ def model_json(schema: Schema) -> dict:
129
129
  }
130
130
  )
131
131
  tables = [
132
- {**table_json(t), "group": t.group or groups[t.path], "file": t.path, "line": t.line}
132
+ {**table_json(t), "group": t.group or groups[t.path], "file": PurePath(t.path).as_posix(), "line": t.line}
133
133
  for t in schema.tables.values()
134
134
  ]
135
135
  legend = tags.annotate(schema, tables)
quickdbd_cli/serve.py CHANGED
@@ -13,6 +13,7 @@ from __future__ import annotations
13
13
 
14
14
  import errno
15
15
  import json
16
+ import socket
16
17
  import sys
17
18
  import threading
18
19
  import time
@@ -122,7 +123,7 @@ class State:
122
123
  current = str(target.stat().st_mtime_ns)
123
124
  if base_mtime is not None and current != str(base_mtime):
124
125
  return 409, {"error": "changed on disk", "text": target.read_text(encoding="utf-8"), "mtime": current}
125
- target.write_text(text, encoding="utf-8")
126
+ target.write_text(text, encoding="utf-8", newline="") # as sent: no CRLF on Windows
126
127
  return 200, {"mtime": str(target.stat().st_mtime_ns)}
127
128
 
128
129
 
@@ -207,6 +208,16 @@ class PortInUse(OSError):
207
208
  pass
208
209
 
209
210
 
211
+ class _Server(ThreadingHTTPServer):
212
+ # On Windows, SO_REUSEADDR lets a second server bind a port that's already in use; ask for it exclusively.
213
+ allow_reuse_address = sys.platform != "win32"
214
+
215
+ def server_bind(self) -> None:
216
+ if sys.platform == "win32":
217
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
218
+ super().server_bind()
219
+
220
+
210
221
  def make_server(
211
222
  project: Project,
212
223
  port: int = 8765,
@@ -222,7 +233,7 @@ def make_server(
222
233
  server = None
223
234
  for p in range(port, port + max(tries, 1)) if port else [0]:
224
235
  try:
225
- server = ThreadingHTTPServer(("127.0.0.1", p), _handler(state, title))
236
+ server = _Server(("127.0.0.1", p), _handler(state, title))
226
237
  break
227
238
  except OSError as e:
228
239
  if e.errno != errno.EADDRINUSE:
quickdbd_cli/share.py CHANGED
@@ -61,6 +61,7 @@ def _gh(method: str, endpoint: str, payload: dict) -> dict:
61
61
  input=json.dumps(payload),
62
62
  capture_output=True,
63
63
  text=True,
64
+ encoding="utf-8",
64
65
  check=False,
65
66
  )
66
67
  except FileNotFoundError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: quickdbd-cli
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Compile QuickDBD-syntax schema files into interactive HTML ER diagrams, with no table limit.
5
5
  Project-URL: Homepage, https://github.com/MarkPhamm/quickdbd-cli
6
6
  Author: Minh (Mark) Pham
@@ -65,7 +65,7 @@ qdbd is not affiliated with QuickDBD or dbdiagram.io. It reads the same text syn
65
65
  - **dbt import**: `qdbd import dbt` reads `manifest.json`. Primary keys come from `unique` + `not_null` tests or constraints, relationships from `relationships` tests, and `--infer-fks` fills the gaps from column names.
66
66
  - **Readable at 200+ tables**: automatic layout, search, dbt-style selectors (`+orders+1`, `group:marts`, `tag:fact`), shaded regions per file, collapsed views and a minimap.
67
67
  - **Review changes in pull requests**: `qdbd diff` reports what a branch changed, the GitHub Action posts it as a PR comment, and `--diff-base` colours the changes in the diagram.
68
- - **VS Code extension**: highlighting, errors as you type, outline, F12 across files, and the diagram beside the editor, following your cursor. Export, share, compare with git and dbt import from the Command Palette, with no terminal: it installs the CLI itself. Get it from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=MarkPhamm.quickdbd) or, for Cursor, Windsurf and VSCodium, [Open VSX](https://open-vsx.org/extension/MarkPhamm/quickdbd) ([docs](https://qdbd.dev/vscode/)).
68
+ - **VS Code extension**: highlighting, errors as you type, outline, F12 across files, and the diagram beside the editor, following your cursor, or in your browser on localhost. Export, share, compare with git, convert to and from DBML, and dbt import from the sidebar or the Command Palette, with no terminal: it installs the CLI itself. Get it from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=MarkPhamm.quickdbd) or, for Cursor, Windsurf and VSCodium, [Open VSX](https://open-vsx.org/extension/MarkPhamm/quickdbd) ([docs](https://qdbd.dev/vscode/)).
69
69
  - **One schema, many outputs**: an HTML page, PNG, SVG, editable draw.io, or a shareable link. Installs with pip: no Node, Graphviz or browser needed.
70
70
 
71
71
  ## Demo gallery
@@ -1,20 +1,20 @@
1
- quickdbd_cli/__init__.py,sha256=PNiDER4qM19h9zdsdfgKt2_dT4WgYK7EguJ8RU2qA_g,22
1
+ quickdbd_cli/__init__.py,sha256=SBl2EPFW-ltPvQ7vbVWItyAsz3aKYIpjO7vcfr84GkU,22
2
2
  quickdbd_cli/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
3
3
  quickdbd_cli/cli.py,sha256=xqHQMVygTVKzhIOLt_rYTRDLnWCWVVWUpJT5MFtrcJw,25649
4
4
  quickdbd_cli/convert.py,sha256=Fl8ScZtux0SSxg-DOfs_weESQfu0y6AZK11UpA0TyV8,16507
5
5
  quickdbd_cli/dbml.py,sha256=rdEEQqK4QEalX3K_pkqSGIZW5xt7orQjp8g8LQuEBZo,58816
6
6
  quickdbd_cli/dbt.py,sha256=AMHzERmc8WfL1tBLX4bJdPVghIHrqrfx8nMDbZMrueY,23100
7
- quickdbd_cli/diff.py,sha256=d0p6be5VS4IuGB07hyJon9fpUHUktNPW7WShMbW41jI,9237
7
+ quickdbd_cli/diff.py,sha256=1ZsicSuHyCkUdKjtQkAMXmydWFtGXA-LUhHWIAIiXZo,9255
8
8
  quickdbd_cli/export.py,sha256=pjWe3oloaxVkV2b96GllQR4faB9OMtbNuTscxwjQhsk,2983
9
9
  quickdbd_cli/html.py,sha256=fiMsBPkBiCpxz-8x4_SFaeejdnHCAAK0IVlrimbpS5I,7950
10
10
  quickdbd_cli/jsrt.py,sha256=f8JuDhCE0qU5YiO7JkxFVcoGbcSgMZMeUi9C6IlB_8s,2594
11
11
  quickdbd_cli/layout.py,sha256=xoiY7NEtnG6MnKQ6i76CgAD-j0-elKZDimTi8OhnIGo,9914
12
- quickdbd_cli/measure.py,sha256=5rgCq48hifTObwQvPWqqXmoMGHfTT-Nf3cpLvbtK-lk,4342
12
+ quickdbd_cli/measure.py,sha256=d-v_kXtHVQTkcE-lI6zl80hPPMVS_NrDSyvUlxRopJA,4389
13
13
  quickdbd_cli/model.py,sha256=c6vf7bnEswvlLqJrqiwvL3jAmiTAKh0W3PR5HBlxZXI,3276
14
14
  quickdbd_cli/parser.py,sha256=MQDWs4mYIwouM7G__ZJbLZIJvAxgyVwwgvht2GCM7zs,32779
15
15
  quickdbd_cli/project.py,sha256=6yTAwkyhs2q-6J0jZLpQV__B-2IhF_9te4lWZpcej5Q,4441
16
- quickdbd_cli/serve.py,sha256=XWLWw1D7liMmR2CP8UIvpFNmCbrsfCI6fWJuYeF1I68,11840
17
- quickdbd_cli/share.py,sha256=mv586ysLo12z8rKFrvfHeYfvXpuCH0kJ1pp8b8ndYIc,3810
16
+ quickdbd_cli/serve.py,sha256=NqYAcfT4lySRckAG2tkrZwmRbzYDjdNh18Yh4Er_hPo,12271
17
+ quickdbd_cli/share.py,sha256=42VOsau_Ek3rDriakuAxt8pDenimEMrfbGgSNe74GV8,3840
18
18
  quickdbd_cli/tags.py,sha256=dXWATK6z1eeuwZmp9AoXuS3deTAuLwHxzd_FGnGKZ-I,3372
19
19
  quickdbd_cli/assets/Inter-Bold.ttf,sha256=KIMWCZseCkekcW0VkJgAXu98AGaSHzTjIAOT29sBlH8,420428
20
20
  quickdbd_cli/assets/Inter-Bold.woff2,sha256=-oiBJ7baAVtlVp8DUfO1w5GtkokElR8cIOn4RiqNleo,114840
@@ -28,11 +28,11 @@ quickdbd_cli/assets/font-metrics.json,sha256=sXSiElxQSK8md8IEePLwh16TTdAqKt9rV14
28
28
  quickdbd_cli/assets/render.js,sha256=6x8DzTBCmI2Rj5klcCNCpsZOkGoQp7fhtQ16oauqEOY,26184
29
29
  quickdbd_cli/assets/style.css,sha256=HDF9tWXoQ0DRhSCiSmMDaXysK0Wd0VWW4_iwKgQdLFg,16185
30
30
  quickdbd_cli/assets/viewer.js,sha256=wqNg2XK6cqDSAcVv8HsZN3UjaITWKMW3ADAgwCtKFVE,39236
31
- quickdbd_cli-0.2.3.dist-info/METADATA,sha256=ajRQhvA0drpEm1Cs1PZvpHV5hr8n8JEjpEXgRqA5jho,13895
32
- quickdbd_cli-0.2.3.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
33
- quickdbd_cli-0.2.3.dist-info/entry_points.txt,sha256=nRhiYYug-XOY95nWUmi4oanico3Zjkfqk2OHtIE6SQ0,47
34
- quickdbd_cli-0.2.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
35
- quickdbd_cli-0.2.3.dist-info/licenses/NOTICE,sha256=pyv3BfIYiGzKLU4w-GcBe7GXoXxHqZ97Mf6Zpx_3_i0,2067
36
- quickdbd_cli-0.2.3.dist-info/licenses/src/quickdbd_cli/assets/Inter-LICENSE.txt,sha256=JiSB6ERSGzJvXs0FPlm5jIstp4yO4b27boF0MF5Uk1o,4380
37
- quickdbd_cli-0.2.3.dist-info/licenses/src/quickdbd_cli/assets/elk-LICENSE.md,sha256=Y36B9KG2tAeVNcSZ_KBeI4z3YFwf9bdtYNfafOlnAMk,14443
38
- quickdbd_cli-0.2.3.dist-info/RECORD,,
31
+ quickdbd_cli-0.2.4.dist-info/METADATA,sha256=ipZWasxKE7kvvRSdzD4zBD0_rN_hmmvuBThPD8qn3cA,13970
32
+ quickdbd_cli-0.2.4.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
33
+ quickdbd_cli-0.2.4.dist-info/entry_points.txt,sha256=nRhiYYug-XOY95nWUmi4oanico3Zjkfqk2OHtIE6SQ0,47
34
+ quickdbd_cli-0.2.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
35
+ quickdbd_cli-0.2.4.dist-info/licenses/NOTICE,sha256=pyv3BfIYiGzKLU4w-GcBe7GXoXxHqZ97Mf6Zpx_3_i0,2067
36
+ quickdbd_cli-0.2.4.dist-info/licenses/src/quickdbd_cli/assets/Inter-LICENSE.txt,sha256=JiSB6ERSGzJvXs0FPlm5jIstp4yO4b27boF0MF5Uk1o,4380
37
+ quickdbd_cli-0.2.4.dist-info/licenses/src/quickdbd_cli/assets/elk-LICENSE.md,sha256=Y36B9KG2tAeVNcSZ_KBeI4z3YFwf9bdtYNfafOlnAMk,14443
38
+ quickdbd_cli-0.2.4.dist-info/RECORD,,