aiida-workgraph


Nameaiida-workgraph JSON
Version 0.6.0 PyPI version JSON
download
home_pageNone
SummaryDesign flexible node-based workflow for AiiDA calculation.
upload_time2025-07-26 08:48:19
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords aiida workflows
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AiiDA-WorkGraph
[![PyPI version](https://badge.fury.io/py/aiida-workgraph.svg)](https://badge.fury.io/py/aiida-workgraph)
[![Unit test](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml)
[![codecov](https://codecov.io/gh/aiidateam/aiida-workgraph/branch/main/graph/badge.svg)](https://codecov.io/gh/aiidateam/aiida-workgraph)
[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)

Efficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.



## Installation

```console
    pip install aiida-workgraph
```

To install the latest version from source, first clone the repository and then install using `pip`:

```console
git clone https://github.com/aiidateam/aiida-workgraph
cd aiida-workgraph
pip install -e .
```


## Documentation
Explore the comprehensive [documentation](https://aiida-workgraph.readthedocs.io/en/latest/) to discover all the features and capabilities of AiiDA Workgraph.

## Demo
Visit the [Workgraph Collections repository](https://github.com/superstar54/workgraph-collections) to see demonstrations of how to utilize AiiDA Workgraph for different computational codes.

## Examples
Suppose we want to calculate ```(x + y) * z ``` in two steps. First, add `x` and `y`, then multiply the result with `z`.

```python
from aiida_workgraph import WorkGraph, task

# define add task
@task()
def add(x, y):
    return x + y

# define multiply task
@task()
def multiply(x, y):
    return x*y

# Create a workgraph to link the tasks.
wg = WorkGraph("test_add_multiply")
wg.add_task(add, name="add1")
wg.add_task(multiply, name="multiply1")
wg.add_link(wg.tasks.add1.outputs.result, wg.tasks.multiply1.inputs.x)

```

Prepare inputs and run the workflow:

```python
from aiida import load_profile

load_profile()

wg.run(inputs = {"add1": {"x": 2, "y": 3}, "multiply1": {"y": 4}})
print("Result of multiply1 is", wg.tasks.multiply1.outputs.result.value)
```
## Web ui
To use the web ui, first install the web ui package:
```console
pip install aiida-workgraph-web-ui
```
Then, start the web app with the following command:
```console

workgraph web start
```

Then visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` WorkGraph, click the pk and view the WorkGraph.

<img src="docs/source/_static/images/first-workflow.png" />


One can also generate the node graph from the process:
```console
verdi node generate pk
```

<img src="docs/source/_static/images/add_multiply.png"/>


## Development

### Pre-commit and Tests
To contribute to this repository, please enable pre-commit so the code in commits are conform to the standards.
```console
pip install -e .[tests,pre-commit]
pre-commit install
```

## License
[MIT](http://opensource.org/licenses/MIT)


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aiida-workgraph",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "aiida, workflows",
    "author": null,
    "author_email": "Xing Wang <xingwang1991@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8e/e0/61a415145ac4a15e06b10fcf3aaa92796b726a2238d4362c5125540e9a0c/aiida_workgraph-0.6.0.tar.gz",
    "platform": null,
    "description": "# AiiDA-WorkGraph\n[![PyPI version](https://badge.fury.io/py/aiida-workgraph.svg)](https://badge.fury.io/py/aiida-workgraph)\n[![Unit test](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml/badge.svg)](https://github.com/aiidateam/aiida-workgraph/actions/workflows/ci.yaml)\n[![codecov](https://codecov.io/gh/aiidateam/aiida-workgraph/branch/main/graph/badge.svg)](https://codecov.io/gh/aiidateam/aiida-workgraph)\n[![Docs status](https://readthedocs.org/projects/aiida-workgraph/badge)](http://aiida-workgraph.readthedocs.io/)\n\nEfficiently design and manage flexible workflows with AiiDA, featuring an interactive GUI, checkpoints, provenance tracking, error-resistant, and remote execution capabilities.\n\n\n\n## Installation\n\n```console\n    pip install aiida-workgraph\n```\n\nTo install the latest version from source, first clone the repository and then install using `pip`:\n\n```console\ngit clone https://github.com/aiidateam/aiida-workgraph\ncd aiida-workgraph\npip install -e .\n```\n\n\n## Documentation\nExplore the comprehensive [documentation](https://aiida-workgraph.readthedocs.io/en/latest/) to discover all the features and capabilities of AiiDA Workgraph.\n\n## Demo\nVisit the [Workgraph Collections repository](https://github.com/superstar54/workgraph-collections) to see demonstrations of how to utilize AiiDA Workgraph for different computational codes.\n\n## Examples\nSuppose we want to calculate ```(x + y) * z ``` in two steps. First, add `x` and `y`, then multiply the result with `z`.\n\n```python\nfrom aiida_workgraph import WorkGraph, task\n\n# define add task\n@task()\ndef add(x, y):\n    return x + y\n\n# define multiply task\n@task()\ndef multiply(x, y):\n    return x*y\n\n# Create a workgraph to link the tasks.\nwg = WorkGraph(\"test_add_multiply\")\nwg.add_task(add, name=\"add1\")\nwg.add_task(multiply, name=\"multiply1\")\nwg.add_link(wg.tasks.add1.outputs.result, wg.tasks.multiply1.inputs.x)\n\n```\n\nPrepare inputs and run the workflow:\n\n```python\nfrom aiida import load_profile\n\nload_profile()\n\nwg.run(inputs = {\"add1\": {\"x\": 2, \"y\": 3}, \"multiply1\": {\"y\": 4}})\nprint(\"Result of multiply1 is\", wg.tasks.multiply1.outputs.result.value)\n```\n## Web ui\nTo use the web ui, first install the web ui package:\n```console\npip install aiida-workgraph-web-ui\n```\nThen, start the web app with the following command:\n```console\n\nworkgraph web start\n```\n\nThen visit the page http://127.0.0.1:8000/workgraph, you should find a `first_workflow` WorkGraph, click the pk and view the WorkGraph.\n\n<img src=\"docs/source/_static/images/first-workflow.png\" />\n\n\nOne can also generate the node graph from the process:\n```console\nverdi node generate pk\n```\n\n<img src=\"docs/source/_static/images/add_multiply.png\"/>\n\n\n## Development\n\n### Pre-commit and Tests\nTo contribute to this repository, please enable pre-commit so the code in commits are conform to the standards.\n```console\npip install -e .[tests,pre-commit]\npre-commit install\n```\n\n## License\n[MIT](http://opensource.org/licenses/MIT)\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Design flexible node-based workflow for AiiDA calculation.",
    "version": "0.6.0",
    "project_urls": {
        "Documentation": "https://aiida-workgraph.readthedocs.io",
        "Source": "https://github.com/aiidateam/aiida-workgraph"
    },
    "split_keywords": [
        "aiida",
        " workflows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2473a3decd984250a94f5d9208112e1e6ab959ff107045eceeca0af39879960e",
                "md5": "69c269b94bd3a8da5576dfaa0e470e7c",
                "sha256": "646590e3c76f3ac44e4ec8eab7e9d007f4caf45c67d35d952090dec8f13e471b"
            },
            "downloads": -1,
            "filename": "aiida_workgraph-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "69c269b94bd3a8da5576dfaa0e470e7c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 93282,
            "upload_time": "2025-07-26T08:48:17",
            "upload_time_iso_8601": "2025-07-26T08:48:17.766014Z",
            "url": "https://files.pythonhosted.org/packages/24/73/a3decd984250a94f5d9208112e1e6ab959ff107045eceeca0af39879960e/aiida_workgraph-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8ee061a415145ac4a15e06b10fcf3aaa92796b726a2238d4362c5125540e9a0c",
                "md5": "47c7bffdfada393f406c2e5cd3b7805e",
                "sha256": "f435017a0d92c9e1da8ccdaea98df11db4356429405bbac7bbd70d3079fd6bb3"
            },
            "downloads": -1,
            "filename": "aiida_workgraph-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "47c7bffdfada393f406c2e5cd3b7805e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 70182,
            "upload_time": "2025-07-26T08:48:19",
            "upload_time_iso_8601": "2025-07-26T08:48:19.242348Z",
            "url": "https://files.pythonhosted.org/packages/8e/e0/61a415145ac4a15e06b10fcf3aaa92796b726a2238d4362c5125540e9a0c/aiida_workgraph-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-26 08:48:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aiidateam",
    "github_project": "aiida-workgraph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aiida-workgraph"
}
        
Elapsed time: 1.02121s