This Package I have created (*hackwrap*) on May-9-2025, it's a python *decorator-based* package that you can push the boundaries of python rules with it, I saw some of people misunderstanding the usage of this package, so I said why not to tell you about it:
import hackwrap
@hackwrap.endless
def endless_function():
return "this will never return if not thredified"
print(endless_function()) # and it goes forever
4. promote a function to global scope
import hackwrap
def outer_function():
@hackwrap.globe
def inner_function():
print('Called from local scope')
outer_function() # call this function to make python read the wrapper
inner_function() # Called from local scope
7. return something when a function is mentioned (my favorite part :)):
import hackwrap
@hackwrap.onment(lambda: hackwrap.this.func()) # onment callback must be a callable
@hackwrap.update_this
def prop():
return 10 # you can replace this with anything you want
print(prop) # 10 (or whatever the function prop returnes)
print(hackwrap.this.func) # <function prop at ...>
the `hackwrap.onment` calls the given call back when one of the function attributes is activated, like, \_\_str\_\_, \_\_add\_\_, \_\_gt\_\_, etc...
`hackwrap.update_this` updates the global `hackwrap.this` variable which refers to the current function.
8. making un-mangled functions private:
\# example *.py*
import hackwrap
@hackwrap.private
def private_function(a, b): return a + b
print(private_function(45, 78)) # 123
\# main *.py*
import example
print(example.private_function(45, 78)) # NameError
9. making mangled public:
\# example *.py*
import hackwrap
@hackwrap.public
def __public_one(a, b): return a + b
\# main *.py*
import example
print(example.__public_one(45, 78)) # 123
10. turn async to sync:
import hackwrap
@hackwrap.snc
async def add(a, b):
return a + b
print(add(10, 56)) # 66
11. auto-threadify functions:
import hackwrap, time
@hackwrap.threadify
def main():
while True:
print("I'll be Threaded")
main()
time.sleep(1) # keep printing for a second
12. skipping del keyword:
import hackwrap
@hackwrap.undeletable
def hello():
print("I'm still there")
del hello
hello() # I'm still there
1. equivalent of `async`:
2. inherit from a class: 3. endless functions: 4. promote a function to global scope 5. inherit from a function: 6. inherit from a module: 7. return something when a function is mentioned (my favorite part :)): the `hackwrap.onment` calls the given call back when one of the function attributes is activated, like, \_\_str\_\_, \_\_add\_\_, \_\_gt\_\_, etc... `hackwrap.update_this` updates the global `hackwrap.this` variable which refers to the current function.8. making un-mangled functions private:
\# example *.py*
\# main *.py* 9. making mangled public:\# example *.py*
\# main *.py* 10. turn async to sync: 11. auto-threadify functions: 12. skipping del keyword: 13. simulate functions inheriting from variables: hope you find that Interesting