skillfed

xmod

🌱 Turn any object into a module 🌱

xmod v1.10.0 4.9M downloads/30d#2,200 on PyPI5
Permissive license MIT Active released

What it is and what it does

xmod is a lightweight library that lets you give a module the behavior of a callable or container object. Normally, modules are static namespaces; xmod wraps a module so it can respond to function calls, indexing, or other object protocols. This is useful for single-purpose modules where you want to avoid boilerplate and instead call or index the module directly.

The package has no runtime dependencies and works with modern Python versions (3.10–3.14). It's maintained actively with no known vulnerabilities. The core use case is simplifying APIs of modules that "just do one thing" by letting them behave like the objects they export.

Use it for:

  • Make a module callable so the module itself can be invoked as a function without intermediate imports.
  • Wrap a module around a list or dict to support indexing and mutation directly on the module.
  • Reduce import boilerplate in libraries where the module itself is the primary interface.
  • Create a module that mimics a built-in type's interface for a more intuitive API.

Worth the install?

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

Lets a module behave like a callable object or container by wrapping it with special methods, eliminating redundant import patterns.

Yes, if you want to simplify module APIs or reduce import boilerplate in single-purpose modules. The package is lightweight, actively maintained, permissively licensed, and carries no security vulnerabilities. Install friction is minimal. It's a niche tool, but well-suited to its specific use case.

Install

xmod on PyPI

pip

pip install xmod

uv

uv add xmod

poetry

poetry add xmod

Installing xmod

Before you install

Low install friction with no runtime dependencies. Active maintenance with a recent release 97 days ago and current Python version support (3.10–3.14).

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

pip install xmod

import xmod

@xmod
def a_function():
    return 'result'

# Module is now callable
print(a_function())  # 'result'

Requires Python 3.10 or later.

Verify before relying

  • Whether the decorator approach preserves standard module attributes like __all__ and __doc__.
  • Performance overhead of the module wrapping mechanism for frequently-accessed modules.
  • Compatibility with module introspection tools and import hooks.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 97 days since the last release
Last repo commit
First released
Downloads 4,908,921/month — #2,200 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: xmod-1.10.0-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

callable modulesmodule as objectindexable modulesmodule wrappermodule decoratormodule protocolmodule metaprogramming
module-protocoldecoratorapi-design

More Software Development packages