skillfed

zope.annotation

Object annotation mechanism

zope-annotation v6.0 150.9K downloads/30d#10,950 on PyPI1
License unclear ZPL-2.1 Active released

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-annotation

uv

uv add zope-annotation

poetry

poetry add zope-annotation

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Zope Public LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development

Tags

object annotation storageattach metadata to objectszope annotation mechanismnon-invasive object metadatazope component adaptationpersistent object attributesZODB annotation framework
zope-ecosystemobject-metadataadapter-pattern

More Software Development packages