skillfed

zope.deferredimport

zope.deferredimport allows you to perform imports names that will only be resolved when used in the code.

zope-deferredimport v6.1.1 393.7K downloads/30d#6,996 on PyPI5
License unclear ZPL-2.1 Active released

What it is and what it does

zope.deferredimport is a utility for delaying the actual import of module names until they are first used in code. Instead of importing a name at module load time, you declare it as deferred, and the import happens only when that name is accessed. This is useful for reducing startup time in large packages or for managing circular import dependencies.

The package also supports issuing deprecation warnings when a name is used, making it a tool for library maintainers to guide users away from old APIs without breaking existing code immediately. It works by creating module proxies that intercept attribute access and trigger the real import on demand. The package depends only on zope.proxy and supports current Python versions (3.10 through 3.14).

Use it for:

  • Reduce module load time in large packages by deferring imports of rarely-used submodules until they are actually accessed.
  • Issue deprecation warnings when users access old API names, guiding migration without immediate breakage.
  • Manage circular import dependencies by deferring one side of the cycle until runtime.
  • Create convenience re-exports in a package's __init__.py without paying the import cost upfront.
  • Provide backward compatibility by keeping old names available but deprecated, with warnings on use.

Worth the install?

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

Defers module imports until they are actually used, optionally issuing deprecation warnings when imported names are accessed.

Yes, if you need lazy imports or deprecation warnings in a library. Low install friction, active maintenance, no known vulnerabilities, and a focused scope make it reliable for its purpose. Verify ZPL-2.1 compatibility with your project's license before committing.

Install

zope-deferredimport on PyPI

pip

pip install zope-deferredimport

uv

uv add zope-deferredimport

poetry

poetry add zope-deferredimport

Installing zope.deferredimport

Before you install

Low friction: pure Python wheel with a single runtime dependency (zope.proxy). Actively maintained with recent releases supporting Python 3.14 and dropping older versions; last commit 2026-02-16.

License in practice

Licensed under ZPL-2.1 (Zope Public License 2.1); license treatment marked unclear in metadata, so verify compatibility with your project's license policy before use.

Quickstart

from zope.deferredimport import deprecated
deprecated('old_name', 'module.new_name')
# old_name is now available but triggers a deprecation warning when accessed

Requires Python 3.10 or later.

Verify before relying

  • Whether ZPL-2.1 is compatible with your project's licensing requirements (license_treatment is marked unclear).
  • Specific use cases where deferred imports provide measurable performance or import-time overhead reduction.
  • Whether zope.proxy's behavior and API are stable for your intended use.

Package facts

License ZPL-2.1 (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 1 — zope.proxy
Maintenance actively maintained — 179 days since the last release
Last repo commit
First released
Downloads 393,748/month — #6,996 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: zope_deferredimport-6.1.1-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural 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.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Internet :: WWW/HTTPTopic :: Software Development

Tags

lazy importdeferred importdeprecation warning on importdelayed module loadingconditional importimport on demandmodule proxy
lazy-loadingdeprecationimport-management

More Software Development packages