ZEO

raw JSON →
6.2 verified Fri May 01 auth: no python

ZEO (Zope Enterprise Objects) provides a client-server storage for ZODB (Zope Object Database). Version 6.2 supports Python >=3.10. Allows multiple processes to share a single ZODB database over a network. ZEO is stable with periodic releases.

pip install zeo
error ModuleNotFoundError: No module named 'ZEO'
cause Installed 'zeo' (lowercase) but not 'ZEO' (uppercase). The Python package is 'ZEO' with capital letters.
fix
Install the correct package: pip install ZEO (note: the package on PyPI is lowercase 'zeo', but the Python module is 'ZEO'. The pip package name is case-insensitive, so 'pip install zeo' works, but import uses 'ZEO').
error ImportError: cannot import name 'ClientStorage' from 'ZEO'
cause Possibly missing dependency or incorrect import. Ensure you have the correct version installed.
fix
Install ZEO: pip install zeo. Then try: from ZEO import ClientStorage
error ConnectionRefusedError: [Errno 111] Connection refused
cause The ZEO server is not running or not reachable at the specified address.
fix
Start the ZEO server: runzeo -a 8100 -f data.fs. Ensure the address and port match.
breaking Python 3.10+ required. ZEO 6.x drops support for Python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9. If you are on an older Python version, you must use ZEO 5.x or lower.
fix Ensure Python >=3.10 is used.
deprecated ZEO's storages based on FileStorage and zeopack are deprecated. The recommended storage is a RelStorage-backed ZEO server with a PostgreSQL or MySQL backend.
fix Migrate to RelStorage for production deployments.
gotcha The ZEO server (runzeo) must be running before the client connects. Common mistake: starting the client first results in a ConnectionRefusedError.
fix Start the ZEO server before any client. Use: runzeo -a 8100 -f data.fs
gotcha ZEO is not thread-safe by default. The client storage must be used in a single-threaded manner or with proper locking. Multi-threaded access requires wrapper storages.
fix Use ZODB's DB with a thread-safe storage or serialize access.

Connects to a ZEO server running on localhost:8100, stores a simple object in the root of the database.

import ZEO
from ZEO import ClientStorage
import ZODB
from ZODB import DB

addr = ('localhost', 8100)
storage = ClientStorage.ClientStorage(addr)
db = DB(storage)
with db.transaction() as conn:
    root = conn.root()
    root['hello'] = 'world'
    conn.commit()
db.close()