zope.annotation
Object annotation mechanism
What it is and what it does
zope.annotation provides a framework for attaching arbitrary metadata to objects at runtime without modifying their class definition. It integrates with the Zope component architecture (zope.interface, zope.component, zope.location, zope.proxy) to register and retrieve annotations through a clean adapter-based API. The package is particularly useful in ZODB-backed systems where you need to associate extra data with persistent objects.
The core mechanism uses IAnnotations adapters to store metadata, with AttributeAnnotations providing a dict-like interface for attribute-based storage. The package supports both in-memory dict storage and persistent BTrees storage, falling back gracefully if BTrees is unavailable. It has been actively maintained since 2007 and currently supports Python 3.9 through 3.13.
Use it for:
- Attach domain-specific metadata to ZODB objects without altering their schema or class hierarchy.
- Store temporary or computed attributes on objects in a Zope application without modifying the persistent object structure.
- Build plugin systems where different components can independently annotate shared objects with their own metadata.
- Implement object traversal helpers by storing parent references via __parent__ annotations for upward navigation.
- Manage object-level configuration or state in frameworks that use zope.component for adaptation.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Stores additional metadata on objects without modifying their class, using a Zope-based annotation mechanism backed by zope.interface and zope.component.
Yes, if you are building within the Zope ecosystem or need a clean, non-invasive way to attach metadata to objects in a component-based architecture. The package is stable, actively maintained, and has no known vulnerabilities. The ZPL-2.1 license is OSI-approved but less mainstream; verify it aligns with your project before committing. Install friction is low and dependencies are all from the same ecosystem, so integration is straightforward for Zope-aware projects.
Install
zope-annotation on PyPI
pip
pip install zope-annotationuv
uv add zope-annotationpoetry
poetry add zope-annotationInstalling zope.annotation
Before you install
Low install friction with a pure-Python wheel and five runtime dependencies all from the Zope ecosystem. Actively maintained with recent releases supporting Python 3.9 through 3.13; last commit was 2026-05-13.
License in practice
Licensed under ZPL-2.1 (Zope Public License 2.1), which is OSI-approved but less common than MIT or Apache 2.0; verify compatibility with your project's license policy before adopting.
Quickstart
from zope.annotation.interfaces import IAnnotations
from zope.annotation.attribute import AttributeAnnotations
# Register adapter or use directly
annotations = IAnnotations(your_object)
Requires Python 3.9 or later; integration with Zope component architecture assumes familiarity with zope.interface and zope.component patterns.
Verify before relying
- Whether BTrees is automatically installed or only available via optional [btree] extra in version 6.0.
- Concrete examples of how annotation storage differs between dict and BTrees backends in practice.
- Performance characteristics when storing large numbers of annotations on a single object.
Package facts
| License | ZPL-2.1 (unclear) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 5 — setuptools, zope.interface, zope.component, zope.location, zope.proxy |
| Maintenance | actively maintained — 336 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 150,924/month — #10,950 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zope_annotation-6.0-py3-none-any.whl
Keywords: zope, annotation, ZODB, zope3, ztk
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
zope.containerProvides container interfaces and…
unclear · top 15,000 on PyPI
zope.filerepresentationDefines interfaces for representing objects as…
unclear · top 15,000 on PyPI
zope.globalrequestProvides a function to retrieve the currently…
unclear · top 15,000 on PyPI
zope.hookablezope.hookable provides a mechanism to create…
unclear · top 5,000 on PyPI
zope.lifecycleeventDefines event objects and API functions for…
unclear · top 15,000 on PyPI
PersistenceProvides a persistent base class built on…
unclear · top 15,000 on PyPI
persistentProvides transparent persistence for Python…
unclear · top 15,000 on PyPI
MultiMappingMultiMapping provides special mapping objects…
unclear · top 15,000 on PyPI
zope.locationProvides a structural location system for Zope…
unclear · top 15,000 on PyPI
zope.configurationZope.configuration provides an extensible…
unclear · top 5,000 on PyPI