starstar ✨ ✨¶
Finally! Variable keyword tracing in Python.
Because this makes me sad:
def main(**kw):
function_with_a_bunchhhh_of_arguments(**kw) # I only want to pass some of **kw !!
another_function_with_a_bunchhhh_of_arguments(**kw) # and put the other half here !!!
# hmmm let's see what can I pass to this function...
help(main) # main(**kw)
# HALP????? aljdsflaksjdflkasjd
😖😭😭
And why can’t we have: 🧞♀️ 🧚🏻♀️ ✨ ✨
import starstar
def function_a(a=1, b=2, c=3): ...
def function_b(x=8, y=9, z=10): ...
@starstar.traceto(function_a, function_b)
def main(**kw):
kw_a, kw_b = starstar.divide(kw, function_a, function_b)
function_a(**kw_a) # gets: a, b, c
function_b(**kw_b) # gets: x, y, z
# hmmm let's see what can I pass to this function...
help(main) # main(a=1, b=2, c=3, x=8, y=9, z=10)
# yayyyy!!!
😇🥰🌈
Installation¶
pip install starstar
Contributions¶
If you have feature requests or ideas on how to make this package better, please open an issue!
This package covers a Python pain point that I’ve been wanting a solution for
for a while now, and until now, I handled it through one off functions in some
util.py
per project. This project is about rejecting the notion that there
is a trade-off between developer convenience and good documentation. You
shouldn’t have to choose between tons of duplicate arguments and docstrings,
kitchen-sink functions, and un-introspectable code.
You should be able to not repeat yourself, break things up into smaller functions, and use function-introspection tools to build automagical user interfaces!