You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 01fc1b6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Contributing
2
2
3
-
zero-python is a port, so a change is right when it behaves like `@rocicorp/zero` at the version in `ZERO_VERSION`. Read [`docs/plan.md`](docs/plan.md) before porting anything.
3
+
zero-server is a port, so a change is right when it behaves like `@rocicorp/zero` at the version in `ZERO_VERSION`. Read [`docs/plan.md`](docs/plan.md) before porting anything.
4
4
5
5
## Setup
6
6
@@ -12,7 +12,7 @@ uv sync --group e2e
12
12
(cd e2e && npm ci)
13
13
```
14
14
15
-
The tests start Postgres in Docker. To use your own instead, set `ZERO_PYTHON_PG` to a connection string such as `postgresql://postgres:postgres@localhost:5432`.
15
+
The tests start Postgres in Docker. To use your own instead, set `ZERO_SERVER_PG` to a connection string such as `postgresql://postgres:postgres@localhost:5432`.
`zero_schema.py` has a `TypedDict` per table for a row, an insert, an update and a key, and a builder and `tx.mutate` typed by them. A server then looks like this:
@@ -35,9 +35,9 @@ from sqlalchemy.ext.asyncio import create_async_engine
35
35
from starlette.applications import Starlette
36
36
from zero_schema import Project, create_builder, mutate
Point `ZERO_QUERY_URL` and `ZERO_MUTATE_URL` at `/query` and `/mutate`. With FastAPI, `app.router.routes.extend(zero_routes(...))`. With another framework, call `handle_query_request` and `handle_mutate_request` yourself; `zero_python/integrations/starlette.py` is short enough to copy.
77
+
Point `ZERO_QUERY_URL` and `ZERO_MUTATE_URL` at `/query` and `/mutate`. With FastAPI, `app.router.routes.extend(zero_routes(...))`. With another framework, call `handle_query_request` and `handle_mutate_request` yourself; `zero_server/integrations/starlette.py` is short enough to copy.
78
78
79
-
-**Databases.**`SQLAlchemyDatabase` (SQLAlchemy's asyncio engine on asyncpg), `AsyncpgDatabase` (an asyncpg pool) and `PsycopgDatabase` (a psycopg 3 async pool), under `zero_python.server.adapters`. Another driver plugs into `ZQLDatabase` as a `DBConnection` whose `query` takes `$1` placeholders.
79
+
-**Databases.**`SQLAlchemyDatabase` (SQLAlchemy's asyncio engine on asyncpg), `AsyncpgDatabase` (an asyncpg pool) and `PsycopgDatabase` (a psycopg 3 async pool), under `zero_server.server.adapters`. Another driver plugs into `ZQLDatabase` as a `DBConnection` whose `query` takes `$1` placeholders.
80
80
-**Validation.**`@define_query(Model)` and `@define_mutator(Model)` parse args with a Pydantic model or `TypeAdapter` first; a failure reaches the client as upstream's validation error.
81
81
-**Strict building.**`create_builder(schema, strict=True)` refuses an unknown column when the query is built. Upstream only refuses it when the endpoint maps the query, failing the whole batch, so this is for your tests.
82
82
@@ -90,12 +90,12 @@ The published npm package is the definition of correct. Every test diffs Python
90
90
The wire and SQL tiers run against every adapter.
91
91
-**End to end.**`e2e/run.py` starts Postgres, two `rocicorp/zero` containers at the pinned version, the TypeScript reference app server and the Python one. An unmodified Zero client runs the same script through each, and the run fails if the client ends up with different data, the databases differ, or the reference run strays from `e2e/expected.json`.
92
92
93
-
Run them with `uv run pytest` (needs Node 24 and Docker, or `ZERO_PYTHON_PG` pointing at a Postgres) and `uv run --group e2e python e2e/run.py`.
93
+
Run them with `uv run pytest` (needs Node 24 and Docker, or `ZERO_SERVER_PG` pointing at a Postgres) and `uv run --group e2e python e2e/run.py`.
94
94
95
95
## Known differences
96
96
97
97
-**Parse errors.** When a request is malformed, the message after `Failed to parse push body:` describes the bad field in Pydantic's words, not valita's. The rest of the response matches, and zero-cache only logs it.
98
-
-**Non-string values against text columns.** Upstream passes such a value to the JavaScript driver as is, so the driver decides how it binds. zero-python binds `String(value)`, which is what postgres.js does except for an array whose first element is a boolean, which it binds as `false`.
98
+
-**Non-string values against text columns.** Upstream passes such a value to the JavaScript driver as is, so the driver decides how it binds. zero-server binds `String(value)`, which is what postgres.js does except for an array whose first element is a boolean, which it binds as `false`.
0 commit comments