$npx skillfedfor your agent

apipkg

apipkg: namespace control and lazy-import mechanism

Worth itPyPI LibrariesReleased Sep 20231.6M downloads / mopermissive licensePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — apipkg-3.0.2-py3-none-any.whl
v3.0.2 · released 2023-09-19 · Python >=3.7

Yes. apipkg solves a real problem—controlling package namespaces and deferring imports—with zero dependencies, active maintenance, and permissive licensing. It's particularly valuable if you're building a library with many internal modules or heavy dependencies. The code is simple enough to embed if you want to avoid the dependency, but installing it is low-friction and gives you a battle-tested implementation.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.7 or later; works on CPython, Jython, and PyPy.
  • Low friction: pure Python with no runtime dependencies, distributed as a wheel, and actively maintained.
  • Last commit was 2026-08-10 and the repository is not archived.

License · maintenance · safety

permissive license (permissive) — MIT-licensed under permissive terms, so you can use it freely in commercial or open-source projects without restriction.

last release 2023-09-19 (1060 days) · last repo commit 2026-08-10 · 55 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,551,611 downloads/mo, #3,775 on PyPI

Verify before relying

pip install apipkg

# In your package's __init__.py:
import apipkg
apipkg.initpkg(__name__, {
    'path': {
        'Class1': "_mypkg.somemodule:Class1",
    }
})
  • Whether embedding the code directly into your project is practical given the stated ~200 lines of code.
  • Performance characteristics of the lazy-loading approach in your specific use case.
Same gist for agents: .md · .json

What it is and what it does

apipkg is a small pure Python module that lets you control which names your package exports and when they are imported. Instead of importing everything upfront in your __init__.py, you define a namespace dictionary mapping public names to their import locations as strings, and apipkg defers the actual import until someone accesses that name. This means your package's startup is faster, users only pay the cost of importing what they actually use, and your public API is clearly defined in one place.

The package works by intercepting attribute access on your module and performing the import on demand. It integrates with Python's help() system and command-line completion tools, so users get the same introspection experience as with regular imports. Since it has no runtime dependencies and is only ~200 lines of code, you can also copy it directly into your project if you want to avoid an external dependency.

Use it for

  • Define a clean public API for a package with many internal modules without forcing all imports at startup.
  • Reduce import time for packages with heavy dependencies by deferring their loading until needed.
  • Organize a large package's namespace hierarchically while keeping the underlying module structure flexible.
  • Simplify user code by exposing deeply nested classes or functions at the top level of your package.
  • Build plugin systems where submodules are only loaded when explicitly requested.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

apipkg solves a real problem—controlling package namespaces and deferring imports—with zero dependencies, active maintenance, and permissive licensing. It's particularly valuable if you're building a library with many internal modules or heavy dependencies. The code is simple enough to embed if you want to avoid the dependency, but installing it is low-friction and gives you a battle-tested implementation.

Install

apipkg on PyPI

Before you install

Low friction: pure Python with no runtime dependencies, distributed as a wheel, and actively maintained. Last commit was 2026-08-10 and the repository is not archived.

Requires Python 3.7 or later; works on CPython, Jython, and PyPy.

License in practice

MIT-licensed under permissive terms, so you can use it freely in commercial or open-source projects without restriction.

Quickstart

pip install apipkg

# In your package's __init__.py:
import apipkg
apipkg.initpkg(__name__, {
    'path': {
        'Class1': "_mypkg.somemodule:Class1",
    }
})

Verify before relying

  • Whether embedding the code directly into your project is practical given the stated ~200 lines of code.
  • Performance characteristics of the lazy-loading approach in your specific use case.

Package facts

Licensepermissive license permissive
Python supportSupports the current Python release >=3.7
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 1,060 days since the last release
Last repo commit
First released
Downloads1,551,611 / month, #3,775 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Libraries

Evidence: apipkg-3.0.2-py3-none-any.whl

Tags

Capabilities
lazy import mechanismnamespace control pythondeferred module loadingapi namespace managementreduce package importspython import optimization
Topics
lazy-loadingnamespace-control

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “lazy import mechanism”

  • apipkgapipkg lets you define a package's exported namespace declaratively…
  • lazy-importsDefers loading of module attributes and their dependencies until…
  • lazy-importDefers module loading and ImportErrors until a module or callable is…

Give your agent the search over MCP, or paste the wish link into any chat.

More Libraries packages

urllib3 Worth it
PyPI · Libraries · released May 2026

urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.

MITpure Python · 3.10+
1.8Bdownloads / mo
requests Worth it
PyPI · Libraries · released May 2026

Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.

Apache-2.0pure Python · 3.10+
1.8Bdownloads / mo
pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
python-dateutil Worth it
PyPI · Libraries · released Mar 2024

Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.

Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.

Apache-2.0pure Python
1.2Bdownloads / mo
six With conditions
PyPI · Libraries · released Dec 2024

Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.

MITpure Python
1.2Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo

See also lazy-imports · donfig · grimp · lazy-loader · zope.deferredimport · pytest-helpers-namespace · pip · publication · import-deps · azure-nspkg