skillfed

Acquisition

Acquisition is a mechanism that allows objects to obtain attributes from the containment hierarchy they're in.

acquisition v6.2 181.8K downloads/30d#10,114 on PyPI12
License unclear ZPL-2.1 Active released

What it is and what it does

Acquisition is a Python mechanism that allows objects to dynamically acquire attributes from their containment hierarchy at runtime. Rather than requiring explicit inheritance, an object wrapped in an acquisition context can transparently access attributes from its container or parent objects. This is particularly useful in frameworks like Zope where object hierarchies are deep and dynamic, and behavior should depend on context.

The package provides two acquisition styles: implicit (automatic attribute lookup up the containment chain) and explicit (manual lookup via the aq_acquire method). Objects inherit from Acquisition.Implicit or Acquisition.Explicit to enable this behavior. Acquisition wrappers expose the wrapped object and its context through attributes like aq_parent, aq_self, and aq_base. The mechanism relies on ExtensionClass to implement the low-level wrapping and attribute resolution logic.

Use it for:

  • Building hierarchical object systems in web frameworks where child objects need access to parent context without explicit parameter passing.
  • Implementing dynamic role-based access control where permissions are inherited from container objects.
  • Creating nested component architectures where behavior adapts based on the object's position in the containment tree.
  • Zope application development where acquisition is a core pattern for managing object relationships and context.
  • Reducing boilerplate in deeply nested object structures by allowing implicit attribute resolution from ancestors.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Acquisition implements a mechanism for Python objects to automatically obtain attributes from their containment hierarchy at runtime, enabling objects to inherit behavior from their containers without explicit inheritance.

Yes, if you are building Zope applications or need a framework-level acquisition pattern for hierarchical object systems. The package is actively maintained, has no known vulnerabilities, and supports current Python versions. Install friction is moderate due to compiled dependencies, but wheels are widely available. Verify ZPL-2.1 license compatibility first. Not recommended for general-purpose Python projects; acquisition is a specialized pattern most valuable in web frameworks that depend on it.

Install

acquisition on PyPI

pip

pip install acquisition

uv

uv add acquisition

poetry

poetry add acquisition

Installing Acquisition

Before you install

Medium install friction due to compiled extension requirements (wheels provided for Python 3.10–3.13 across multiple platforms). Actively maintained with recent releases; last commit 2026-08-14. Depends on ExtensionClass and zope.interface, both stable Zope ecosystem packages.

License in practice

Licensed under ZPL-2.1 (Zope Public License 2.1), a permissive open-source license. License treatment is marked unclear in the fact sheet, so verify ZPL-2.1 compatibility with your project's legal requirements before use.

Quickstart

import ExtensionClass
from Acquisition import Implicit

class Container(ExtensionClass.Base):
    color = 'red'

class Item(Implicit):
    def get_color(self):
        return self.color

container = Container()
item = Item()
container.item = item
print(container.item.get_color())  # Outputs: red

Requires ExtensionClass, a compiled C extension. Python 3.10 or later is required (supports 3.10, 3.11, 3.12, 3.13, 3.14).

Verify before relying

  • Whether ZPL-2.1 is compatible with your project's license requirements (license_treatment marked unclear).
  • Performance characteristics and overhead of acquisition wrappers in high-throughput scenarios.
  • Compatibility with non-CPython implementations beyond PyPy (classifier lists PyPy but no wheels provided).

Package facts

License ZPL-2.1 (unclear)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — ExtensionClass, zope.interface
Maintenance actively maintained — 271 days since the last release
Last repo commit
First released
Downloads 181,799/month — #10,114 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: acquisition-6.2-cp310-cp310-macosx_10_9_x86_64.whl; acquisition-6.2-cp310-cp310-macosx_11_0_arm64.whl; acquisition-6.2-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; acquisition-6.2-cp310-cp310-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; acquisition-6.2-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; acquisition-6.2-cp310-cp310-win_amd64.whl; acquisition-6.2-cp311-cp311-macosx_10_9_x86_64.whl; acquisition-6.2-cp311-cp311-macosx_11_0_arm64.whl; acquisition-6.2-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; acquisition-6.2-cp311-cp311-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; acquisition-6.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; acquisition-6.2-cp311-cp311-win_amd64.whl; acquisition-6.2-cp312-cp312-macosx_10_9_x86_64.whl; acquisition-6.2-cp312-cp312-macosx_11_0_arm64.whl; acquisition-6.2-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl; acquisition-6.2-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl; acquisition-6.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl; acquisition-6.2-cp312-cp312-win_amd64.whl; acquisition-6.2-cp313-cp313-macosx_10_9_x86_64.whl; acquisition-6.2-cp313-cp313-macosx_11_0_arm64.whl

Development Status :: 6 - MatureEnvironment :: Web EnvironmentFramework :: ZopeFramework :: Zope :: 5Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

attribute acquisition from containersimplicit object inheritancezope acquisition patternruntime behavior from environmentcontainer-based attribute lookup
zope-ecosystemobject-hierarchycontext-acquisition

More Application Frameworks packages