Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine zn.deps and zn.nodes to zntrack.deps #719

Merged
merged 19 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 49 additions & 44 deletions examples/docs/09_lazy.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Initialized empty Git repository in /tmp/tmp9xwenc20/.git/\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Initialized empty Git repository in /tmp/tmp45orcu_7/.git/\n",
"Initialized DVC repository.\n",
"\n",
"You can now commit the changes to git.\n",
Expand Down Expand Up @@ -132,7 +126,10 @@
},
"outputs": [],
"source": [
"class PrintOption(zntrack.zn.Output):\n",
"from zntrack.fields.zn.options import Output\n",
"\n",
"\n",
"class PrintOption(Output):\n",
" def __init__(self):\n",
" super().__init__(dvc_option=\"outs\", use_repr=False)\n",
" # zntrack will try dvc --PrintOption outs.json\n",
Expand All @@ -155,7 +152,18 @@
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_3870159/2524714966.py:2: DeprecationWarning: Use 'zntrack.params' instead.\n",
" start = zntrack.zn.params()\n",
"/tmp/ipykernel_3870159/2524714966.py:3: DeprecationWarning: Use 'zntrack.params' instead.\n",
" stop = zntrack.zn.params()\n"
]
}
],
"source": [
"class RandomNumber(zntrack.Node):\n",
" start = zntrack.zn.params()\n",
Expand Down Expand Up @@ -211,20 +219,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Running DVC command: 'repro'\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u0000"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Running DVC command: 'repro'\n",
"\u0000"
]
}
Expand All @@ -247,7 +242,15 @@
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u0000"
]
}
],
"source": [
"random_number.load(lazy=False)"
]
Expand Down Expand Up @@ -275,7 +278,7 @@
{
"data": {
"text/plain": [
"710"
"598"
]
},
"execution_count": 9,
Expand Down Expand Up @@ -351,7 +354,7 @@
{
"data": {
"text/plain": [
"710"
"598"
]
},
"execution_count": 11,
Expand Down Expand Up @@ -386,7 +389,16 @@
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_3870159/790841409.py:2: DeprecationWarning: Use 'zntrack.deps' instead.\n",
" deps = zntrack.zn.deps()\n"
]
}
],
"source": [
"class AddOne(zntrack.Node):\n",
" deps = zntrack.zn.deps()\n",
Expand Down Expand Up @@ -797,7 +809,7 @@
{
"data": {
"text/plain": [
"36"
"71"
]
},
"execution_count": 17,
Expand Down Expand Up @@ -825,7 +837,7 @@
{
"data": {
"text/plain": [
"36"
"71"
]
},
"execution_count": 18,
Expand All @@ -852,7 +864,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 19,
"metadata": {
"collapsed": false,
"jupyter": {
Expand Down Expand Up @@ -882,8 +894,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"Running DVC command: 'repro'\n",
"\u0000Running DVC command: 'stage add --name RandomNumber --force ...'\n"
"Running DVC command: 'repro'\n"
]
},
{
Expand All @@ -897,6 +908,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"\u0000Running DVC command: 'stage add --name RandomNumber --force ...'\n",
"\u0000"
]
},
Expand Down Expand Up @@ -968,7 +980,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 20,
"metadata": {
"collapsed": false,
"jupyter": {
Expand All @@ -983,7 +995,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"585 == 585 == 585\n"
"3008 == 3008 == 3008\n"
]
}
],
Expand All @@ -999,7 +1011,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 21,
"metadata": {
"collapsed": false,
"jupyter": {
Expand All @@ -1014,7 +1026,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"1365 != 1783 != 585\n"
"1647 != 849 != 3008\n"
]
}
],
Expand All @@ -1035,7 +1047,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"metadata": {
"collapsed": false,
"jupyter": {
Expand All @@ -1049,13 +1061,6 @@
"source": [
"temp_dir.cleanup()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ZnTrack"
version = "0.6.3"
version = "0.7.0"
description = "Create, Run and Benchmark DVC Pipelines in Python"
authors = ["zincwarecode <zincwarecode@gmail.com>"]
license = "Apache-2.0"
Expand All @@ -17,9 +17,10 @@ pandas = "^2"
typer = "^0.7.0"

dot4dict = "^0.1.1"
zninit = "^0.1.9"
zninit = "^0.1.11"
znjson = "^0.2.2"
znflow = "^0.1.14"
typing-extensions = "^4.8.0"


[tool.poetry.urls]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_combine_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ def run(self):


class AddOneToList(zntrack.Node):
data = zntrack.zn.deps()
data = zntrack.deps()
outs = zntrack.zn.outs()

def run(self) -> None:
self.outs = [x + 1 for x in self.data]


class AddOneToDict(zntrack.Node):
data = zntrack.zn.deps()
data = zntrack.deps()
outs = zntrack.zn.outs()

def run(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_example_02.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def run(self):
class ComputeAB(zntrack.Node):
"""Node stage AB, depending on A&B"""

a: ComputeA = zntrack.zn.deps()
b: ComputeB = zntrack.zn.deps()
a: ComputeA = zntrack.deps()
b: ComputeB = zntrack.deps()
out = zntrack.zn.outs()
param = zntrack.zn.params("default")

Expand Down
8 changes: 4 additions & 4 deletions tests/integration/test_example_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ def run(self):


class AddOne(zntrack.Node):
inp = zntrack.zn.deps()
inp = zntrack.deps()
number = zntrack.zn.outs()

def run(self):
self.number = self.inp.number + 1


class SubtractOne(zntrack.Node):
inp = zntrack.zn.deps()
inp = zntrack.deps()
number = zntrack.zn.outs()

def run(self):
Expand All @@ -27,7 +27,7 @@ def run(self):
class Summation(zntrack.Node):
"""Stage that is actually tested, containing the multiple dependencies"""

inp = zntrack.zn.deps()
inp = zntrack.deps()
number = zntrack.zn.outs()

def run(self):
Expand All @@ -40,7 +40,7 @@ class SummationTuple(zntrack.Node):
Additionally testing for tuple conversion here!
"""

inp = zntrack.zn.deps()
inp = zntrack.deps()
number = zntrack.zn.outs()

def run(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_node_node_getitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def run(self):


class AddList(zntrack.Node):
a = zntrack.zn.deps()
b = zntrack.zn.deps()
a = zntrack.deps()
b = zntrack.deps()

output = zntrack.zn.outs()

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_node_nwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def run(self):

class FileToOuts(zntrack.Node):
# although, this is a file path, it has to be zn.deps
file = zntrack.zn.deps()
file = zntrack.deps()
text = zntrack.zn.outs()

def run(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_none_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


class LoadFromDeps(zntrack.Node):
data = zntrack.zn.deps()
data = zntrack.deps()
file: pathlib.Path = zntrack.dvc.deps()

result = zntrack.zn.outs()
Expand Down
Loading
Loading