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

Allow for Node Attribute dependencies #255

Merged
merged 9 commits into from
Mar 16, 2022
Merged

Allow for Node Attribute dependencies #255

merged 9 commits into from
Mar 16, 2022

Conversation

PythonFZ
Copy link
Member

@PythonFZ PythonFZ commented Mar 15, 2022

This PR allows you to directly depend on other nodes attributes and not only rely on the full Node.

class Node1(Node):
    outs: int = zn.outs()
    
class Node2(Node):
    node_1_outs: int = zn.deps(getdeps(Node1, "outs"))
    # or
    node_1_outs: int = zn.deps(getdeps(Node1.load(name="nodename"), "outs"))
    # or
    node_1_outs: int = zn.deps(getdeps(Node1["nodename"], "outs"))

TODOs

  • check type hints for getdeps
  • write tests for properties
  • update affected_files to include only the required files. This is not possible, because e.g. property dependencies can not be evaluated (easily)
  • update documentation (include new load method via getitem)

@codecov
Copy link

codecov bot commented Mar 15, 2022

Codecov Report

Merging #255 (469491d) into main (3fd818b) will increase coverage by 0.20%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##             main     #255      +/-   ##
==========================================
+ Coverage   71.42%   71.63%   +0.20%     
==========================================
  Files          25       26       +1     
  Lines        1071     1100      +29     
  Branches      208      211       +3     
==========================================
+ Hits          765      788      +23     
- Misses        283      288       +5     
- Partials       23       24       +1     
Flag Coverage Δ
unittests 71.63% <77.77%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
zntrack/zn/__init__.py 82.35% <0.00%> (ø)
zntrack/utils/serializer.py 76.05% <58.33%> (-2.64%) ⬇️
zntrack/zn/dependencies.py 88.23% <88.23%> (ø)
zntrack/__init__.py 100.00% <100.00%> (ø)
zntrack/core/dvcgraph.py 72.10% <100.00%> (+0.19%) ⬆️
zntrack/utils/helpers.py 90.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fd818b...469491d. Read the comment docs.

@PythonFZ PythonFZ marked this pull request as ready for review March 16, 2022 12:49
@PythonFZ PythonFZ merged commit 2745f62 into main Mar 16, 2022
@PythonFZ PythonFZ deleted the add_getdesc branch March 16, 2022 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant