xmod

1.8.1last stable release 1 year ago
Complexity Score
Low
Open Issues
N/A
Dependent Projects
10
Weekly Downloadsglobal
290,330

License

  • MIT
    • Yesattribution
    • Permissivelinking
    • Permissivedistribution
    • Permissivemodification
    • Nopatent grant
    • Yesprivate use
    • Permissivesublicensing
    • Notrademark grant

Downloads

Loading Weekly Download Data

Readme

🌱 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

Dependencies

Loading dependencies...

CVE IssuesActive
0
Scorecards Score
3.40
Test Coverage
No Data
Follows Semver
Yes
Github Stars
4
Dependenciestotal
0
DependenciesOutdated
0
DependenciesDeprecated
0
Threat Modelling
No Data
Repo Audits
No Data

Learn how to distribute xmod in your own private PyPI registry

pip install xmod
Processing...
Done

Releases

Loading Version Data
PyPI on Cloudsmith

Getting started with PyPI on Cloudsmith is fast and easy.