backstop 0.1.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.
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: backstop
3
+ Version: 0.1.0
4
+ Summary: Production-grade database safety platform — intercept, snapshot, recover
5
+ Project-URL: Homepage, https://github.com/pratyush2514/Backstop
6
+ Project-URL: Repository, https://github.com/pratyush2514/Backstop.git
7
+ Project-URL: Issues, https://github.com/pratyush2514/Backstop/issues
8
+ Requires-Python: >=3.11
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: sqlglot>=23.0.0
11
+ Requires-Dist: psycopg2-binary>=2.9.0
12
+ Requires-Dist: pyarrow>=14.0.0
13
+ Requires-Dist: boto3>=1.34.0
14
+ Requires-Dist: click>=8.1.0
15
+ Requires-Dist: rich>=13.0.0
16
+ Requires-Dist: pydantic>=2.0.0
17
+ Requires-Dist: python-dotenv>=1.0.0
18
+ Requires-Dist: structlog>=24.0.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
21
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
22
+ Requires-Dist: moto[s3]>=5.0.0; extra == "dev"
23
+
24
+ # Backstop Python Package
25
+
26
+ Backstop provides:
27
+
28
+ - the `backstop` CLI for restore, doctor, drill, backup, PITR, and WAL workflows;
29
+ - a Python SDK for guarded `psycopg2` and SQLAlchemy usage;
30
+ - local-first PostgreSQL safety tooling that works with S3-compatible storage.
31
+
32
+ Project home:
33
+
34
+ - https://github.com/pratyush2514/Backstop
@@ -0,0 +1,11 @@
1
+ # Backstop Python Package
2
+
3
+ Backstop provides:
4
+
5
+ - the `backstop` CLI for restore, doctor, drill, backup, PITR, and WAL workflows;
6
+ - a Python SDK for guarded `psycopg2` and SQLAlchemy usage;
7
+ - local-first PostgreSQL safety tooling that works with S3-compatible storage.
8
+
9
+ Project home:
10
+
11
+ - https://github.com/pratyush2514/Backstop
@@ -0,0 +1,47 @@
1
+ """backstop — production-grade database safety platform.
2
+
3
+ Public API
4
+ ----------
5
+ guard(conn, storage, actor, mode) → GuardedConnection
6
+ Wrap a psycopg2 connection with backstop protection.
7
+
8
+ protect_engine(engine, storage, actor, mode)
9
+ Attach backstop protection to a SQLAlchemy Engine.
10
+
11
+ RiskLevel
12
+ Enum of risk classifications: SAFE, LOW, HIGH, CRITICAL.
13
+
14
+ RiskResult
15
+ Dataclass describing the result of a SQL risk assessment.
16
+
17
+ Example usage::
18
+
19
+ import psycopg2
20
+ import backstop
21
+
22
+ raw_conn = psycopg2.connect(DATABASE_URL)
23
+ db = backstop.guard(
24
+ conn=raw_conn,
25
+ storage="s3://my-bucket@http://localhost:9000",
26
+ actor="gpt-agent-prod",
27
+ mode="protect",
28
+ )
29
+
30
+ # All SQL executed through db.execute() is now intercepted and protected.
31
+ db.execute("DROP TABLE users") # Snapshots users → S3, then drops the table
32
+ db.commit()
33
+ """
34
+
35
+ from .guard import GuardedConnection, GuardedCursor, guard
36
+ from .parser import RiskLevel, RiskResult
37
+ from .sqlalchemy import protect_engine
38
+
39
+ __all__ = [
40
+ "guard",
41
+ "GuardedConnection",
42
+ "GuardedCursor",
43
+ "protect_engine",
44
+ "RiskLevel",
45
+ "RiskResult",
46
+ ]
47
+