Skip to content

Commit

Permalink
Update README.md (#849)
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ authored Nov 20, 2024
1 parent b6de59d commit 898b26e
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,6 @@ print(hello_world.random_number)
An overview of all the ZnTrack features as well as more detailed examples can be
found in the [ZnTrack Documentation](https://zntrack.readthedocs.io/en/latest/).
## Wrap Python Functions
ZnTrack also provides tools to convert a Python function into a DVC Node. This
approach is much more lightweight compared to the class-based approach with only
a reduced set of functionality. Therefore, it is recommended for smaller nodes
that do not need the additional toolset that the class-based approach provides.
```python
from zntrack import nodify, NodeConfig
import pathlib
@nodify(outs=pathlib.Path("text.txt"), params={"text": "Lorem Ipsum"})
def write_text(cfg: NodeConfig):
cfg.outs.write_text(
cfg.params.text
)
# build the DVC graph
with zntrack.Project() as project:
write_text()
project.run()
```
The `cfg` dataclass passed to the function provides access to all configured
files and parameters via [dot4dict](https://github.com/zincware/dot4dict). The
function body will be executed by the `dvc repro` command or if ran via
`write_text(run=True)`. All parameters are loaded from or stored in
`params.yaml`.
# Technical Details
## ZnTrack as an Object-Relational Mapping for DVC
Expand Down

0 comments on commit 898b26e

Please sign in to comment.