Makefiles are fantastic tools. They help us automate stuff.
I often run commands like : make epub or make docs or make site etc
I have a simple makefile where I write in shell code. And make simplifies my life
The commands we write inside makefile are actually shell commands.
Is there a way to write a python file. and run its functions like make.
For example:
Makefile
hi:
echo hi this is makefile
func:
# ... some work
- We can run
makewhich would execute stuff under hi, - while running
make funcwould execute lines under func. - If there is no Makefile, make would do nothing
Now A python alternative would look like this
'''
hi this is python do file
'''
def func():
# stuff here
- Running
adowould print the docstring. and running
ado funcwould run func.If there is no do.py file in current directory then ado would do nothing
Top comments (3)
check out pypyr.io/
it's free + open-source. What you describe is pretty much exactly what it does :-)
(declaration of interest: I created it. :-) If you have questions/need help, just ask!)
GitHub is here: github.com/pypyr/pypyr
Thanks a lot @yaythomas
pypyr is really great
Today, I found invoke github.com/pyinvoke/invoke