@@ -4,9 +4,9 @@ How to write a task
44Starting from the project structure in the :doc: `previous tutorial
55<how_to_set_up_a_project>`, this tutorial teaches you how to write your first task.
66
7- The task will be defined in ``src/task_data_preparation.py `` and it will generate
8- artificial data which will be stored in ``bld/data.pkl ``. We will call the function in
9- the module :func: `task_create_random_data `.
7+ The task will be defined in ``src/my_project/ task_data_preparation.py `` and it will
8+ generate artificial data which will be stored in ``bld/data.pkl ``. We will call the
9+ function in the module :func: `task_create_random_data `.
1010
1111.. code-block ::
1212
@@ -33,7 +33,7 @@ Here, we define the function
3333
3434 import pytask
3535 import numpy as np
36- import pandas as np
36+ import pandas as pd
3737
3838 from my_project.config import BLD
3939
@@ -57,31 +57,15 @@ To let pytask track the product of the task, you need to use the
5757 You learn more about adding dependencies and products to a task in the next
5858 :doc: `tutorial <how_to_define_dependencies_products >`.
5959
60- To execute the task, type the following command in your shell.
60+ Now, execute pytask which will automatically collect tasks in the current directory and
61+ subsequent directories.
6162
62- .. code-block :: console
63-
64- $ pytask task_data_preparation.py
65- ========================= Start pytask session =========================
66- Platform: linux -- Python 3.x.y, pytask 0.x.y, pluggy 0.x.y
67- Root: xxx
68- Collected 1 task(s).
69-
70- .
71- ======================= 1 succeeded in 1 second ========================
72-
73- Executing
74-
75- .. code-block :: console
76-
77- $ pytask
78-
79- would collect all tasks in the current working directory and in all subsequent folders.
63+ .. image :: /_static/images/how-to-write-a-task.png
8064
8165.. important ::
8266
83- By default, pytask assumes that tasks are functions in modules whose names are both
84- prefixed with ``task_ ``.
67+ By default, pytask assumes that tasks are functions and both, the function name and
68+ the module name, must be prefixed with ``task_ ``.
8569
8670 Use the configuration value :confval: `task_files ` if you prefer a different naming
8771 scheme for the task modules.
0 commit comments