Name | aiida-grouppathx JSON |
Version |
0.2.2
JSON |
| download |
home_page | None |
Summary | AiiDA plugin provides the GroupPathX class |
upload_time | 2024-08-27 09:43:04 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
aiida
plugin
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
[![Build Status][ci-badge]][ci-link]
[![Coverage Status][cov-badge]][cov-link]
[![PyPI version][pypi-badge]][pypi-link]
# aiida-grouppathx
AiiDA plugin provides the `GroupPathX` class.
This plugin was kickstarted using
[AiiDA plugin cutter](https://github.com/aiidateam/aiida-plugin-cutter),
intended to help developers get started with their AiiDA plugins.
## Features and usage
Interactive example at: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/zhubonan/aiida-nbexamples/HEAD)
This package is provides a enhanced version of `GroupPath` - `GroupPathX`.
The main feature is that it allows nodes stored under a group to be *named* by an alias.
This way, one can address a specific `Node` as `GroupPath('mygroup/structure1')`.
In addition, a `show_tree` method is provided for visualising the content of a specific `GroupPathX`,
similiar to the command line tool `tree` that works on the file system.
The goal is to provide a way for managing data with an interface what is similar to a file system based approach.
```
tree aiida_grouppathx
aiida_grouppathx
├── __init__.py
├── pathx.py
└── __pycache__
├── __init__.cpython-38.pyc
└── pathx.cpython-38.pyc
```
In analogy:
```python
from aiida_grouppathx import GroupPathX
path = GroupPathX('group1')
path.get_or_create_group()
path['group2'].get_or_create_group()
path.add_node(Int(1).store(), 'int1')
path['group2'].add_node(Int(1).store(), 'int2')
path.show_tree()
```
gives
```
group1
├── group2
│ └── int2 *
└── int1 *
```
where the `*` highlights that a leaf is a `Node` rather than a group.
This kind of mark up can be customised, for example, to show the status of workflow nodes.
```python
def decorate_name(path):
if path.is_node:
return ' ' + str(path.get_node())
path.show_tree(decorate_name)
```
gives:
```
group1
├── group2
│ └── int2 uuid: de79d244-d3bb-4f61-9d3a-b3f09e1afb72 (pk: 7060) value: 1
└── int1 uuid: e2f70643-0c25-4ae5-929a-a3e055969d10 (pk: 7059) value: 1
```
Multiple decorators can be combined
```
from aiida_grouppathx import decorate_with_group_names, decorate_with_label decorate_with_uuid_first_n
path.show_tree(decorate_with_group_names, decorate_with_label, decorate_with_uuid_first_n())
```
output:
```
group1
├── group2
│ └── int2 group1/group2 | | de79d244-d3b
└── int1 group1 | | e2f70643-0c2
```
The stored nodes can be access through:
```
group1['group2/int2'].get_node() # Gives node de89d2
group1.browse.group2.int2().get_node() # Also gives node de89d2
```
and also
```
path.browse.<tab>
path.browse.int1() # To access the `group1/int1` path
path.browse.int1().get_node() # To access the `group1/int1` node
```
Please see the `pathx.py` for the extended methods, and the official documentation for the concept of `GroupPath`.
The package does not change how `Group` and `Node` operates in the AiiDA.
It is only built on top of the existing system as an alternative way to access the underlying data.
## Installation
```shell
pip install aiida-grouppathx
verdi quicksetup # better to set up a new profile
```
## Development
```shell
git clone https://github.com/zhubonan/aiida-grouppathx .
cd aiida-grouppathx
pip install --upgrade pip
pip install -e .[pre-commit,testing] # install extra dependencies
pre-commit install # install pre-commit hooks
pytest -v # discover and run all tests
```
See the [developer guide](http://aiida-grouppathx.readthedocs.io/en/latest/developer_guide/index.html) for more information.
## License
MIT
## Contact
zhubonan@outlook.com
[ci-badge]: https://github.com/zhubonan/aiida-grouppathx/workflows/ci/badge.svg?branch=master
[ci-link]: https://github.com/zhubonan/aiida-grouppathx/actions
[cov-badge]: https://coveralls.io/repos/github/zhubonan/aiida-grouppathx/badge.svg?branch=master
[cov-link]: https://coveralls.io/github/zhubonan/aiida-grouppathx?branch=master
[docs-badge]: https://readthedocs.org/projects/aiida-grouppathx/badge
[docs-link]: http://aiida-grouppathx.readthedocs.io/
[pypi-badge]: https://badge.fury.io/py/aiida-grouppathx.svg
[pypi-link]: https://badge.fury.io/py/aiida-grouppathx
Raw data
{
"_id": null,
"home_page": null,
"name": "aiida-grouppathx",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "aiida, plugin",
"author": null,
"author_email": "Bonan Zhu <zhubonan@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/f5/41/debad1c7366349c074a81a5d18bd49a0495edb762b86b2c335cbb764b090/aiida_grouppathx-0.2.2.tar.gz",
"platform": null,
"description": "[![Build Status][ci-badge]][ci-link]\n[![Coverage Status][cov-badge]][cov-link]\n[![PyPI version][pypi-badge]][pypi-link]\n\n# aiida-grouppathx\n\nAiiDA plugin provides the `GroupPathX` class.\n\nThis plugin was kickstarted using\n[AiiDA plugin cutter](https://github.com/aiidateam/aiida-plugin-cutter),\nintended to help developers get started with their AiiDA plugins.\n\n## Features and usage\n\nInteractive example at: [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/zhubonan/aiida-nbexamples/HEAD)\n\n\n This package is provides a enhanced version of `GroupPath` - `GroupPathX`.\n The main feature is that it allows nodes stored under a group to be *named* by an alias.\n This way, one can address a specific `Node` as `GroupPath('mygroup/structure1')`.\n In addition, a `show_tree` method is provided for visualising the content of a specific `GroupPathX`,\n similiar to the command line tool `tree` that works on the file system.\n The goal is to provide a way for managing data with an interface what is similar to a file system based approach.\n\n ```\n tree aiida_grouppathx\n\naiida_grouppathx\n\u251c\u2500\u2500 __init__.py\n\u251c\u2500\u2500 pathx.py\n\u2514\u2500\u2500 __pycache__\n \u251c\u2500\u2500 __init__.cpython-38.pyc\n \u2514\u2500\u2500 pathx.cpython-38.pyc\n```\n\nIn analogy:\n\n```python\nfrom aiida_grouppathx import GroupPathX\npath = GroupPathX('group1')\npath.get_or_create_group()\npath['group2'].get_or_create_group()\npath.add_node(Int(1).store(), 'int1')\npath['group2'].add_node(Int(1).store(), 'int2')\n\npath.show_tree()\n```\n\ngives\n\n```\ngroup1\n\u251c\u2500\u2500 group2\n\u2502 \u2514\u2500\u2500 int2 *\n\u2514\u2500\u2500 int1 *\n```\n\nwhere the `*` highlights that a leaf is a `Node` rather than a group.\nThis kind of mark up can be customised, for example, to show the status of workflow nodes.\n\n```python\ndef decorate_name(path):\n if path.is_node:\n return ' ' + str(path.get_node())\npath.show_tree(decorate_name)\n```\n\ngives:\n\n```\ngroup1\n\u251c\u2500\u2500 group2\n\u2502 \u2514\u2500\u2500 int2 uuid: de79d244-d3bb-4f61-9d3a-b3f09e1afb72 (pk: 7060) value: 1\n\u2514\u2500\u2500 int1 uuid: e2f70643-0c25-4ae5-929a-a3e055969d10 (pk: 7059) value: 1\n```\n\nMultiple decorators can be combined\n\n```\nfrom aiida_grouppathx import decorate_with_group_names, decorate_with_label decorate_with_uuid_first_n\n\npath.show_tree(decorate_with_group_names, decorate_with_label, decorate_with_uuid_first_n())\n```\n\noutput:\n\n```\ngroup1\n\u251c\u2500\u2500 group2\n\u2502 \u2514\u2500\u2500 int2 group1/group2 | | de79d244-d3b\n\u2514\u2500\u2500 int1 group1 | | e2f70643-0c2\n```\n\n\nThe stored nodes can be access through:\n\n```\ngroup1['group2/int2'].get_node() # Gives node de89d2\ngroup1.browse.group2.int2().get_node() # Also gives node de89d2\n```\n\nand also\n\n```\npath.browse.<tab>\npath.browse.int1() # To access the `group1/int1` path\npath.browse.int1().get_node() # To access the `group1/int1` node\n```\n\nPlease see the `pathx.py` for the extended methods, and the official documentation for the concept of `GroupPath`.\n\nThe package does not change how `Group` and `Node` operates in the AiiDA.\nIt is only built on top of the existing system as an alternative way to access the underlying data.\n\n## Installation\n\n```shell\npip install aiida-grouppathx\nverdi quicksetup # better to set up a new profile\n```\n\n## Development\n\n```shell\ngit clone https://github.com/zhubonan/aiida-grouppathx .\ncd aiida-grouppathx\npip install --upgrade pip\npip install -e .[pre-commit,testing] # install extra dependencies\npre-commit install # install pre-commit hooks\npytest -v # discover and run all tests\n```\n\nSee the [developer guide](http://aiida-grouppathx.readthedocs.io/en/latest/developer_guide/index.html) for more information.\n\n## License\n\nMIT\n## Contact\n\nzhubonan@outlook.com\n\n\n[ci-badge]: https://github.com/zhubonan/aiida-grouppathx/workflows/ci/badge.svg?branch=master\n[ci-link]: https://github.com/zhubonan/aiida-grouppathx/actions\n[cov-badge]: https://coveralls.io/repos/github/zhubonan/aiida-grouppathx/badge.svg?branch=master\n[cov-link]: https://coveralls.io/github/zhubonan/aiida-grouppathx?branch=master\n[docs-badge]: https://readthedocs.org/projects/aiida-grouppathx/badge\n[docs-link]: http://aiida-grouppathx.readthedocs.io/\n[pypi-badge]: https://badge.fury.io/py/aiida-grouppathx.svg\n[pypi-link]: https://badge.fury.io/py/aiida-grouppathx\n\n",
"bugtrack_url": null,
"license": null,
"summary": "AiiDA plugin provides the GroupPathX class",
"version": "0.2.2",
"project_urls": {
"Source": "https://github.com/zhubonan/aiida-grouppathx"
},
"split_keywords": [
"aiida",
" plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0493214df58dcc23e82cd30696a1ced8584f93e85e1b24e5ccae5b9ec941bc77",
"md5": "30e1ee33b7bc3a4380d7404d7ece8d04",
"sha256": "5b2a2acf771b645bef696180b66bee28d660df92618c8955648ba0c92303e467"
},
"downloads": -1,
"filename": "aiida_grouppathx-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "30e1ee33b7bc3a4380d7404d7ece8d04",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 10291,
"upload_time": "2024-08-27T09:43:03",
"upload_time_iso_8601": "2024-08-27T09:43:03.195732Z",
"url": "https://files.pythonhosted.org/packages/04/93/214df58dcc23e82cd30696a1ced8584f93e85e1b24e5ccae5b9ec941bc77/aiida_grouppathx-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f541debad1c7366349c074a81a5d18bd49a0495edb762b86b2c335cbb764b090",
"md5": "6aa51573f05b5098870b0d57e3899167",
"sha256": "0ec96ebc217801a1ae84625f8a1bca569bceba4814618dbd2276c176ec2409ad"
},
"downloads": -1,
"filename": "aiida_grouppathx-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "6aa51573f05b5098870b0d57e3899167",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 11662,
"upload_time": "2024-08-27T09:43:04",
"upload_time_iso_8601": "2024-08-27T09:43:04.026356Z",
"url": "https://files.pythonhosted.org/packages/f5/41/debad1c7366349c074a81a5d18bd49a0495edb762b86b2c335cbb764b090/aiida_grouppathx-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-27 09:43:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zhubonan",
"github_project": "aiida-grouppathx",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aiida-grouppathx"
}