Skip to content

Commit bea1367

Browse files
committed
Add even more images.
1 parent 80ce24a commit bea1367

File tree

8 files changed

+23
-66
lines changed

8 files changed

+23
-66
lines changed
56.3 KB
Loading
50 KB
Loading
55.3 KB
Loading
27.5 KB
Loading
26.6 KB
Loading

docs/source/tutorials/how_to_capture_output.rst

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ You can influence output capturing mechanisms from the command line:
4646

4747
.. code-block:: console
4848
49-
pytask -s # disable all capturing
50-
pytask --capture=sys # replace sys.stdout/stderr with in-mem files
51-
pytask --capture=fd # also point filedescriptors 1 and 2 to temp file
52-
pytask --capture=tee-sys # combines 'sys' and '-s', capturing sys.stdout/stderr
53-
# and passing it along to the actual sys.stdout/stderr
49+
$ pytask -s # disable all capturing
50+
$ pytask --capture=sys # replace sys.stdout/stderr with in-mem files
51+
$ pytask --capture=fd # also point filedescriptors 1 and 2 to temp file
52+
$ pytask --capture=tee-sys # combines 'sys' and '-s', capturing sys.stdout/stderr
53+
# and passing it along to the actual sys.stdout/stderr
5454
5555
5656
Using print statements for debugging
@@ -75,24 +75,4 @@ print statements for debugging:
7575
and running this module will show you precisely the output of the failing function and
7676
hide the other one:
7777

78-
.. code-block:: console
79-
80-
$ pytask -s
81-
========================= Start pytask session =========================
82-
Platform: win32 -- Python 3.x.x, pytask 0.x.x, pluggy 0.13.x
83-
Root: .
84-
Collected 2 task(s).
85-
86-
F.
87-
=============================== Failures ===============================
88-
_________________ Task task_capture.py::task_func2 failed ______________
89-
90-
Traceback (most recent call last):
91-
File "task_capture.py", line 7, in task_func2
92-
assert False
93-
AssertionError
94-
95-
---------------------- Captured stdout during call ---------------------
96-
Debug statement.
97-
98-
==================== 1 succeeded, 1 failed in 0.01s ====================
78+
.. image:: /_static/images/how-to-capture-output.png

docs/source/tutorials/how_to_debug.rst

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,19 @@ Tracebacks
1212
----------
1313

1414
You can enrich the display of tracebacks by showing local variables in each stack frame.
15-
Just execute pytask with
15+
Just execute pytask with :confval:`show_locals`, meaning ``pytask --show-locals``.
1616

17-
.. code-block:: console
18-
19-
$ pytask --show-locals
17+
.. image:: /_static/images/how-to-debug-show-locals.png
2018

2119

2220
Debugging
2321
---------
2422

25-
Running
26-
27-
.. code-block:: console
23+
Using :confval:`pdb` enables the post-mortem debugger. Whenever an exception is raised
24+
inside a task, the prompt will enter the debugger enabling you to find out the cause of
25+
the exception.
2826

29-
$ pytask --pdb
30-
31-
enables the post-mortem debugger. Whenever an exception is raised inside a task, the
32-
prompt will enter the debugger enabling you to discover the source of the exception.
27+
.. image:: /_static/images/how-to-debug-pdb.png
3328

3429
.. seealso::
3530

@@ -46,11 +41,9 @@ prompt will enter the debugger enabling you to discover the source of the except
4641
Tracing
4742
-------
4843

49-
If you want to enter the debugger at the start of every task, use
50-
51-
.. code-block:: console
44+
If you want to enter the debugger at the start of every task, use :confval:`trace`.
5245

53-
$ pytask --trace
46+
.. image:: /_static/images/how-to-debug-trace.png
5447

5548

5649
Custom debugger

docs/source/tutorials/how_to_write_a_task.rst

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ How to write a task
44
Starting 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

Comments
 (0)