๐ฑ Turn any object into a module ๐ฑ
Project Links
Meta
Author: Tom Ritchford
Requires Python: >=3.8
Classifiers
License
- OSI Approved :: MIT License
Programming Language
- Python :: 3
- Python :: 3.8
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
๐ฑ 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
Jan 04, 2024
1.8.1
Dec 29, 2023
1.8.0
Dec 28, 2023
1.7.2
Dec 28, 2023
1.7.1
Dec 28, 2023
1.7.0
Dec 28, 2023
1.6.1
Oct 05, 2023
1.6.0
Jul 09, 2023
1.5.0
Feb 25, 2023
1.4.0
Jun 06, 2022
1.3.2
Jun 06, 2022
1.3.1
Dec 01, 2020
1.3.0
Nov 17, 2020
1.2.1
Nov 16, 2020
1.2.0
Nov 14, 2020
1.1.3
Oct 08, 2020
1.1.2
Sep 02, 2020
1.1.1
Jul 26, 2020
1.1.0
Jul 22, 2020
1.0.1
Jul 18, 2020
1.0.0
Wheel compatibility matrix
Files in release
No dependencies