🌱 Turn any object into a module 🌱
Callable modules! Indexable modules!?
Ever wanted to call a module directly, or index it? Or just sick of seeing
from foo import foo in your examples?
Give your module the awesome power of an object, or maybe just save a
little typing, with xmod.
xmod is a tiny library that lets a module to do things that normally
only a class could do - handy for modules that "just do one thing".
Example: Make a module callable like a function!
# In your_module.py
import xmod
@xmod
def a_function():
return 'HERE!!'
# Test at the command line
>>> import your_module
>>> your_module()
HERE!!
Example: Make a module look like a list!?!
# In your_module.py
import xmod
xmod(list(), __name__)
# Test at the command line
>>> import your_module
>>> assert your_module == []
>>> your_module.extend(range(3))
>>> print(your_module)
[0, 1, 2]
API Documentation
Release files for xmod 1.10.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xmod-1.10.0.tar.gz | 17.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xmod-1.10.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.5 kB
Release files / xmod-1.10.0.tar.gz
| Download URL | xmod-1.10.0.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b40b2a54d56684b01eb9627892b0c179918e8ef0bd4d7f3bac7a3fdba11cd6e6
|
|
BLAKE2b-256 checksum How to use checksums |
7a3b5a0d2670bab661164e27a5c27c448ae6204458c97cb94ccf89d0c47715bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / xmod-1.10.0-py3-none-any.whl
| Download URL | xmod-1.10.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bebf8493b7ac63097401590a329c9ed20da224de0583a522e7ccb634af122f5a
|
|
BLAKE2b-256 checksum How to use checksums |
cbe9c362d47ed2b1928d65d61888c1419fae8ef69417fba2067d2fd3da1d400b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|