Install & Compatibility
Where this runs
tested against v6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.484s · 36.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.4s · import 0.444s · 38MB
40MB installed
● package 40MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ViewletBase
✓ from zope.viewlet.viewlet import ViewletBase
✗ from zope.viewlet import ViewletBase
Direct import from __init__ fails; use the viewlet submodule.
IViewletManager
✓ from zope.viewlet.interfaces import IViewletManager
✗ from zope.viewlet import IViewletManager
Interfaces are in the interfaces submodule.
ViewletManagerBase
✓ from zope.viewlet.manager import ViewletManagerBase
✗ from zope.viewlet import ViewletManagerBase
Manager class is in the manager submodule.
Define a viewlet and manager. Viewlets must implement IViewlet, managers IViewletManager.
from zope.viewlet.viewlet import ViewletBase
from zope.viewlet.manager import ViewletManagerBase
from zope.viewlet.interfaces import IViewlet, IViewletManager
class MyViewlet(ViewletBase):
def update(self):
self.message = 'Hello from viewlet'
def render(self):
return f'<div>{self.message}</div>'
class MyManager(ViewletManagerBase):
pass
# typical usage involves registration via ZCML or component architecture
print('Viewlet and Manager defined')
Errors
Common errors & fixes
AttributeError: module 'zope.viewlet' has no attribute 'ViewletBase'
Importing from the package root instead of the viewlet submodule.
fixUse: from zope.viewlet.viewlet import ViewletBase
TypeError: can't pickle ViewletManagerBase objects
Viewlet managers are not pickle-safe by default; common when using session or caching.
fixImplement __getstate__ and __setstate__ in your manager class, or avoid pickling them.
ModuleNotFoundError: No module named 'zope.viewlet'
Package not installed or Python environment not activated.
fixInstall: pip install zope.viewlet. Verify with pip list.
Upgrade
Version history
6.0latest on PyPI · released Sep 12, 2025
Audit
Dependencies
zope.interfacerequiredCore dependency for interface definitions
zope.componentrequiredRequired for component architecture
zope.browserpagerequiredProvides page rendering support
zope.publisherrequiredRequired for request/response handling