22
33In the previous tutorials and how-to guides, you learned that dependencies and products
44can be represented as plain Python objects with
5- [ pytask.PythonNode] ( ../api/nodes_and_tasks.md#pytask.PythonNode ) or as paths where every
5+ [ ` pytask.PythonNode ` ] ( ../api/nodes_and_tasks.md#pytask.PythonNode ) or as paths where every
66[ ` pathlib.Path ` ] [ ] is converted to a
7- [ pytask.PathNode] ( ../api/nodes_and_tasks.md#pytask.PathNode ) .
7+ [ ` pytask.PathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PathNode ) .
88
99In this how-to guide, you will learn about the general concept of nodes and how to write
1010your own to improve your workflows.
@@ -21,7 +21,7 @@ paths to point to inputs and outputs and call [`pandas.read_pickle`][] and
2121```
2222
2323To remove IO operations from the task and delegate them to pytask, we will replicate the
24- [ pytask.PickleNode] ( ../api/nodes_and_tasks.md#pytask.PickleNode ) that automatically
24+ [ ` pytask.PickleNode ` ] ( ../api/nodes_and_tasks.md#pytask.PickleNode ) that automatically
2525loads and stores Python objects.
2626
2727And we pass the value to ` df ` via [ ` typing.Annotated ` ] [ ] to preserve
@@ -49,15 +49,15 @@ A custom node needs to follow an interface so that pytask can perform several ac
4949- Load and save values when tasks are executed.
5050
5151This interface is defined by protocols. A custom node must follow at least the protocol
52- [ pytask.PNode] ( ../api/nodes_and_tasks.md#pytask.PNode ) or, even better,
53- [ pytask.PPathNode] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) if it is based on a path.
54- The common node for paths, [ pytask.PathNode] ( ../api/nodes_and_tasks.md#pytask.PathNode ) ,
55- follows the protocol [ pytask.PPathNode] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) .
52+ [ ` pytask.PNode ` ] ( ../api/nodes_and_tasks.md#pytask.PNode ) or, even better,
53+ [ ` pytask.PPathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) if it is based on a path.
54+ The common node for paths, [ ` pytask.PathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PathNode ) ,
55+ follows the protocol [ ` pytask.PPathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) .
5656
5757## ` PickleNode `
5858
59- Since our [ pytask.PickleNode] ( ../api/nodes_and_tasks.md#pytask.PickleNode ) will only
60- vary slightly from [ pytask.PathNode] ( ../api/nodes_and_tasks.md#pytask.PathNode ) , we use
59+ Since our [ ` pytask.PickleNode ` ] ( ../api/nodes_and_tasks.md#pytask.PickleNode ) will only
60+ vary slightly from [ ` pytask.PathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PathNode ) , we use
6161it as a template, and with some minor modifications, we arrive at the following class.
6262
6363``` py
@@ -67,7 +67,7 @@ it as a template, and with some minor modifications, we arrive at the following
6767Here are some explanations.
6868
6969- The node does not need to inherit from the protocol
70- [ pytask.PPathNode] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) , but you can do it to
70+ [ ` pytask.PPathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PPathNode ) , but you can do it to
7171 be more explicit.
7272
7373- The node has two attributes
@@ -88,7 +88,7 @@ Here are some explanations.
8888 For custom nodes, make sure the lockfile id stays stable and unique within a task.
8989
9090- The classmethod
91- [ pytask.PickleNode.from_path] ( ../api/nodes_and_tasks.md#pytask.PickleNode.from_path )
91+ [ ` pytask.PickleNode.from_path ` ] ( ../api/nodes_and_tasks.md#pytask.PickleNode.from_path )
9292 is a convenient method to instantiate the class.
9393
9494- The method
@@ -101,7 +101,7 @@ Here are some explanations.
101101 [ ` pytask.PickleNode.load ` ] ( ../api/nodes_and_tasks.md#pytask.PickleNode.load ) when it
102102 collects the values of function arguments to run the function. The argument
103103 ` is_product ` signals that the node is loaded as a product with a
104- [ pytask.Product] ( ../api/utilities_and_typing.md#pytask.Product ) annotation or via
104+ [ ` pytask.Product ` ] ( ../api/utilities_and_typing.md#pytask.Product ) annotation or via
105105 ` produces ` .
106106
107107 When the node is loaded as a dependency, we want to inject the value of the pickle
@@ -127,8 +127,8 @@ Nodes are an important in concept pytask. They allow to pytask to build a
127127IO operations from the task function into the nodes.
128128
129129pytask only implements two node types,
130- [ pytask.PathNode] ( ../api/nodes_and_tasks.md#pytask.PathNode ) and
131- [ pytask.PythonNode] ( ../api/nodes_and_tasks.md#pytask.PythonNode ) , but many more are
130+ [ ` pytask.PathNode ` ] ( ../api/nodes_and_tasks.md#pytask.PathNode ) and
131+ [ ` pytask.PythonNode ` ] ( ../api/nodes_and_tasks.md#pytask.PythonNode ) , but many more are
132132possible. In the future, there should probably be a [ plugin] ( ../glossary.md#plugin ) that
133133implements nodes for many other data sources like AWS S3 or databases. See
134134[ Kedro datasets] ( https://docs.kedro.org/en/stable/kedro_datasets.html ) for one example.
0 commit comments