Skip to content

Commit

Permalink
Merge pull request #658 from pyiron/qol_workflow_reprs
Browse files Browse the repository at this point in the history
Qol workflow reprs
  • Loading branch information
liamhuber authored May 2, 2023
2 parents 0bb62ee + 7f13219 commit 5a2b8bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions .ci_support/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- coveralls
- coverage
- codacy-coverage
- ipython
- matplotlib =3.7.1
- numpy =1.24.3
- pyiron_base =0.5.36
Expand Down
6 changes: 3 additions & 3 deletions notebooks/workflow_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "baec001264424daf8fbb8ca2bb4a7aad",
"model_id": "322f7f0435944dd2a35b2e6821f6d2db",
"version_major": 2,
"version_minor": 0
},
Expand Down Expand Up @@ -492,7 +492,7 @@
"output_type": "stream",
"text": [
"n1 n1 n1 (GreaterThanHalf) output single-value: False\n",
"n2 n2 <pyiron_contrib.workflow.node.Node object at 0x14dabb7d0>\n",
"n2 n2 <pyiron_contrib.workflow.node.Node object at 0x1441b1990>\n",
"n3 n3 n3 (GreaterThanHalf) output single-value: False\n",
"n4 n4 n4 (GreaterThanHalf) output single-value: False\n",
"n5 n5 n5 (GreaterThanHalf) output single-value: False\n"
Expand Down Expand Up @@ -681,7 +681,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "80a9eac6-9953-4105-8c70-c1e14a698564",
"id": "cab89cc8-2409-4bdb-8b50-ccdf48e9ec5d",
"metadata": {},
"outputs": [],
"source": []
Expand Down
4 changes: 3 additions & 1 deletion pyiron_contrib/workflow/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import typing
from abc import ABC, abstractmethod
from json import dumps
from warnings import warn

from pyiron_contrib.workflow.has_channel import HasChannel
Expand Down Expand Up @@ -198,8 +199,9 @@ def __str__(self):

def to_dict(self):
d = super().to_dict()
d["value"] = self.value
d["value"] = repr(self.value)
d["ready"] = self.ready
return d


class InputData(DataChannel):
Expand Down
6 changes: 5 additions & 1 deletion pyiron_contrib/workflow/has_to_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from abc import ABC, abstractmethod
from json import dumps

from IPython.display import JSON


class HasToDict(ABC):
@abstractmethod
Expand All @@ -10,6 +12,8 @@ def to_dict(self):
def _repr_json_(self):
return self.to_dict()

@property
def info(self):
print(dumps(self.to_dict(), indent=2))

def repr_json(self):
return JSON(self.to_dict())
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
],
'workflow': [
'python>=3.10',
'ipython',
'typeguard==3.0.2'
]
},
Expand Down

0 comments on commit 5a2b8bc

Please sign in to comment.