periplus-python-sdk 0.5.0__py3-none-any.whl → 0.6.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: periplus-python-sdk
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Read-only Python client for the public Periplus query API
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Repository, https://github.com/elei-io/periplus
@@ -11,10 +11,8 @@ License-File: LICENSE
11
11
  License-File: NOTICE
12
12
  Requires-Dist: httpx>=0.28
13
13
  Requires-Dist: pydantic<3,>=2.12
14
- Provides-Extra: sqlalchemy
15
- Requires-Dist: sqlalchemy<3,>=2.0; extra == "sqlalchemy"
14
+ Requires-Dist: sqlalchemy<3,>=2.0
16
15
  Provides-Extra: notebook
17
- Requires-Dist: sqlalchemy<3,>=2.0; extra == "notebook"
18
16
  Requires-Dist: marimo[sql]>=0.24.1; extra == "notebook"
19
17
  Dynamic: license-file
20
18
 
@@ -45,18 +43,15 @@ The client reuses HTTP connections; close it with a context manager or `close()`
45
43
  Install the notebook integration from PyPI:
46
44
 
47
45
  ```sh
48
- uv add "periplus-python-sdk[notebook]>=0.5.0"
46
+ uv add "periplus-python-sdk[notebook]>=0.6.0"
49
47
  ```
50
48
 
51
49
  In a Python setup cell, create a SQLAlchemy engine:
52
50
 
53
51
  ```python
54
- from sqlalchemy import create_engine
52
+ from periplus_sdk import sql_api
55
53
 
56
- pp = create_engine(
57
- "periplus:///public_v1",
58
- connect_args={"base_url": "https://periplus.dev", "mode": "stable"},
59
- )
54
+ pp = sql_api.create_engine("https://periplus.dev", mode="stable")
60
55
  ```
61
56
 
62
57
  Add a SQL cell, select **pp** in its connection dropdown, and enter:
@@ -86,16 +81,18 @@ captures = mo.sql(
86
81
  )
87
82
  ```
88
83
 
89
- Set `mode="experimental"` in `connect_args` for the experimental service. The URL
90
- path names the public schema; the HTTPS endpoint belongs in `base_url` (or set
91
- `PERIPLUS_PUBLIC_URL`). Run `pp.dispose()` when finished. This is a read-only
84
+ Set `mode="experimental"` for the experimental service. Omit the URL to use
85
+ `PERIPLUS_PUBLIC_URL`. Optional `timeout=140` and `schema_version="public_v1"`
86
+ arguments configure the client deadline and public schema. Run `pp.dispose()` when finished. This is a read-only
92
87
  SQLAlchemy dialect for textual SQL and reflection, not a writable ORM backend.
93
88
  Each statement has its own server snapshot; SQLAlchemy transaction blocks do not
94
89
  provide a shared snapshot or rollback. The adapter makes no transaction requests.
95
90
 
96
91
  A complete notebook is in `examples/notebook.py`. The integration is tested with
97
- marimo 0.24.1 and SQLAlchemy 2.x. For SQLAlchemy without marimo, install the
98
- `sqlalchemy` extra instead of `notebook`.
92
+ marimo 0.24.1 and SQLAlchemy 2.x. SQLAlchemy is included in the standard SDK install; the `notebook` extra adds
93
+ marimo. Existing marimo environments only need `uv add "periplus-python-sdk>=0.6.0"`.
94
+ The returned object is a standard SQLAlchemy Engine, also usable with pandas and
95
+ ordinary Python scripts. Engine creation is lazy; the first query opens a connection.
99
96
 
100
97
  ## DB-API connection
101
98
 
@@ -199,10 +196,10 @@ Use `aclose()` when managing an async client's lifetime explicitly.
199
196
  Install the public-v1 client from PyPI:
200
197
 
201
198
  ```sh
202
- python -m pip install "periplus-python-sdk>=0.5.0"
199
+ python -m pip install "periplus-python-sdk>=0.6.0"
203
200
  ```
204
201
 
205
- Version 0.5.0 supports the current public-v1 contract. For production, configure
202
+ Version 0.6.0 supports the current public-v1 contract. For production, configure
206
203
  `PERIPLUS_PUBLIC_URL=https://periplus.dev`; no API token is required.
207
204
  Run the installed package against an available public app:
208
205
 
@@ -214,11 +211,11 @@ PERIPLUS_PUBLIC_URL=http://localhost:8080 python packages/periplus-python-sdk/ex
214
211
 
215
212
  Repository CI publishes immutable releases from tags named
216
213
  `periplus-python-sdk-v<version>`. The tag must exactly match the static version
217
- in `pyproject.toml`; for example, version `0.5.0` is released with:
214
+ in `pyproject.toml`; for example, version `0.6.0` is released with:
218
215
 
219
216
  ```sh
220
- git tag periplus-python-sdk-v0.5.0
221
- git push origin periplus-python-sdk-v0.5.0
217
+ git tag periplus-python-sdk-v0.6.0
218
+ git push origin periplus-python-sdk-v0.6.0
222
219
  ```
223
220
 
224
221
  PyPI publishing uses Trusted Publishing rather than a stored API token. The
@@ -228,7 +225,7 @@ that GitHub environment with required reviewers before the first release.
228
225
 
229
226
  ## Public v1
230
227
 
231
- Install the updated SDK from PyPI with `python -m pip install "periplus-python-sdk>=0.5.0"`. The previously published 0.2.0 release predates this contract. `prepare` and `execute` accept keyword-only `schema_version="public_v1"` (the default); responses preserve `schema_version` separately from `source_snapshot`. Unavailable versions are rejected by the server.
228
+ Install the updated SDK from PyPI with `python -m pip install "periplus-python-sdk>=0.6.0"`. The previously published 0.2.0 release predates this contract. `prepare` and `execute` accept keyword-only `schema_version="public_v1"` (the default); responses preserve `schema_version` separately from `source_snapshot`. Unavailable versions are rejected by the server.
232
229
 
233
230
  ## License
234
231
 
@@ -1,14 +1,15 @@
1
- periplus_python_sdk-0.5.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
2
- periplus_python_sdk-0.5.0.dist-info/licenses/NOTICE,sha256=bhbYSqcUB3U_P1-XzloiT81JGniqoYaRLxNkQ1Pm9MQ,52
1
+ periplus_python_sdk-0.6.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
2
+ periplus_python_sdk-0.6.0.dist-info/licenses/NOTICE,sha256=bhbYSqcUB3U_P1-XzloiT81JGniqoYaRLxNkQ1Pm9MQ,52
3
3
  periplus_sdk/__init__.py,sha256=WimXYlPB6tCimBO4VSwhcp00dwSL87jMmMuQ4-kINfM,546
4
4
  periplus_sdk/client.py,sha256=ZwMmVJKNF-FrGh_qwiQ5myhu8XJodb_96ohkqK47yDA,6557
5
5
  periplus_sdk/dbapi.py,sha256=lK9ZROaMKXm26wvC7DCKywm3qwSvqeHa7zkktnJVP80,11244
6
6
  periplus_sdk/errors.py,sha256=rB1n-v8Hc2tu2dtHivz-MlqsCoRC5pTcWogTfM7SMLw,855
7
7
  periplus_sdk/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
+ periplus_sdk/sql_api.py,sha256=iBJt6hK_m84bDMBRZUDNwz20gi07gAxqWpm-NWWsqSo,850
8
9
  periplus_sdk/sqlalchemy.py,sha256=axFpEMnMP9uSxbsxzVNSUHNh41q2NruSX8W_5E8F59Q,4877
9
10
  periplus_sdk/types.py,sha256=PTdJO6BYTY97dBd3HMEZ52k6P9s0cMvidjpnc8zUpy4,1045
10
- periplus_python_sdk-0.5.0.dist-info/METADATA,sha256=-3wrgS0gK18Kf6UGV9jrVu2rhm2K51q6ScgZUyiOB7U,10091
11
- periplus_python_sdk-0.5.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
12
- periplus_python_sdk-0.5.0.dist-info/entry_points.txt,sha256=Pr14L_7AhLinq-4qDxB4awFVubrvR1BEfkaFVRpdCbU,73
13
- periplus_python_sdk-0.5.0.dist-info/top_level.txt,sha256=o41t5TzwgoxzSmbKoP6olWW1FyEAGWVYTjeoKadBK40,13
14
- periplus_python_sdk-0.5.0.dist-info/RECORD,,
11
+ periplus_python_sdk-0.6.0.dist-info/METADATA,sha256=UBcdaDmCCo0O0ISVlljy947LFFQIawX36y4dOioN4mo,10199
12
+ periplus_python_sdk-0.6.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
13
+ periplus_python_sdk-0.6.0.dist-info/entry_points.txt,sha256=Pr14L_7AhLinq-4qDxB4awFVubrvR1BEfkaFVRpdCbU,73
14
+ periplus_python_sdk-0.6.0.dist-info/top_level.txt,sha256=o41t5TzwgoxzSmbKoP6olWW1FyEAGWVYTjeoKadBK40,13
15
+ periplus_python_sdk-0.6.0.dist-info/RECORD,,
@@ -0,0 +1,25 @@
1
+ """Notebook-friendly SQL engine over the public Periplus query API."""
2
+ from __future__ import annotations
3
+
4
+ from typing import Literal
5
+
6
+ from sqlalchemy import create_engine as _create_engine
7
+ from sqlalchemy.engine import Engine, URL
8
+
9
+
10
+ def create_engine(
11
+ base_url: str | None = None,
12
+ *,
13
+ mode: Literal["stable", "experimental"] = "stable",
14
+ timeout: float = 140,
15
+ schema_version: str = "public_v1",
16
+ ) -> Engine:
17
+ """Create a SQLAlchemy engine recognized by marimo and other SQL tools.
18
+
19
+ The public URL defaults to PERIPLUS_PUBLIC_URL. Connections are opened lazily;
20
+ dispose the engine when finished. Each query uses an independent server snapshot.
21
+ """
22
+ return _create_engine(
23
+ URL.create("periplus", database=schema_version),
24
+ connect_args={"base_url": base_url, "mode": mode, "timeout": timeout},
25
+ )