pythia-postgres 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 (59) hide show
  1. {pythia_postgres-0.1.0/src/pythia_postgres.egg-info → pythia_postgres-0.1.1}/PKG-INFO +8 -3
  2. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/README.md +6 -1
  3. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/pyproject.toml +2 -2
  4. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/__init__.py +1 -1
  5. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/engine.py +16 -1
  6. pythia_postgres-0.1.1/src/pythia_postgres/queries/server-version.sql +8 -0
  7. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1/src/pythia_postgres.egg-info}/PKG-INFO +8 -3
  8. pythia_postgres-0.1.1/src/pythia_postgres.egg-info/requires.txt +2 -0
  9. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/tests/test_postgres.py +20 -3
  10. pythia_postgres-0.1.0/src/pythia_postgres/queries/server-version.sql +0 -6
  11. pythia_postgres-0.1.0/src/pythia_postgres.egg-info/requires.txt +0 -2
  12. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/LICENSE +0 -0
  13. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/setup.cfg +0 -0
  14. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/__main__.py +0 -0
  15. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/catalog.py +0 -0
  16. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/cli.py +0 -0
  17. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/guard.py +0 -0
  18. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/code-objects.sql +0 -0
  19. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/columns.sql +0 -0
  20. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/comment-current.sql +0 -0
  21. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/current-schema.sql +0 -0
  22. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/dependencies-catalog.sql +0 -0
  23. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/dependents-catalog.sql +0 -0
  24. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/dependents-text.sql +0 -0
  25. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/function-body.sql +0 -0
  26. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/grep.sql +0 -0
  27. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/name-candidates.sql +0 -0
  28. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/object-names.sql +0 -0
  29. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/plpgsql-check-installed.sql +0 -0
  30. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/plpgsql-check.sql +0 -0
  31. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/plpgsql-unchecked.sql +0 -0
  32. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/rehearsal-limits.sql +0 -0
  33. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/resolve.sql +0 -0
  34. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/row-set-count.sql +0 -0
  35. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/row-set-sample.sql +0 -0
  36. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/search-path-catalog.sql +0 -0
  37. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/search-path-first.sql +0 -0
  38. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/sequence-ddl.sql +0 -0
  39. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/session-power.sql +0 -0
  40. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/source.sql +0 -0
  41. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/table-columns.sql +0 -0
  42. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/table-constraints.sql +0 -0
  43. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/table-extras.sql +0 -0
  44. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/queries/table-head.sql +0 -0
  45. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/read.py +0 -0
  46. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/rules.py +0 -0
  47. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-apply/SKILL.md +0 -0
  48. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-apply/reference/refusals.md +0 -0
  49. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-autopilot/SKILL.md +0 -0
  50. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-deploy/SKILL.md +0 -0
  51. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-explore/SKILL.md +0 -0
  52. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-impact/SKILL.md +0 -0
  53. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/pythia-pg-verify/SKILL.md +0 -0
  54. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/skills/using-pythia-pg/SKILL.md +0 -0
  55. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres/write.py +0 -0
  56. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres.egg-info/SOURCES.txt +0 -0
  57. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres.egg-info/dependency_links.txt +0 -0
  58. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres.egg-info/entry_points.txt +0 -0
  59. {pythia_postgres-0.1.0 → pythia_postgres-0.1.1}/src/pythia_postgres.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythia-postgres
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: pythia for PostgreSQL: PL/pgSQL development for AI agents over pythia-core - catalog queries, impact analysis and a snapshot-verified write path.
5
5
  License-Expression: MIT
6
6
  Project-URL: Repository, https://github.com/thaildhe172591/pythia-postgres
@@ -22,7 +22,7 @@ Classifier: Topic :: Software Development
22
22
  Requires-Python: >=3.9
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
- Requires-Dist: pythia-core<0.2,>=0.1.0
25
+ Requires-Dist: pythia-core<0.2,>=0.1.1
26
26
  Requires-Dist: psycopg[binary]>=3.1
27
27
  Dynamic: license-file
28
28
 
@@ -36,7 +36,7 @@ what [pythia](https://github.com/thaildhe172591/pythia) does on Oracle: the
36
36
  agent learns from the live catalog, asks a person before any write, and
37
37
  writes only through a gate that snapshots, verifies and reports honestly.
38
38
 
39
- **Alpha (0.1.0).** It reads everything pythia's Learn movement needs, and
39
+ **Alpha (0.1.1).** It reads everything pythia's Learn movement needs, and
40
40
  it writes through one gate. Every write is rehearsed inside a
41
41
  transaction, shown, approved by the developer — in the agent's chat or at
42
42
  their console — and committed only as approved. `pythia-pg install` wires a project for an
@@ -53,6 +53,11 @@ What each gate stops, and what it does not, is in its
53
53
  | writes: `apply`, `deploy`, `approve` (console, chat, MCP), `journal`, `history`, `policy`, `autopilot`, `lint` |
54
54
  | the harness: `install`, `doctor`, `hook`, `mcp`, `skill lint` |
55
55
 
56
+ PostgreSQL 14 to 18 are tested, each through the whole live check; 14 is
57
+ the floor, and below it `check` says so (nothing is refused).
58
+ `plpgsql_check` is optional: with it, `errors` and every preview check
59
+ PL/pgSQL; without it, they say `NOT VERIFIED`.
60
+
56
61
  ## Install
57
62
 
58
63
  ```bash
@@ -8,7 +8,7 @@ what [pythia](https://github.com/thaildhe172591/pythia) does on Oracle: the
8
8
  agent learns from the live catalog, asks a person before any write, and
9
9
  writes only through a gate that snapshots, verifies and reports honestly.
10
10
 
11
- **Alpha (0.1.0).** It reads everything pythia's Learn movement needs, and
11
+ **Alpha (0.1.1).** It reads everything pythia's Learn movement needs, and
12
12
  it writes through one gate. Every write is rehearsed inside a
13
13
  transaction, shown, approved by the developer — in the agent's chat or at
14
14
  their console — and committed only as approved. `pythia-pg install` wires a project for an
@@ -25,6 +25,11 @@ What each gate stops, and what it does not, is in its
25
25
  | writes: `apply`, `deploy`, `approve` (console, chat, MCP), `journal`, `history`, `policy`, `autopilot`, `lint` |
26
26
  | the harness: `install`, `doctor`, `hook`, `mcp`, `skill lint` |
27
27
 
28
+ PostgreSQL 14 to 18 are tested, each through the whole live check; 14 is
29
+ the floor, and below it `check` says so (nothing is refused).
30
+ `plpgsql_check` is optional: with it, `errors` and every preview check
31
+ PL/pgSQL; without it, they say `NOT VERIFIED`.
32
+
28
33
  ## Install
29
34
 
30
35
  ```bash
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pythia-postgres"
7
- version = "0.1.0"
7
+ version = "0.1.1"
8
8
  description = "pythia for PostgreSQL: PL/pgSQL development for AI agents over pythia-core - catalog queries, impact analysis and a snapshot-verified write path."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -12,7 +12,7 @@ license-files = ["LICENSE"]
12
12
  requires-python = ">=3.9"
13
13
  # pythia-core and the driver, nothing else (tests/test_postgres.py).
14
14
  # psycopg[binary] carries its own libpq, so no client install is needed.
15
- dependencies = ["pythia-core>=0.1.0,<0.2", "psycopg[binary]>=3.1"]
15
+ dependencies = ["pythia-core>=0.1.1,<0.2", "psycopg[binary]>=3.1"]
16
16
  keywords = ["postgresql", "plpgsql", "database", "agent-skills", "sql"]
17
17
  classifiers = [
18
18
  "Development Status :: 3 - Alpha",
@@ -1,5 +1,5 @@
1
1
  """pythia for PostgreSQL: PL/pgSQL development for AI agents, over
2
2
  pythia-core. Alpha — see README.md for what works today."""
3
- __version__ = "0.1.0" # kept equal to pyproject.toml (tests/test_postgres.py)
3
+ __version__ = "0.1.1" # kept equal to pyproject.toml (tests/test_postgres.py)
4
4
 
5
5
  from .engine import PostgresEngine # noqa: E402,F401 — needs __version__ first
@@ -11,6 +11,8 @@ import sys
11
11
  from . import __version__, guard, read, write
12
12
  from .catalog import QUERY_BINDS, QUERY_DIR, q # noqa: F401 — QUERY_* re-exported
13
13
 
14
+ FLOOR = 140000 # PostgreSQL 14, as server_version_num: the oldest CI tests
15
+
14
16
  CONFIG_REL = ".pythia/postgres/connections.json"
15
17
  REQUIRED = ("host", "dbname", "user")
16
18
 
@@ -119,9 +121,22 @@ class PostgresEngine:
119
121
  # --- what check asks --------------------------------------------------------
120
122
 
121
123
  def server_version(self, conn):
122
- version, database = q(conn, "server-version.sql")[1][0]
124
+ version, database, _ = q(conn, "server-version.sql")[1][0]
123
125
  return f"PostgreSQL {version} — database {database}"
124
126
 
127
+ def floor_warning(self, conn):
128
+ """Below PostgreSQL 14, the oldest version CI tests: said by `check`,
129
+ never refused (pythia-core DESIGN.md §8, question 2)."""
130
+ num = int(q(conn, "server-version.sql")[1][0][2])
131
+ if num >= FLOOR:
132
+ return None
133
+ major = num // 10000 if num >= 100000 else f"{num // 10000}.{num // 100 % 100}"
134
+ return (f"PostgreSQL {major} is below pythia-pg's floor, 14: it is not "
135
+ "tested there (CI runs 14 to 18), and the PostgreSQL project no "
136
+ "longer supports it. Most commands may still work; a function "
137
+ "with a BEGIN ATOMIC body, and the dependencies PostgreSQL "
138
+ "records for it, start at 14.")
139
+
125
140
  def current_schema(self, conn):
126
141
  rows = q(conn, "current-schema.sql")[1]
127
142
  return rows[0][0] if rows and rows[0] and rows[0][0] else None
@@ -0,0 +1,8 @@
1
+ -- Purpose: what `check` reports as the server — its version, the
2
+ -- database this session is connected to, and the version as a
3
+ -- number, held against pythia-pg's floor
4
+ -- Binds: none
5
+ -- Returns: VERSION, DATABASE, VERSION_NUM (one row)
6
+ select current_setting('server_version') as version,
7
+ current_database() as database,
8
+ current_setting('server_version_num')::int as version_num
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pythia-postgres
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: pythia for PostgreSQL: PL/pgSQL development for AI agents over pythia-core - catalog queries, impact analysis and a snapshot-verified write path.
5
5
  License-Expression: MIT
6
6
  Project-URL: Repository, https://github.com/thaildhe172591/pythia-postgres
@@ -22,7 +22,7 @@ Classifier: Topic :: Software Development
22
22
  Requires-Python: >=3.9
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
- Requires-Dist: pythia-core<0.2,>=0.1.0
25
+ Requires-Dist: pythia-core<0.2,>=0.1.1
26
26
  Requires-Dist: psycopg[binary]>=3.1
27
27
  Dynamic: license-file
28
28
 
@@ -36,7 +36,7 @@ what [pythia](https://github.com/thaildhe172591/pythia) does on Oracle: the
36
36
  agent learns from the live catalog, asks a person before any write, and
37
37
  writes only through a gate that snapshots, verifies and reports honestly.
38
38
 
39
- **Alpha (0.1.0).** It reads everything pythia's Learn movement needs, and
39
+ **Alpha (0.1.1).** It reads everything pythia's Learn movement needs, and
40
40
  it writes through one gate. Every write is rehearsed inside a
41
41
  transaction, shown, approved by the developer — in the agent's chat or at
42
42
  their console — and committed only as approved. `pythia-pg install` wires a project for an
@@ -53,6 +53,11 @@ What each gate stops, and what it does not, is in its
53
53
  | writes: `apply`, `deploy`, `approve` (console, chat, MCP), `journal`, `history`, `policy`, `autopilot`, `lint` |
54
54
  | the harness: `install`, `doctor`, `hook`, `mcp`, `skill lint` |
55
55
 
56
+ PostgreSQL 14 to 18 are tested, each through the whole live check; 14 is
57
+ the floor, and below it `check` says so (nothing is refused).
58
+ `plpgsql_check` is optional: with it, `errors` and every preview check
59
+ PL/pgSQL; without it, they say `NOT VERIFIED`.
60
+
56
61
  ## Install
57
62
 
58
63
  ```bash
@@ -0,0 +1,2 @@
1
+ pythia-core<0.2,>=0.1.1
2
+ psycopg[binary]>=3.1
@@ -86,8 +86,8 @@ class FakeConn:
86
86
 
87
87
 
88
88
  SCRIPT = {
89
- "current_setting('server_version')": (("version", "database"),
90
- [("16.4", "app")]),
89
+ "current_setting('server_version')": (("version", "database", "version_num"),
90
+ [("16.4", "app", 160004)]),
91
91
  "current_schema()": (("current_schema",), [("app_owner",)]),
92
92
  }
93
93
 
@@ -286,6 +286,7 @@ def test_check_end_to_end():
286
286
  assert code == 0 and doc["ok"] and doc["connection"] == "dev"
287
287
  assert doc["schema"] == "app_owner" and doc["schema_drift"] is False
288
288
  assert {"ITEM": "server", "VALUE": "PostgreSQL 16.4 — database app"} in doc["rows"]
289
+ assert doc["below_floor"] is None
289
290
  assert "-- connection=dev schema=app_owner" in err
290
291
  conn = rec["conns"][0]
291
292
  assert conn.read_only is True and conn.closed is True
@@ -380,6 +381,21 @@ def resolving(*objs):
380
381
  return answer
381
382
 
382
383
 
384
+ def test_check_warns_below_postgresql_14_and_refuses_nothing():
385
+ e = PostgresEngine()
386
+
387
+ def server(version, num):
388
+ return CatalogConn({"server-version.sql": (
389
+ ("version", "database", "version_num"), [(version, "app", num)])})
390
+ old = e.floor_warning(server("13.23", 130023))
391
+ assert old.startswith("PostgreSQL 13 is below pythia-pg's floor, 14"), old
392
+ assert "CI runs 14 to 18" in old
393
+ assert e.floor_warning(server("9.6.24", 90624)).startswith("PostgreSQL 9.6 is below")
394
+ assert e.floor_warning(server("14.0", 140000)) is None
395
+ assert e.floor_warning(server("18.1", 180001)) is None
396
+ assert e.server_version(server("16.4", 160004)) == "PostgreSQL 16.4 — database app"
397
+
398
+
383
399
  def test_fold_is_postgres_identifier_folding():
384
400
  assert fold("T_Order") == "t_order"
385
401
  assert fold('"T_Order"') == "T_Order"
@@ -1027,7 +1043,8 @@ def test_the_release_workflow_checks_the_tag_against_the_version():
1027
1043
 
1028
1044
  def test_it_asks_for_the_core_of_its_release_series():
1029
1045
  # 0.x: a minor version of pythia-core may change the engine contract
1030
- assert '"pythia-core>=0.1.0,<0.2"' in pyproject()
1046
+ assert re.search(r'"pythia-core>=0\.1\.\d+,<0\.2"', pyproject()), \
1047
+ "pythia-core is asked for outside its 0.1 series"
1031
1048
 
1032
1049
 
1033
1050
  def readme_shape(text):
@@ -1,6 +0,0 @@
1
- -- Purpose: what `check` reports as the server — its version, and the
2
- -- database this session is connected to
3
- -- Binds: none
4
- -- Returns: VERSION, DATABASE (one row)
5
- select current_setting('server_version') as version,
6
- current_database() as database
@@ -1,2 +0,0 @@
1
- pythia-core<0.2,>=0.1.0
2
- psycopg[binary]>=3.1
File without changes