🌱 Turn any object into a module 🌱
Project description
🌱 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xmod-1.9.0.tar.gz.
File metadata
- Download URL: xmod-1.9.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98b2e7e8e659c51b635f4e98faf3fa1f3f96dab2805f19ddd6e352bbb4d23991
|
|
| MD5 |
45e6361510abc940c7ab255e392667dc
|
|
| BLAKE2b-256 |
8b3f0bc3b89c1dd4dee1f954db4c857f8fbe9cdfa8b25efe370b6d78399a93ac
|
File details
Details for the file xmod-1.9.0-py3-none-any.whl.
File metadata
- Download URL: xmod-1.9.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a549a055e0391a53e356a63552baa7e562560a6e9423c1437cb53b5d4f697a0
|
|
| MD5 |
42aef190b313f29110bcd8073cc1e65c
|
|
| BLAKE2b-256 |
5ca474b9510cf2922fb923f6330fd47c049e9e89d984d6dd445c82a85ce7c4e9
|