Registry / web-framework / zope.viewlet

zope.viewlet

JSON →
library6.0pypypi✓ verified 84d ago

Zope Viewlets provide a mechanism for reusable components in Zope-based web applications, enabling modular view rendering. Current version: 6.0, supported Python >=3.9. Release cadence is infrequent, tied to Zope framework updates.

pip install zope.viewlet
INSTALL
IMPORT
SIG · ZOPE.VIEWLET
Z
zope.viewlet
web-frameworkpythonv6.0
Install
4.4s avg
Import
464ms
Disk
40MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.484s · 36.6MB
glibc
py 3.103.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')
Debug
Known issues
breaking6.0 drops support for Python 2 and Python <3.9. If upgrading from 5.x, check Python version compatibility.
fix
Ensure Python >=3.9. Update imports and remove any Python 2 compatibility code.
affects: <6.0
deprecatedViewletManagerBase no longer automatically assigns 'manager' attribute to viewlets. You must now pass it explicitly via update().
fix
Override update() to set self.manager = manager or receive manager as argument.
affects: >=6.0
gotchaImporting directly from zope.viewlet (e.g., 'from zope.viewlet import ViewletBase') fails with AttributeError because submodules are not imported by default.
fix
Use the appropriate submodule path: from zope.viewlet.viewlet import ViewletBase, from zope.viewlet.manager import ViewletManagerBase, from zope.viewlet.interfaces import IViewlet, etc.
affects: all
Errors
Common errors & fixes
AttributeError: module 'zope.viewlet' has no attribute 'ViewletBase'
Importing from the package root instead of the viewlet submodule.
fix
Use: 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.
fix
Implement __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.
fix
Install: 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
Agent activity
39 hits · last 30 days
node
32
OpenAI (training)
1
Resources
zope.viewlet — pip install zope.viewlet · libregistry