@@ -57,20 +57,47 @@ Here is an example where you want to run ``script.do``.
5757 def task_run_do_file ():
5858 pass
5959
60- Note that, you need to apply the ``@pytask.mark.stata `` marker so that pytask-stata
61- handles the task. The do-file must be the first dependency. Other dependencies can be
62- added after that.
60+
61+ Multiple dependencies and products
62+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
64+ What happens if a task has more dependencies? Using a list, the do-file which should be
65+ executed must be found in the first position of the list.
6366
6467.. code-block :: python
6568
6669 @pytask.mark.stata
6770 @pytask.mark.depends_on ([" script.do" , " input.dta" ])
68- @pytask.mark.produces (" out.dta" )
71+ @pytask.mark.produces (" output.dta" )
72+ def task_run_do_file ():
73+ pass
74+
75+ If you use a dictionary to pass dependencies to the task, pytask-stata will, first, look
76+ for a ``"source" `` key in the dictionary and, secondly, under the key ``0 ``.
77+
78+ .. code-block :: python
79+
80+ @pytask.mark.depends_on ({" source" : " script.do" , " input" : " input.dta" })
81+ def task_run_do_file ():
82+ pass
83+
84+
85+ # or
86+
87+
88+ @pytask.mark.depends_on ({0 : " script.do" , " input" : " input.dta" })
89+ def task_run_do_file ():
90+ pass
91+
92+
93+ # or two decorators for the function, if you do not assign a name to the input.
94+
95+
96+ @pytask.mark.depends_on ({" source" : " script.do" })
97+ @pytask.mark.depends_on (" input.dta" )
6998 def task_run_do_file ():
7099 pass
71100
72- If you are wondering why the function body is empty, know that pytask-stata replaces the
73- body with a predefined internal function which will execute the do-file.
74101
75102
76103 Command Line Arguments
@@ -142,7 +169,7 @@ include the ``@pytask.mark.stata`` decorator in the parametrization just like wi
142169 @pytask.mark.depends_on (" script.do" )
143170 @pytask.mark.parametrize (
144171 " produces, stata" ,
145- [(" output_1.dta" , 1 ) , (" output_2.dta" , 2 )],
172+ [(" output_1.dta" , ( " 1 " ,)) , (" output_2.dta" , ( " 2 " ,) )],
146173 )
147174 def task_execute_do_file ():
148175 pass
@@ -180,6 +207,14 @@ stata_check_log_lines
180207
181208 $ pytask build --stata-check-log-lines 10
182209
210+ stata_source_key
211+ If you want to change the name of the key which identifies the do file, change the
212+ following default configuration in your pytask configuration file.
213+
214+ .. code-block :: ini
215+
216+ stata_source_key = source
217+
183218
184219 Changes
185220-------
0 commit comments