Skip to content

Commit 01fc1b6

Browse files
jnsdlsclaude
andauthored
refactor: rename to zero-server on PyPI and in code (#10)
## Summary PyPI refuses `zero-python` as too similar to [`zeropython`](https://pypi.org/project/zeropython/), because it ignores separators when comparing names. The package becomes `zero-server`, after `@rocicorp/zero/server`, which it ports. The repo keeps its name until it goes public. ```diff -pip install "zero-python[sqlalchemy,starlette]" +pip install "zero-server[sqlalchemy,starlette]" -from zero_python import define_queries +from zero_server import define_queries -zero-python codegen schema.json -o zero_schema.py +zero-server codegen schema.json -o zero_schema.py -ZERO_PYTHON_PG=... +ZERO_SERVER_PG=... ``` `src/zero_python/` moves to `src/zero_server/`. Links to `github.com/agent-labs-dev/zero-python` are unchanged. `docs/plan.md` records the new naming decision. Stacked on #9. ## Evidence - **Before:** PyPI's pending-publisher form rejects `zero-python` with "This project name is too similar to an existing project". **After:** `zero-server` and `zeroserver` return 404 on PyPI. Locally: `ruff check`, `ruff format --check` and `ty check` pass, and `pytest` reports 175 passed with 100% coverage. CI runs e2e. ## Merge Danger **Door:** two-way Nothing has been published under either name, so no installed users break. **Blast Radius:** imports Every import path changes. That only matters for code outside this repo, and none exists yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/agent-labs-dev/codesmith/zero-python/pr/10?autoLogin=true&ref=codesmith_pr_footer"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v3.svg"><img alt="View with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v3.svg"></picture></a> <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1794674793&installation_model_id=434381&pr_number=10&ref=codesmith_pr_footer&repository=agent-labs-dev%2Fzero-python&return_to=https%3A%2F%2Fgithub.com%2Fagent-labs-dev%2Fzero-python%2Fpull%2F10&signature=0c85f9ce15a269a835d662bca19845516f5b4204486eae91ae25174eb0f4328e"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 3301f05 commit 01fc1b6

80 files changed

Lines changed: 278 additions & 277 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/ISSUE_TEMPLATE/bug.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Bug
2-
description: zero-python fails, or behaves differently from @rocicorp/zero/server.
2+
description: zero-server fails, or behaves differently from @rocicorp/zero/server.
33
labels: [bug]
44
body:
55
- type: textarea
@@ -18,8 +18,8 @@ body:
1818
id: versions
1919
attributes:
2020
label: Versions
21-
description: zero-python, @rocicorp/zero, Python.
22-
placeholder: zero-python 0.0.1, @rocicorp/zero 1.10.0, Python 3.12.8
21+
description: zero-server, @rocicorp/zero, Python.
22+
placeholder: zero-server 0.0.1, @rocicorp/zero 1.10.0, Python 3.12.8
2323
validations:
2424
required: true
2525
- type: dropdown

‎.github/ISSUE_TEMPLATE/feature.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Missing feature
2-
description: Something @rocicorp/zero/server does that zero-python doesn't.
2+
description: Something @rocicorp/zero/server does that zero-server doesn't.
33
labels: [enhancement]
44
body:
55
- type: textarea

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
options: >-
2121
--health-cmd pg_isready --health-interval 2s --health-timeout 5s --health-retries 30
2222
env:
23-
ZERO_PYTHON_PG: postgresql://postgres:postgres@localhost:5432
23+
ZERO_SERVER_PG: postgresql://postgres:postgres@localhost:5432
2424
steps:
2525
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2626
with:

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: git merge-base --is-ancestor "$GITHUB_SHA" origin/main
3434
- run: uv build
3535
# Import the wheel alone, outside the checkout, so a file missing from it fails here and not for users.
36-
- run: uv run --isolated --no-project --with dist/*.whl python -c "import zero_python"
36+
- run: uv run --isolated --no-project --with dist/*.whl python -c "import zero_server"
3737
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
3838
with:
3939
name: dist

‎AGENTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AGENTS.md
22

3-
zero-python is a community Python port of Rocicorp Zero's **server SDK**: what `@rocicorp/zero/server` gives a
3+
zero-server is a community Python port of Rocicorp Zero's **server SDK**: what `@rocicorp/zero/server` gives a
44
TypeScript backend. It is not affiliated with Rocicorp; say so wherever the project describes itself.
55

66
Before any porting work, read [`docs/plan.md`](docs/plan.md): scope, the oracle that defines "compatible", the

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

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.
44

55
## Setup
66

@@ -12,7 +12,7 @@ uv sync --group e2e
1212
(cd e2e && npm ci)
1313
```
1414

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`.
1616

1717
## Checks
1818

‎README.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# zero-python
1+
# zero-server
22

33
A community Python server SDK for [Zero](https://zero.rocicorp.dev/). It is not affiliated with or endorsed by Rocicorp.
44

@@ -9,7 +9,7 @@ Compatibility is pinned to one Zero release at a time. This version is tested ag
99
## Usage
1010

1111
```sh
12-
pip install "zero-python[sqlalchemy,starlette]" # or [asyncpg], or [psycopg]
12+
pip install "zero-server[sqlalchemy,starlette]" # or [asyncpg], or [psycopg]
1313
```
1414

1515
The schema stays in your TypeScript `schema.ts`, because the client needs it. Emit it as JSON, and generate Python types from it:
@@ -22,7 +22,7 @@ process.stdout.write(JSON.stringify(schema));
2222

2323
```sh
2424
node emit-schema.ts > schema.json
25-
zero-python codegen schema.json -o zero_schema.py
25+
zero-server codegen schema.json -o zero_schema.py
2626
```
2727

2828
`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
3535
from starlette.applications import Starlette
3636
from zero_schema import Project, create_builder, mutate
3737

38-
from zero_python import ApplicationError, define_mutator, define_mutators, define_queries, define_query, load_schema
39-
from zero_python.integrations.starlette import zero_routes
40-
from zero_python.server.adapters.sqlalchemy import SQLAlchemyDatabase
38+
from zero_server import ApplicationError, define_mutator, define_mutators, define_queries, define_query, load_schema
39+
from zero_server.integrations.starlette import zero_routes
40+
from zero_server.server.adapters.sqlalchemy import SQLAlchemyDatabase
4141

4242
schema = load_schema(Path("schema.json"))
4343
zql = create_builder(schema)
@@ -74,9 +74,9 @@ app = Starlette(
7474
)
7575
```
7676

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_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.
7878

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.
8080
- **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.
8181
- **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.
8282

@@ -90,12 +90,12 @@ The published npm package is the definition of correct. Every test diffs Python
9090
The wire and SQL tiers run against every adapter.
9191
- **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`.
9292

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`.
9494

9595
## Known differences
9696

9797
- **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`.
9999

100100
## License
101101

‎docs/plan.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ Read it at the tag matching `ZERO_VERSION`.
8787

8888
## Decisions already made
8989

90-
- Name `zero-python` everywhere (repo, PyPI, import `zero_python`). `zero-py` is blocked on PyPI as too
91-
similar to the abandoned `zeropy`.
90+
- Name `zero-server` on PyPI and in code (import `zero_server`, CLI `zero-server`). PyPI refuses `zero-python` as
91+
too similar to `zeropython` and `zero-py` as too similar to the abandoned `zeropy`. The repo stays `zero-python`
92+
until it goes public.
9293
- Repo private until phase 5 passes; then public, then contact Rocicorp about a community listing and early
9394
notice of protocol changes.
9495
- PyPI publishing by trusted publishing from `.github/workflows/release.yml`, environment `pypi`. The pending

‎e2e/package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎e2e/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "zero-python-e2e",
2+
"name": "zero-server-e2e",
33
"private": true,
44
"type": "module",
55
"dependencies": {

0 commit comments

Comments
 (0)