flowdump
NiPype-1 workflow serializer for use with flowview.
Installation
flowdump is available on PyPI and can be installed with pip:
pip install flowdump
Usage
Using flowdump is as simple as calling run_and_save_workflow on a NiPype-1 workflow object.
This will execute the workflow and save the pre- and post-execution workflow data to JSON files.
import nipype.pipeline.engine as pe # pypeline engine
from flowdump import run_and_save_workflow
# Typical NiPype workflow creation
amazing_workflow = pe.Workflow(name="main_workflow")
# amazing_workflow.connect(...)
# amazing_workflow.connect(...)
# amazing_workflow.connect(...)
# Let `flowdump` execute and save pre- and post-execution data.
run_and_save_workflow(
amazing_workflow,
out_dir='my/target/dir'
)
Advanced:
If more control over the workflow execution is needed, the workflow can be serialized manually.
import nipype.pipeline.engine as pe # pypeline engine
import os.path
from flowdump import WorkflowJSONMeta, save_workflow_json
# Typical NiPype workflow creation
amazing_workflow = pe.Workflow(name="main_workflow")
# amazing_workflow.connect(...)
# amazing_workflow.connect(...)
# amazing_workflow.connect(...)
# Create workflow metadata object (traces execution time and stage)
workflow_meta = WorkflowJSONMeta(
pipeline_name='My amazing pipeline',
stage='pre'
)
# Dump pre-execution workflow
save_workflow_json(
filename=os.path.join('my/target/dir', workflow_meta.filename()),
workflow=amazing_workflow,
meta=workflow_meta
)
# Execute NiPype workflow
amazing_workflow_result = amazing_workflow.run()
# Update metadata
workflow_meta.stage = 'post'
# Dump post-execution workflow
save_workflow_json(
filename=os.path.join('my/target/dir', workflow_meta.filename()),
workflow=amazing_workflow_result,
meta=workflow_meta
)
Custom field serialization
Custom serializers can be implemented for projects with custom NiPype Node types.
The serializer is a function that takes a the default flowdump serializer
function (to optionally fall back to) and an object and returns a JSON-serializable
object.
def my_custom_serializer(
flowdump_serializer: Callable[[object], object],
obj: object
):
if isinstance(obj, MyType):
return my_make_string(obj)
return flowdump_serializer(obj)
save_workflow_json(
filename=os.path.join('my/target/dir', workflow_meta.filename()),
workflow=amazing_workflow_result,
meta=workflow_meta
)
Metadata
Release files for flowdump 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| flowdump-0.1.2.tar.gz | 15.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flowdump-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.6 kB
Release files / flowdump-0.1.2.tar.gz
| Download URL | flowdump-0.1.2.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8613e11db1172cc55186e3d02749da1e26fa3b839ec9a30b67414ee0c939b21f
|
|
BLAKE2b-256 checksum How to use checksums |
e2ff22b9d0da9291b9ecf3b5f0903a6888bb0e196658cb73a9ec3b9825665602
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.10 Windows/10
|
Release files / flowdump-0.1.2-py3-none-any.whl
| Download URL | flowdump-0.1.2-py3-none-any.whl |
|---|---|
| Size | 17.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64496fc2217f53ae73b9344a2cf099a0a338422cb454d90189cee343baf98b7e
|
|
BLAKE2b-256 checksum How to use checksums |
b66de411014a15b0cb8891d8ead1ef06d8aa61815cf25b0008b08a32848b7283
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.10 Windows/10
|
Security for flowdump 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.