Skip to main content

pythia-core

English · Tiếng Việt

The part of pythia that is the same for every database. Engine packages build on it: pythia-postgres, pythia-mssql, pythia-mongo and pythia-mysql.

Alpha (0.1.1). What is here today:

  • the engine contract and its conformance check;
  • per-engine connection resolution;
  • the query-contract lint;
  • the commands every engine's command line inherits:
    • version, connections and check (which says when the server is older than the engine's floor);
    • the read commands ls, src, cols, ddl, grep, deps, impact and errors, windowed and never truncated silently;
    • the write gate: apply (snapshot, rehearse inside a transaction and roll back — or, for what cannot be rehearsed, predict, then write once and check what landed — preview), approve (the developer: at a console, or from chat through AskUserQuestion and approve --hook, or the MCP approver mcp), apply --confirm (commits only what was approved), policy, journal list | show | restore and history;
    • deploy <files>: a release rehearsed and committed as one transaction, under one approval — all of it lands, or none of it;
    • autopilot request | on | off | status | report: a lease the developer approves once, covering only the connection, groups and limits its card names;
    • lint <files> (and lint --rules): the engine's rules and the team's severities and naming patterns over a change, shown in every preview;
    • the harness: hook pre-tool (the guard that denies the ways around the gate and waves through what cannot write), hook session-start (the rules and the project's state), install (connections scaffold, .gitignore, hooks, the MCP approver in this machine's own files, instruction blocks, skills — a second run changes nothing), doctor and skill lint.

What each gate stops, and what it does not, is in SECURITY.md. The plan, and how each idea maps to each database, is in DESIGN.md.

pythia for Oracle is a separate, self-contained tool. It does not use this package and is not changed by it.

Install

pip install pythia-core

pythia-core alone has no command: install an engine package — pythia-postgres, pythia-mssql or pythia-mongo — and it comes with it. It depends on nothing outside the Python standard library, by contract. The development version is the main branch:

pip install "git+https://github.com/thaildhe172591/pythia-core"

Writing an engine

from pythia_core import cli
from pythia_core.engine import engine_problems

class PostgresEngine:
    name, label, command = "postgres", "PostgreSQL", "pythia-pg"
    env_prefix, version, bind_style = "PYTHIA_PG", "0.1.0", "pyformat"
    # ...the connect tier: driver_errors, connect, session, close,
    # connect_failure, schema_of, target_of, server_version, current_schema
    # ...the read tier: object_names, source, columns (which may name a
    # blind spot, when its columns are inferred), ddl, grep, dependencies,
    # dependents, compile_errors
    # ...and the write tier: classify, prepare_statement, parse_object,
    # destructive_reason, dml_probe, measure_row_set, snapshot, rehearse,
    # restore_statement, privilege_warning
    # ...the predict tier, for statements that cannot be rehearsed:
    # execute, verify_written
    # ...the harness tier: raw_client_pattern, write_sql_pattern,
    # script_pattern, connections_template, skills_dir
    # ...the release tier: split_script
    # ...and the lint tier: lint_rules

assert engine_problems(PostgresEngine(),
                       ("connect", "read", "write", "harness", "release",
                        "lint")) == []

def main(argv=None):
    return cli.main(PostgresEngine(), argv)          # your console script

Each engine keeps its connections in .pythia/<engine>/connections.json. That is never pythia for Oracle's .pythia/connections.json, so one project can use both safely.

Tests (no database, no driver)

python tests/test_core.py
python tests/test_cli.py
python tests/test_read.py
python tests/test_gate.py
python tests/test_harness.py
python tests/test_doors.py
python tests/test_release.py
python tests/test_lease.py
python tests/test_lint.py
python tests/test_family.py     # several engines in one project, with two fakes

CI runs them on Ubuntu, Windows and macOS, Python 3.9 and 3.13. Its family job also installs pythia for Oracle and the four engines into one project and runs tests/family_check.py: every install keeps the others' hooks and blocks, a second run changes nothing, each doctor passes, each guard and answer hook acts for its own engine only.

License

MIT

Metadata

Release files for pythia-core 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pythia-core 0.1.1
File Size Uploaded Provenance Actions
pythia_core-0.1.1.tar.gz 105.5 kB With provenance Details for pythia_core-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pythia-core 0.1.1
File Interpreter ABI Platform Actions
pythia_core-0.1.1-py3-none-any.whl Python 3 none any Details for pythia_core-0.1.1-py3-none-any.whl

Total release size: 183.5 kB

Release files / pythia_core-0.1.1.tar.gz

Download URL pythia_core-0.1.1.tar.gz
Size 105.5 kB
Tags Source
SHA-256 checksum
How to use checksums
650fc81a2ce657f38c12338cf7a8b6e449b6f94bc835affc95e8c04445e4e98d
BLAKE2b-256 checksum
How to use checksums
ce5ed95ed3b635c2de08a83b065d15801cf861bc67552291a0ecfd5bfce50a86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / pythia_core-0.1.1-py3-none-any.whl

Download URL pythia_core-0.1.1-py3-none-any.whl
Size 78.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a43ec9b84f6359156cc4592fa04f89db54a2bef87774b59f6493bf95ab3d50c0
BLAKE2b-256 checksum
How to use checksums
f9ad967cff8b1d6d512f296d79d6ec242f4771611d60509e52abe968d7f6f307
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for pythia-core 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pythia_core-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page