how does target work?

22 views
Skip to first unread message

Fotis Jannidis

unread,
Jul 9, 2020, 11:58:09 PM7/9/20
to python-doit

Hi all, I am trying to figure out, when doit is not executing an action. I thought I understood this from the tutorial, that it won't execute an action of the target exists (no check for change) and the dependencies have changed or are removed.

But when I use the example from the tutorial, it is always executed although the target exists. The [dodo.py]

DOIT_CONFIG = {
 'verbosity': 2
 }


def task_hello():
    """hello"""

    def python_hello(targets):
        with open(targets[0], "a") as output:
            output.write("Python says Hello World!!!\n")

    return {
        'actions': [python_hello],
        'targets': ["hello.txt"],
        }
   
After the first run the file hello.txt (and the database etc.) is created, so I assumed in the next run it won't be executed, but it is everytime I run doit.
I am using Python 3.7.6 (Windows 10) and doit (0, 32, 0). And I am starting doit on the commandline>python -m doit
Obviously I am missing something, but I cannot see what. Thanks in advance.

Eduardo Schettino

unread,
Jul 10, 2020, 12:04:48 AM7/10/20
to python-doit

--
You received this message because you are subscribed to the Google Groups "python-doit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python-doit/7282763e-fb1e-415d-983c-61823a805ed7n%40googlegroups.com.

Fotis Jannidis

unread,
Jul 10, 2020, 6:57:34 AM7/10/20
to python-doit
Thanks for the quick and helpful reply!

I read about 20 pages of the documentation (Tutorial and Tasks, which has a section on dependencies) without coming across this information, so I could imagine that it would be helpful to communicate this earlier,  especially because the behavior is not very intuitive and doit behaves here differently compared to similar tools. Maybe move it to the section ' Dependencies & Targets' in Tasks?
best wishes
Reply all
Reply to author
Forward
0 new messages