pgdesign 0.1.2__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.
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgdesign
3
+ Version: 0.1.2
4
+ Summary: PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/pgdesign
7
+ Project-URL: Repository, https://github.com/smm-h/pgdesign
8
+ Keywords: rlsbl
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # pgdesign
13
+
14
+ PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations.
15
+
16
+ This is a thin wrapper that downloads the pgdesign binary for your platform.
17
+
18
+ See https://github.com/smm-h/pgdesign for full documentation.
@@ -0,0 +1,7 @@
1
+ # pgdesign
2
+
3
+ PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations.
4
+
5
+ This is a thin wrapper that downloads the pgdesign binary for your platform.
6
+
7
+ See https://github.com/smm-h/pgdesign for full documentation.
@@ -0,0 +1,103 @@
1
+ """Thin PyPI wrapper that lazy-downloads the pgdesign Go binary on first invocation."""
2
+
3
+ import os
4
+ import platform
5
+ import stat
6
+ import subprocess
7
+ import sys
8
+ import tarfile
9
+ import zipfile
10
+
11
+ VERSION = "0.1.0"
12
+
13
+ _BIN_DIR = os.path.join(os.path.dirname(__file__), "_bin")
14
+
15
+
16
+ def main():
17
+ binary = _ensure_binary()
18
+ result = subprocess.run([binary] + sys.argv[1:])
19
+ sys.exit(result.returncode)
20
+
21
+
22
+ def _ensure_binary():
23
+ name = "pgdesign.exe" if _detect_os() == "windows" else "pgdesign"
24
+ path = os.path.join(_BIN_DIR, name)
25
+ if not os.path.isfile(path):
26
+ _download_binary(path)
27
+ return path
28
+
29
+
30
+ def _download_binary(dest):
31
+ import urllib.request
32
+ import tempfile
33
+
34
+ os_name = _detect_os()
35
+ arch = _detect_arch()
36
+ ext = "zip" if os_name == "windows" else "tar.gz"
37
+ url = (
38
+ f"https://github.com/smm-h/pgdesign/releases/download/"
39
+ f"v{VERSION}/pgdesign_{VERSION}_{os_name}_{arch}.{ext}"
40
+ )
41
+
42
+ os.makedirs(_BIN_DIR, exist_ok=True)
43
+
44
+ with tempfile.TemporaryDirectory() as tmp:
45
+ archive_path = os.path.join(tmp, f"pgdesign.{ext}")
46
+
47
+ print(f"Downloading pgdesign v{VERSION} for {os_name}/{arch}...")
48
+ urllib.request.urlretrieve(url, archive_path)
49
+
50
+ if ext == "zip":
51
+ with zipfile.ZipFile(archive_path, "r") as zf:
52
+ zf.extractall(tmp)
53
+ else:
54
+ with tarfile.open(archive_path, "r:gz") as tf:
55
+ tf.extractall(tmp)
56
+
57
+ # Find the binary in extracted files
58
+ binary_name = "pgdesign.exe" if os_name == "windows" else "pgdesign"
59
+ extracted = None
60
+ for root, _dirs, files in os.walk(tmp):
61
+ if binary_name in files:
62
+ extracted = os.path.join(root, binary_name)
63
+ break
64
+
65
+ if extracted is None:
66
+ raise RuntimeError(
67
+ f"Could not find {binary_name} in downloaded archive from {url}"
68
+ )
69
+
70
+ # Move binary to cache directory
71
+ with open(extracted, "rb") as src, open(dest, "wb") as dst:
72
+ dst.write(src.read())
73
+
74
+ # Make executable on non-Windows
75
+ if os_name != "windows":
76
+ os.chmod(dest, os.stat(dest).st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
77
+
78
+ print(f"pgdesign v{VERSION} installed to {dest}")
79
+
80
+
81
+ def _detect_os():
82
+ system = platform.system().lower()
83
+ mapping = {
84
+ "linux": "linux",
85
+ "darwin": "darwin",
86
+ "windows": "windows",
87
+ }
88
+ if system not in mapping:
89
+ raise RuntimeError(f"Unsupported operating system: {system}")
90
+ return mapping[system]
91
+
92
+
93
+ def _detect_arch():
94
+ machine = platform.machine().lower()
95
+ mapping = {
96
+ "x86_64": "amd64",
97
+ "amd64": "amd64",
98
+ "aarch64": "arm64",
99
+ "arm64": "arm64",
100
+ }
101
+ if machine not in mapping:
102
+ raise RuntimeError(f"Unsupported architecture: {machine}")
103
+ return mapping[machine]
@@ -0,0 +1,3 @@
1
+ from pgdesign import main
2
+
3
+ main()
@@ -0,0 +1,18 @@
1
+ Metadata-Version: 2.4
2
+ Name: pgdesign
3
+ Version: 0.1.2
4
+ Summary: PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/pgdesign
7
+ Project-URL: Repository, https://github.com/smm-h/pgdesign
8
+ Keywords: rlsbl
9
+ Requires-Python: >=3.8
10
+ Description-Content-Type: text/markdown
11
+
12
+ # pgdesign
13
+
14
+ PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations.
15
+
16
+ This is a thin wrapper that downloads the pgdesign binary for your platform.
17
+
18
+ See https://github.com/smm-h/pgdesign for full documentation.
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ pgdesign/__init__.py
4
+ pgdesign/__main__.py
5
+ pgdesign.egg-info/PKG-INFO
6
+ pgdesign.egg-info/SOURCES.txt
7
+ pgdesign.egg-info/dependency_links.txt
8
+ pgdesign.egg-info/entry_points.txt
9
+ pgdesign.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pgdesign = pgdesign:main
@@ -0,0 +1 @@
1
+ pgdesign
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pgdesign"
7
+ version = "0.1.2"
8
+ description = "PostgreSQL schema compiler with strict enforcement, NF auditing, and declarative migrations"
9
+ license = "MIT"
10
+ requires-python = ">=3.8"
11
+ readme = "README.md"
12
+ keywords = ["rlsbl"]
13
+
14
+ [project.urls]
15
+ Homepage = "https://github.com/smm-h/pgdesign"
16
+ Repository = "https://github.com/smm-h/pgdesign"
17
+
18
+ [project.scripts]
19
+ pgdesign = "pgdesign:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+