Skip to content

Commit c70aebb

Browse files
Rename force parameter of publish_as_nanopub to publish_steps
1 parent 4c7e964 commit c70aebb

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

fairworkflows/fairworkflow.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def draw(self, filepath):
473473
'Cannot produce visualization of RDF, you need to install '
474474
'graphviz dependency https://graphviz.org/')
475475

476-
def publish_as_nanopub(self, use_test_server=False, force=False, **kwargs):
476+
def publish_as_nanopub(self, use_test_server=False, publish_steps=False, **kwargs):
477477
"""Publish to nanopub server.
478478
479479
Publish the workflow as nanopublication to the nanopub server.
@@ -483,8 +483,9 @@ def publish_as_nanopub(self, use_test_server=False, force=False, **kwargs):
483483
484484
Args:
485485
use_test_server (bool): Toggle using the test nanopub server.
486-
force (bool): Toggle publishing the workflow with force. This will publish all
487-
unpublished steps first before publishing the workflow
486+
publish_steps (bool): Toggle publishing publishing all unpublished steps first before
487+
publishing the workflow. (Otherwise an exception is raised and unpublished steps
488+
need to be published manually first)
488489
kwargs: Keyword arguments to be passed to [nanopub.Publication.from_assertion](
489490
https://nanopub.readthedocs.io/en/latest/reference/publication.html#
490491
nanopub.publication.Publication.from_assertion).
@@ -497,7 +498,7 @@ def publish_as_nanopub(self, use_test_server=False, force=False, **kwargs):
497498
for step in self:
498499
if step.is_modified or not step._is_published:
499500
self._is_modified = True # If one of the steps is modified the workflow is too.
500-
if force:
501+
if publish_steps:
501502
step.publish_as_nanopub(use_test_server=use_test_server, **kwargs)
502503
else:
503504
raise RuntimeError(f'{step} was not published yet, please publish steps first, '

tests/test_fairworkflow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def test_publish_as_nanopub(self, mock_publish, test_workflow):
278278
with pytest.raises(RuntimeError):
279279
# 'Publishing a workflow with unpublished steps must raise RunTimeError...'
280280
test_workflow.publish_as_nanopub()
281-
# ...unless using force
282-
pubinfo = test_workflow.publish_as_nanopub(force=True)
281+
# ...unless using pubish_steps=True
282+
pubinfo = test_workflow.publish_as_nanopub(publish_steps=True)
283283
assert pubinfo['concept_uri'] == 'www.example.org/published_workflow#workflow'
284284
assert mock_publish.call_count == 4 # 1 workflow, 3 steps
285285
for step in test_workflow:

0 commit comments

Comments
 (0)