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

Potentially problematic release.


This version of leangraph might be problematic. Click here for more details.

Files changed (47) hide show
  1. leangraph-0.1.0/.cargo/config.toml +5 -0
  2. leangraph-0.1.0/.gitignore +23 -0
  3. leangraph-0.1.0/CLIENT.md +286 -0
  4. leangraph-0.1.0/Cargo.lock +701 -0
  5. leangraph-0.1.0/Cargo.toml +59 -0
  6. leangraph-0.1.0/LICENSE +21 -0
  7. leangraph-0.1.0/PKG-INFO +557 -0
  8. leangraph-0.1.0/README.md +494 -0
  9. leangraph-0.1.0/pyproject.toml +91 -0
  10. leangraph-0.1.0/python/leangraph/__init__.py +652 -0
  11. leangraph-0.1.0/python/leangraph/server/__init__.py +8 -0
  12. leangraph-0.1.0/python/leangraph/server/_common.py +261 -0
  13. leangraph-0.1.0/python/leangraph/server/_guardrails.py +593 -0
  14. leangraph-0.1.0/python/leangraph/server/cli.py +88 -0
  15. leangraph-0.1.0/python/leangraph/server/client.py +226 -0
  16. leangraph-0.1.0/python/leangraph/server/leangraph.proto +72 -0
  17. leangraph-0.1.0/python/leangraph/server/leangraph_pb2.py +54 -0
  18. leangraph-0.1.0/python/leangraph/server/leangraph_pb2_grpc.py +275 -0
  19. leangraph-0.1.0/python/leangraph/server/serve.py +539 -0
  20. leangraph-0.1.0/python/leangraph/server/serve_grpc.py +406 -0
  21. leangraph-0.1.0/src/cypher/ast.rs +226 -0
  22. leangraph-0.1.0/src/cypher/mod.rs +2 -0
  23. leangraph-0.1.0/src/cypher/parser.rs +1579 -0
  24. leangraph-0.1.0/src/db.rs +1534 -0
  25. leangraph-0.1.0/src/error.rs +75 -0
  26. leangraph-0.1.0/src/exec/agg.rs +292 -0
  27. leangraph-0.1.0/src/exec/batch.rs +178 -0
  28. leangraph-0.1.0/src/exec/copy.rs +1410 -0
  29. leangraph-0.1.0/src/exec/engine.rs +1429 -0
  30. leangraph-0.1.0/src/exec/expr.rs +677 -0
  31. leangraph-0.1.0/src/exec/fastpath.rs +515 -0
  32. leangraph-0.1.0/src/exec/mod.rs +10 -0
  33. leangraph-0.1.0/src/exec/ops.rs +1811 -0
  34. leangraph-0.1.0/src/exec/planner.rs +1969 -0
  35. leangraph-0.1.0/src/exec/pool.rs +75 -0
  36. leangraph-0.1.0/src/exec/scalar.rs +1500 -0
  37. leangraph-0.1.0/src/lib.rs +87 -0
  38. leangraph-0.1.0/src/memguard.rs +399 -0
  39. leangraph-0.1.0/src/py.rs +810 -0
  40. leangraph-0.1.0/src/storage/column.rs +761 -0
  41. leangraph-0.1.0/src/storage/files.rs +812 -0
  42. leangraph-0.1.0/src/storage/mod.rs +4 -0
  43. leangraph-0.1.0/src/storage/state.rs +334 -0
  44. leangraph-0.1.0/src/storage/table.rs +891 -0
  45. leangraph-0.1.0/src/sysutil.rs +405 -0
  46. leangraph-0.1.0/src/types.rs +974 -0
  47. leangraph-0.1.0/src/wal.rs +340 -0
@@ -0,0 +1,5 @@
1
+ # Align loop starts to 32 bytes on x86_64 (same as LeanText): a hot loop of up to 32
2
+ # bytes then never straddles a 64-byte line, so build-to-build layout luck stops
3
+ # moving scan loops by 10-20%.
4
+ [target.'cfg(target_arch = "x86_64")']
5
+ rustflags = ["-C", "llvm-args=-align-loops=32"]
@@ -0,0 +1,23 @@
1
+ # build output
2
+ target/
3
+ dist/
4
+ *.so
5
+ *.pyd
6
+ *.egg-info/
7
+
8
+ # python
9
+ __pycache__/
10
+ *.py[cod]
11
+ .pytest_cache/
12
+ .venv/
13
+ venv/
14
+
15
+ # local databases and benchmark scratch (keep large data under /mnt/dados3)
16
+ *.lgdb/
17
+ bench_data/
18
+ /bench/out/
19
+
20
+ # editors / OS
21
+ .idea/
22
+ .vscode/
23
+ .DS_Store
@@ -0,0 +1,286 @@
1
+ # LeanGraph network servers and clients
2
+
3
+ LeanGraph ships two optional network servers in the wheel, both in the package
4
+ `leangraph.server`. `import leangraph` never loads them.
5
+
6
+ | Server | Install | Command | Default address |
7
+ |---|---|---|---|
8
+ | REST (FastAPI + uvicorn) | `pip install "leangraph[server]"` | `leangraph-serve` | `127.0.0.1:8005` |
9
+ | gRPC | `pip install "leangraph[grpc]"` (Python ≥ 3.10) | `leangraph-grpc` | `127.0.0.1:50055` |
10
+
11
+ Both serve one database directory. They return the same results as the library: the test
12
+ suite checks REST == gRPC == library on the same queries.
13
+
14
+ ```bash
15
+ leangraph-serve --path /data/graph # REST
16
+ leangraph-grpc --path /data/graph --port 50055 # gRPC (one writer process per directory)
17
+ leangraph-serve --path /data/graph --read-only # read-only replica next to a writer
18
+ ```
19
+
20
+ A database directory has one writer process (see the README, *Threads, processes and fork*).
21
+ Run one writer server per directory. Any number of `--read-only` servers can serve it
22
+ alongside.
23
+
24
+ ## Quick start
25
+
26
+ ```python
27
+ from leangraph.server.client import RestClient, GrpcClient
28
+
29
+ c = RestClient("http://127.0.0.1:8005") # token=... when the server has one
30
+ c.query("CREATE NODE TABLE Person(id INT64, name STRING, born DATE, PRIMARY KEY(id))")
31
+ c.query("CREATE (:Person {id: $id, name: $n, born: date($b)})", {"id": 1, "n": "Ann", "b": "1990-05-01"})
32
+ r = c.query("MATCH (p:Person) RETURN p.id, p.name, p.born")
33
+ r.columns # ['p.id', 'p.name', 'p.born']
34
+ r.types # ['INT64', 'STRING', 'DATE']
35
+ r.rows # [[1, 'Ann', datetime.date(1990, 5, 1)]]
36
+ r.truncated # False
37
+
38
+ g = GrpcClient("127.0.0.1:50055")
39
+ for row in g.stream_rows("MATCH (p:Person) RETURN p.id"): # rows streamed in chunks
40
+ ...
41
+ ```
42
+
43
+ With curl:
44
+
45
+ ```bash
46
+ curl -s localhost:8005/query -H 'content-type: application/json' \
47
+ -d '{"query": "MATCH (p:Person) WHERE p.id = $id RETURN p.name", "parameters": {"id": 1}}'
48
+ # {"results":[{"columns":["p.name"],"types":["STRING"],"rows":[["Ann"]],"row_count":1,"truncated":false}]}
49
+ ```
50
+
51
+ ## REST API
52
+
53
+ | Method and path | Body / query | Answer |
54
+ |---|---|---|
55
+ | `POST /query` | `{"query": str, "parameters": {..}?, "max_rows": int?}` | `{"results": [Statement, ...]}` |
56
+ | `GET /health` | | `{"status", "ready", "read_only", "version", "limits"}` |
57
+ | `POST /checkpoint` | | `{"status": "ok"}` (400 on a read-only server) |
58
+ | `GET /verify` | | `{"ok": bool, "problems": [str]}` |
59
+ | `GET /docs`, `GET /openapi.json` | | interactive docs / schema |
60
+
61
+ `Statement` is `{"columns": [str], "types": [str], "rows": [[value, ...]], "row_count": int,
62
+ "truncated": bool}`. There is one per `;`-separated statement of the query, in order.
63
+
64
+ * Request bodies are strict. An unknown field is 422 (a misspelled `parameters` must not run
65
+ a query without them), as is an unknown query parameter. `max_rows` must be a JSON integer
66
+ (`"5"` and `true` are refused).
67
+ * `parameters` is a JSON object. Its values arrive as JSON types: integers, floats, strings,
68
+ booleans, null, lists and objects (maps). JSON has no date type, so build such values in
69
+ the query: `date($day)`, `timestamp($ts)`, `interval($iv)`.
70
+ * `max_rows` caps the rows returned per statement. The server may cap lower (see *Limits*).
71
+ `truncated: true` means rows were left out, for any reason.
72
+
73
+ ## gRPC API
74
+
75
+ `python/leangraph/server/leangraph.proto`, package `leangraph`, service `LeanGraph`:
76
+
77
+ | RPC | Request → reply |
78
+ |---|---|
79
+ | `Health` | `HealthRequest` → `HealthReply{ready, read_only, version, limits_json}` |
80
+ | `Query` | `QueryRequest{query, parameters_json, optional max_rows}` → `QueryReply{repeated StatementResult results}` |
81
+ | `QueryStream` | `QueryRequest` → stream of `QueryChunk{statement, columns, types, rows_json, row_count, truncated, statement_done}` |
82
+ | `Checkpoint` | `Empty` → `StatusReply{status}` |
83
+ | `Verify` | `Empty` → `VerifyReply{ok, problems}` |
84
+
85
+ * `StatementResult` has the same fields as the REST `Statement`. `rows_json` is the JSON
86
+ array of rows, encoded exactly as in REST.
87
+ * `parameters_json` is a JSON object string. Empty or `null` means no parameters.
88
+ * `Query` returns everything in one message. The message is capped at the send limit
89
+ (= `LEANGRAPH_MAX_BODY_BYTES`) and at the result byte budget; rows past either cap are
90
+ left out and `truncated` is set.
91
+ * `QueryStream` sends rows in chunks of about 1 MiB, each always under the send limit. A
92
+ statement's first chunk carries its `columns` and `types`, and its last chunk has
93
+ `statement_done = true` and the final `truncated`. Only the row cap bounds the whole
94
+ stream. If the client goes away, the server stops encoding.
95
+ * The stubs are generated by `grpcio-tools==1.82.1` (protobuf gencode 7.35) and need
96
+ `grpcio>=1.82.1` and `protobuf>=7.35,<8`. That runtime needs Python ≥ 3.10. To regenerate
97
+ them after editing the proto, run `python scripts/gen_grpc.py` (`--check` compares them
98
+ with the checked-in copies; CI runs it).
99
+
100
+ ## Value encoding
101
+
102
+ Rows are JSON arrays. The column `types` say how to read each value:
103
+
104
+ | Type | JSON |
105
+ |---|---|
106
+ | BOOL, INT*, UINT*, FLOAT, DOUBLE, STRING | as is |
107
+ | INT128 (and any integer outside [-2^63, 2^64)) | decimal string |
108
+ | DOUBLE/FLOAT NaN, +∞, −∞ | `"NaN"`, `"Infinity"`, `"-Infinity"` |
109
+ | DATE | `"YYYY-MM-DD"` |
110
+ | TIMESTAMP | ISO 8601 `"2020-01-01T10:00:00"` |
111
+ | INTERVAL | `{"days": d, "seconds": s, "microseconds": us}` |
112
+ | BLOB | base64 string |
113
+ | LIST, ARRAY | array (elements encoded by these rules) |
114
+ | STRUCT, MAP | object |
115
+ | NODE | `{"_id": {"table": t, "offset": o}, "_label": "Person", <properties>}` |
116
+ | REL | `{"_src": .., "_dst": .., "_id": .., "_label": .., <properties>}` |
117
+ | RECURSIVE_REL / path | `{"_nodes": [...], "_rels": [...]}` |
118
+
119
+ The bundled clients turn top-level DATE, TIMESTAMP, INTERVAL, BLOB, special floats and
120
+ INT128 values back into the Python types the library returns (`decode=False` keeps the JSON
121
+ form). Values nested inside lists, maps, nodes or relationships stay in their JSON form.
122
+
123
+ ## Transactions
124
+
125
+ Every request runs on its own connection, so **a transaction never spans requests**.
126
+
127
+ * A single statement is auto-committed.
128
+ * Several `;`-separated statements in one request run one after another. Each statement
129
+ commits on its own, so an error at statement *k* leaves statements 1..k−1 committed.
130
+ * For all-or-nothing, put the transaction in the request:
131
+ `BEGIN TRANSACTION; CREATE ...; CREATE ...; COMMIT`. An error inside rolls the whole
132
+ transaction back, as in the library.
133
+ * A request that ends with a transaction still open (`BEGIN` without `COMMIT`/`ROLLBACK`)
134
+ is rolled back and answered with 400 / `INVALID_ARGUMENT`. Its results are not returned.
135
+ * Writes wait at most `LEANGRAPH_WRITE_LOCK_TIMEOUT_MS` (5000 ms in the servers, instead of
136
+ the library's 60 s) for another write transaction to finish, then fail with 503 /
137
+ `UNAVAILABLE`, which is retryable.
138
+
139
+ ## Files on the server: COPY and LOAD FROM
140
+
141
+ `COPY … FROM 'file'`, `COPY (…) TO 'file'` and `LOAD FROM 'file'` read and write files on
142
+ the **server's** disk with the server's permissions. Over the network that would let any
143
+ client read or overwrite any file the process can, so these statements are refused with
144
+ 403 / `PERMISSION_DENIED` unless the server is started with `--allow-file-access`
145
+ (`LEANGRAPH_ALLOW_FILE_ACCESS=1`). The engine decides this on its own parsed statements,
146
+ before anything runs, so no spelling of the query can get around it (an earlier check in
147
+ the server re-tokenized the query and could be fooled by number literals such as `2.LOAD`).
148
+ `COPY T FROM $rows` (data sent as a parameter) is not file access and is allowed.
149
+
150
+ ## Errors
151
+
152
+ | Kind | HTTP | gRPC | Retry? | Examples |
153
+ |---|---|---|---|---|
154
+ | invalid | 400 | INVALID_ARGUMENT | no | parser, binder, catalog, runtime (division by zero, out-of-range index), COPY errors, `COMMIT` without a transaction, a transaction left open, query over `LEANGRAPH_MAX_QUERY_CHARS`, writes on a read-only server |
155
+ | validation | 422 | (INVALID_ARGUMENT) | no | unknown or mistyped request fields |
156
+ | unauthorized | 401 | UNAUTHENTICATED | no | missing or wrong token |
157
+ | forbidden | 403 | PERMISSION_DENIED | no | COPY/LOAD with file access disabled; a non-loopback request to a server without a token |
158
+ | too large | 413 | RESOURCE_EXHAUSTED (grpc's own message limit) | no | body over `LEANGRAPH_MAX_BODY_BYTES` |
159
+ | over capacity | 429 | RESOURCE_EXHAUSTED | **yes** (`Retry-After: 1`) | the body does not fit the memory free right now; the query passed its memory budget; too many concurrent `QueryStream`s |
160
+ | unavailable | 503 | UNAVAILABLE | **yes** (`Retry-After: 1`) | starting or shutting down, write-lock wait timed out, out of file descriptors, MemoryError |
161
+ | internal | 500 | INTERNAL | no | storage errors, corruption, internal errors |
162
+
163
+ The error detail (`{"detail": "..."}` in REST, the status details in gRPC) is the engine's
164
+ message, capped at 512 characters. Running out of file descriptors (EMFILE/ENFILE) is
165
+ always reported as unavailable, never as corruption.
166
+
167
+ ## Security
168
+
169
+ * **Default: loopback only.** Both servers bind `127.0.0.1` unless told otherwise.
170
+ * **REST off loopback** needs `LEANGRAPH_API_TOKEN`. With a token set, **every** route
171
+ (`/health`, `/docs`, `/openapi.json` included) requires `Authorization: Bearer <token>`,
172
+ compared in constant time (`hmac.compare_digest`). `leangraph-serve --host 0.0.0.0`
173
+ without a token refuses to start. The check is also enforced per request on the socket
174
+ address the connection actually reached. So `uvicorn leangraph.server.serve:app --host 0.0.0.0`,
175
+ which bypasses the CLI, still answers 403 to any request that reached a non-loopback
176
+ address without a token.
177
+ * **gRPC off loopback** needs TLS (`LEANGRAPH_GRPC_TLS_CERT`, `LEANGRAPH_GRPC_TLS_KEY`)
178
+ **and** a token. The token is required as `authorization: Bearer <token>` metadata on
179
+ every RPC, unary and streaming, Health included. `SO_REUSEPORT` is off, so a second server
180
+ on the same port fails to bind instead of silently sharing the traffic.
181
+ * **DNS rebinding.** Without a token, the REST server answers only requests whose `Host`
182
+ is a loopback name or address (`localhost`, `127.x.x.x`, `[::1]`, any port) or is listed
183
+ in `LEANGRAPH_ALLOWED_HOSTS` (comma-separated). It also refuses browser requests with a
184
+ cross-origin `Origin` header (403), `Origin: null` (sandboxed iframes, `file:` pages)
185
+ included. Otherwise a web page could make a browser talk to a
186
+ local server under the page's own host name.
187
+ * `LEANGRAPH_ALLOW_INSECURE=1` (`--allow-insecure`) waives these rules for a genuinely
188
+ trusted private network, or behind an authenticating proxy.
189
+ * The token is read from the environment only (never a flag, which would show in `ps`).
190
+ * IPv6: pass `--host ::1` or `--host ::`. gRPC addresses are bracketed automatically
191
+ (`[::1]:50055`), and clients use the bracketed form too.
192
+
193
+ ## Limits
194
+
195
+ Static caps can only be **lowered** through the environment, so a typo cannot switch a
196
+ protection off.
197
+
198
+ | Variable | Default | Meaning |
199
+ |---|---|---|
200
+ | `LEANGRAPH_MAX_BODY_BYTES` | 64 MiB | REST body cap (413); gRPC message size cap (send and receive) |
201
+ | `LEANGRAPH_MAX_QUERY_CHARS` | 1 Mi | query text length (400) |
202
+ | `LEANGRAPH_HARD_MAX_ROWS` | 10,000,000 | absolute rows per statement in a response |
203
+ | `LEANGRAPH_MIN_ROWS` | 1,000 | row cap floor while memory allows it |
204
+ | `LEANGRAPH_MEM_FRACTION` | 0.5 | share of the available RAM that responses may use |
205
+ | `LEANGRAPH_BODY_MEM_FRACTION` | = MEM_FRACTION | share of the available RAM that request parsing may use |
206
+ | `LEANGRAPH_PER_ROW_BYTES` | 512 | memory estimate per returned row |
207
+ | `LEANGRAPH_MEM_REFRESH_SECS` | 1.0 | how often the memory probe runs |
208
+
209
+ * **Dynamic row cap.** `available RAM × MEM_FRACTION / workers / PER_ROW_BYTES`, clamped to
210
+ [`MIN_ROWS`, `HARD_MAX_ROWS`]. "Available" is the smaller of `MemAvailable` and the
211
+ process cgroup's remaining allowance.
212
+ * **Result byte budget.** `available RAM × MEM_FRACTION / workers`, at most 8 × the body
213
+ cap. It is enforced while rows are serialized, so a response never grows much past it.
214
+ For gRPC `Query` it is also capped at the message size limit.
215
+ * **Request bodies** are admitted before parsing. A declared `Content-Length` over the cap
216
+ is 413, and one that does not fit the free memory is 429. A non-numeric or conflicting
217
+ `Content-Length` is 400. Chunked bodies are metered as they arrive, and every body
218
+ reserves its estimated parse memory until the request ends.
219
+ * **Slow clients (REST).**
220
+ * `LEANGRAPH_HEADER_TIMEOUT_S` (10): a connection must finish a request's headers within
221
+ this many seconds. This is enforced by `leangraph-serve`. Under a plain
222
+ `uvicorn leangraph.server.serve:app`, uvicorn has no header timeout: use
223
+ `leangraph-serve`, or a reverse proxy that enforces one.
224
+ * `LEANGRAPH_BODY_TIMEOUT_S` (30): a request body must keep arriving (at most this long
225
+ between chunks), else 408.
226
+ * `LEANGRAPH_SEND_TIMEOUT_S` (60): a client that stops reading its response is
227
+ disconnected after this long, and the response body is freed.
228
+ * `LEANGRAPH_KEEPALIVE_S` (5): idle keep-alive connections close after this.
229
+ * `LEANGRAPH_MAX_HEADER_BYTES` (64 KiB): the largest header block accepted.
230
+ * The body reservation grows with the bytes that actually arrive, not with the declared
231
+ `Content-Length`.
232
+ * **gRPC streams.** At most `workers − 1` `QueryStream`s run at once, so a worker always
233
+ stays free for Query; past that, `RESOURCE_EXHAUSTED` (retryable). Health runs on a
234
+ small pool of its own, so it answers even while slow calls hold every worker. A stream
235
+ runs its query and encodes its chunks (up to the result byte budget, then `truncated`)
236
+ *before* sending, so the database connection is released while the client reads. A stream
237
+ whose client accepts no message for `LEANGRAPH_GRPC_STREAM_IDLE_S` (30) is cancelled.
238
+ * **gRPC.** `LEANGRAPH_GRPC_MAX_CONCURRENT_RPCS` (unset = unbounded) caps running plus
239
+ queued RPCs. `LEANGRAPH_GRPC_KEEPALIVE_TIME_MS` (60000) and
240
+ `LEANGRAPH_GRPC_KEEPALIVE_TIMEOUT_MS` (20000) set the keepalive, so a vanished client's
241
+ RPCs are cancelled.
242
+
243
+ **Known limit: queries cannot be cancelled.** The engine has no interrupt yet, so a running
244
+ query continues even after its client disconnects or times out. The caps above bound what
245
+ is serialized and sent, but the engine still builds the full result of a statement in
246
+ memory before the server reads it. For very large results, prefer `LIMIT` in the query (or
247
+ `QueryStream`).
248
+
249
+ ## Configuration
250
+
251
+ | Variable | Flag | Default |
252
+ |---|---|---|
253
+ | `LEANGRAPH_PATH` | `--path` | `./leangraph_data` (`:memory:` for an in-memory database) |
254
+ | `LEANGRAPH_HOST` / `LEANGRAPH_PORT` | `--host` / `--port` (REST) | `127.0.0.1` / `8005` |
255
+ | `LEANGRAPH_GRPC_HOST` / `LEANGRAPH_GRPC_PORT` | `--host` / `--port` (gRPC) | `127.0.0.1` / `50055` |
256
+ | `LEANGRAPH_THREADS` | `--threads` (REST) | min(64, 2 × CPUs) concurrent requests |
257
+ | `LEANGRAPH_GRPC_WORKERS` | `--workers` (gRPC) | min(64, 2 × CPUs) |
258
+ | `LEANGRAPH_QUERY_THREADS` | `--query-threads` | all cores (parallelism inside one query) |
259
+ | `LEANGRAPH_READ_ONLY` | `--read-only` | off |
260
+ | `LEANGRAPH_ALLOW_FILE_ACCESS` | `--allow-file-access` | off |
261
+ | `LEANGRAPH_API_TOKEN` | (environment only) | unset |
262
+ | `LEANGRAPH_ALLOW_INSECURE` | `--allow-insecure` | off |
263
+ | `LEANGRAPH_ALLOWED_HOSTS` | (environment only) | unset (loopback Host names only, without a token) |
264
+ | `LEANGRAPH_GRPC_TLS_CERT` / `_KEY` | `--tls-cert` / `--tls-key` | unset |
265
+
266
+ All engine variables (`LEANGRAPH_WAL_SYNC_MS`, `LEANGRAPH_CHECKPOINT_THRESHOLD_BYTES`, …)
267
+ apply as usual. See the README.
268
+
269
+ ## Shutdown
270
+
271
+ SIGINT or SIGTERM triggers a graceful shutdown. REST stops accepting connections, lets
272
+ in-flight requests finish (up to 30 s), then closes the database. gRPC marks itself not
273
+ ready (Health `ready = false`, other RPCs `UNAVAILABLE`), gives in-flight RPCs 10 s, then
274
+ closes the database. Closing checkpoints, so a restart opens instantly. uvicorn re-raises
275
+ the signal after its shutdown, so `leangraph-serve` exits with status −15 / 143 after a
276
+ clean SIGTERM.
277
+
278
+ ## Running the server under another ASGI server
279
+
280
+ ```bash
281
+ LEANGRAPH_PATH=/data/graph uvicorn leangraph.server.serve:app --workers 1 --port 8005
282
+ ```
283
+
284
+ Use exactly one worker process. A database directory has one writer process, and a second
285
+ uvicorn worker would wait for the writer lock and then fail. To scale reads, run extra
286
+ servers with `LEANGRAPH_READ_ONLY=1`.