{"categories":[{"label":"Libraries","url":"https://skillfed.io/packages/category/software-development-libraries/4"}],"enrichment":{"capability":"apipkg lets you define a package's exported namespace declaratively and defer imports until they are accessed, reducing startup overhead and simplifying your public API.","skillfed_tags":["lazy-loading","namespace-control"],"use_cases":["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."],"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.\n\nThe 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.","worth_installing":"Yes. apipkg solves a real problem\u2014controlling package namespaces and deferring imports\u2014with 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."},"id":"apipkg","links":{"html":"https://skillfed.io/packages/apipkg","md":"https://skillfed.io/packages/apipkg.md","pypi":"https://pypi.org/project/apipkg/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2023-09-19","license_spdx":null,"license_treatment":"permissive","name":"apipkg","python_support":"supports_current","summary":"apipkg: namespace control and lazy-import mechanism"},"popularity":{"monthly_downloads":1551611,"position":3775,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"3.0.2"}
