Xmod: Turn any object into a module

1.9.0 · active · verified Thu Apr 09

Xmod is a tiny Python library designed to transform any Python object into a module. This allows for modules to be callable, indexable, or to expose an object's methods and properties directly, reducing boilerplate code. It is currently at version 1.9.0 (released February 3, 2026) and maintains an active development status with frequent minor updates and dependency bumps.

Warnings

Install

Imports

Quickstart

The most common usage is to decorate a function within a module to make the module itself callable. This example demonstrates making the module 'your_module' callable, returning a greeting.

# In your_module.py
import xmod

@xmod
def greet():
    return 'Hello from your_module!'

# To test in another script or interpreter:
# import your_module
# print(your_module())
# Expected output: Hello from your_module!

view raw JSON →