-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update docs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update * update docs * bump version --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2ef4756
commit 4822680
Showing
23 changed files
with
697 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
CLI | ||
cli | ||
=== | ||
.. automodule:: zntrack.cli | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
Core | ||
core | ||
==== | ||
.. automodule:: zntrack.core | ||
.. automodule:: zntrack.core.node | ||
:members: | ||
|
||
.. automodule:: zntrack.core.nodify | ||
:members: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exceptions | ||
========== | ||
|
||
.. automodule:: zntrack.exceptions | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Fields | ||
========== | ||
|
||
DVC Fields | ||
---------- | ||
|
||
.. automodule:: zntrack.fields.dvc | ||
:members: | ||
|
||
Zn Fields | ||
--------- | ||
|
||
.. automodule:: zntrack.fields.zn | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,7 @@ API Documentation | |
:maxdepth: 2 | ||
|
||
core | ||
project | ||
cli | ||
utils | ||
dvc | ||
zn | ||
meta | ||
metadata | ||
exceptions | ||
fields |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Project | ||
======= | ||
|
||
.. automodule:: zntrack.project | ||
:members: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
.. _userdoc-project: | ||
|
||
Project | ||
======= | ||
You can run ZnTrack nodes in three different ways. | ||
Let's assume the following two nodes: | ||
|
||
.. code-block:: python | ||
import zntrack | ||
class AddOne(zntrack.Node): | ||
parameter: int = zntrack.zn.params() | ||
outputs: int = zntrack.zn.outputs() | ||
def run(self): | ||
self.outputs = self.parameter + 1 | ||
class SubtractOne(zntrack.Node): | ||
parameter: int = zntrack.zn.deps() | ||
outputs: int = zntrack.zn.outputs() | ||
def run(self): | ||
self.outputs = self.parameter - 1 | ||
Direct Use | ||
---------- | ||
ZnTrack Nodes are designed to be used as regular Python classes. | ||
This allows for easy debugging and testing. | ||
Typically, you would use :ref:`target to eager graph` or :ref:`target to dvc graph` for production. | ||
|
||
.. code-block:: python | ||
node1 = AddOne(parameter=1) | ||
node1.run() | ||
node2 = SubtractOne(parameter=node1.outputs) | ||
node2.run() | ||
assert node1.outputs == 2 | ||
assert node2.outputs == 1 | ||
.. _target to eager graph: | ||
|
||
Eager graph | ||
----------- | ||
You can use ZnTrack without DVC. | ||
This closely resembles the `ZnFlow <https://github.com/zincware/znflow>`_ package. | ||
ZnTrack is built on top of it. | ||
The general API would look as follows: | ||
|
||
.. code-block:: python | ||
with zntrack.Project() as project: | ||
node1 = AddOne(parameter=1) | ||
node2 = SubtractOne(parameter=node1.outputs) | ||
project.run(eager=True) | ||
assert node1.outputs == 2 | ||
assert node2.outputs == 1 | ||
.. _target to dvc graph: | ||
|
||
DVC | ||
--- | ||
The main purpose of ZnTrack is to use it with DVC. | ||
If you use ``project.run()`` it will serialize the Nodes inside the project and run them with DVC. | ||
You can use ``project.run(repro=False)`` to only build the graph and execute it later. | ||
|
||
.. code-block:: python | ||
with zntrack.Project() as project: | ||
node1 = AddOne(parameter=1) | ||
node2 = SubtractOne(parameter=node1.outputs) | ||
project.run() | ||
node1.load() | ||
node2.load() | ||
assert node1.outputs == 2 | ||
assert node2.outputs == 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.