pyiron-database


Namepyiron-database JSON
Version 0.0.5 PyPI version JSON
download
home_pageNone
Summarypyiron_database - Your pyiron-like module.
upload_time2025-02-14 11:39:29
maintainerNone
docs_urlNone
authorNone
requires_python<3.13,>=3.9
licenseBSD 3-Clause License Copyright (c) 2024, Max-Planck-Institut für Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords pyiron
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # pyiron_module_template

## Instance Database Interface
```python
def store_node_outputs(node: Node) -> str:
    """
    Store a node's outputs into an HDF5 file.

    Args:
        node (Node): The node whose outputs should be stored.

    Returns:
        str: The file path where the node's outputs are stored.

    Raises:
        ValueError: If any output of the node is NOT_DATA.
    """

def restore_node_outputs(node: Node) -> bool:
    """
    Restore a node's outputs from a stored HDF5 file, given by node.hash.

    Args:
        node (Node): the node whose outputs should be restored.

    Returns:
        bool: True if the outputs were restored, False if not.
    """

def store_node_in_database(
    db: InstanceDatabase,
    node: Node,
    store_outputs: bool = False,
    store_input_nodes_recursively: bool = False,
) -> str:
    """
    Store a node in a database.

    This function stores all the information that is required to restore a node from the
    database. This includes the node's class, its inputs, its connected inputs and its
    outputs.

    Args:
        db (InstanceDatabase): The database to store the node in.
        node (Node): The node to store.
        store_outputs (bool): Whether to store the outputs of the node as well.
        store_input_nodes_recursively (bool): Whether to store all the nodes that are
            connected to the inputs of the node recursively.

    Returns:
        str: The hash of the stored node.
    """

def restore_node_from_database(
    db: InstanceDatabase, node_hash: str, parent: Workflow | None = None
) -> Node:
    """
    Restore a node from the database.

    The node is reconstructed from the database by calling recreate_node and
    adding it to the given parent workflow. The node's inputs are then restored
    either by connecting them to other nodes in the workflow or by setting their
    values directly.

    Args:
        db (InstanceDatabase): The InstanceDatabase instance to read from.
        node_hash (str): The hash of the node to restore.
        parent (Workflow | None): The workflow to add the restored node to.

    Returns:
        Node: The restored node.

    Raises:
        RuntimeError: If the node with the given hash is not found in the database.
    """

def get_hash(obj_to_be_hashed: Node | JSONGroup) -> str:
    """
    Calculate the hash of a given node or JSONGroup.

    Args:
        obj_to_be_hashed (Node | JSONGroup): the object whose hash should be calculated.

    Returns:
        str: the SHA-256 hash of the object.
    """
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyiron-database",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "pyiron",
    "author": null,
    "author_email": "Lorem Ipsum <lorem@ipsum.com>",
    "download_url": "https://files.pythonhosted.org/packages/53/85/bd14c7c856368507d16b41ec19814a8ac4f8b19b69a848409d44027b66db/pyiron_database-0.0.5.tar.gz",
    "platform": null,
    "description": "# pyiron_module_template\n\n## Instance Database Interface\n```python\ndef store_node_outputs(node: Node) -> str:\n    \"\"\"\n    Store a node's outputs into an HDF5 file.\n\n    Args:\n        node (Node): The node whose outputs should be stored.\n\n    Returns:\n        str: The file path where the node's outputs are stored.\n\n    Raises:\n        ValueError: If any output of the node is NOT_DATA.\n    \"\"\"\n\ndef restore_node_outputs(node: Node) -> bool:\n    \"\"\"\n    Restore a node's outputs from a stored HDF5 file, given by node.hash.\n\n    Args:\n        node (Node): the node whose outputs should be restored.\n\n    Returns:\n        bool: True if the outputs were restored, False if not.\n    \"\"\"\n\ndef store_node_in_database(\n    db: InstanceDatabase,\n    node: Node,\n    store_outputs: bool = False,\n    store_input_nodes_recursively: bool = False,\n) -> str:\n    \"\"\"\n    Store a node in a database.\n\n    This function stores all the information that is required to restore a node from the\n    database. This includes the node's class, its inputs, its connected inputs and its\n    outputs.\n\n    Args:\n        db (InstanceDatabase): The database to store the node in.\n        node (Node): The node to store.\n        store_outputs (bool): Whether to store the outputs of the node as well.\n        store_input_nodes_recursively (bool): Whether to store all the nodes that are\n            connected to the inputs of the node recursively.\n\n    Returns:\n        str: The hash of the stored node.\n    \"\"\"\n\ndef restore_node_from_database(\n    db: InstanceDatabase, node_hash: str, parent: Workflow | None = None\n) -> Node:\n    \"\"\"\n    Restore a node from the database.\n\n    The node is reconstructed from the database by calling recreate_node and\n    adding it to the given parent workflow. The node's inputs are then restored\n    either by connecting them to other nodes in the workflow or by setting their\n    values directly.\n\n    Args:\n        db (InstanceDatabase): The InstanceDatabase instance to read from.\n        node_hash (str): The hash of the node to restore.\n        parent (Workflow | None): The workflow to add the restored node to.\n\n    Returns:\n        Node: The restored node.\n\n    Raises:\n        RuntimeError: If the node with the given hash is not found in the database.\n    \"\"\"\n\ndef get_hash(obj_to_be_hashed: Node | JSONGroup) -> str:\n    \"\"\"\n    Calculate the hash of a given node or JSONGroup.\n\n    Args:\n        obj_to_be_hashed (Node | JSONGroup): the object whose hash should be calculated.\n\n    Returns:\n        str: the SHA-256 hash of the object.\n    \"\"\"\n```\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License\n        \n        Copyright (c) 2024, Max-Planck-Institut f\u00fcr Nachhaltige Materialien GmbH - Computational Materials Design (CM) Department\n        All rights reserved.\n        \n        Redistribution and use in source and binary forms, with or without\n        modification, are permitted provided that the following conditions are met:\n        \n        * Redistributions of source code must retain the above copyright notice, this\n          list of conditions and the following disclaimer.\n        \n        * Redistributions in binary form must reproduce the above copyright notice,\n          this list of conditions and the following disclaimer in the documentation\n          and/or other materials provided with the distribution.\n        \n        * Neither the name of the copyright holder nor the names of its\n          contributors may be used to endorse or promote products derived from\n          this software without specific prior written permission.\n        \n        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n        ",
    "summary": "pyiron_database - Your pyiron-like module.",
    "version": "0.0.5",
    "project_urls": {
        "Documentation": "https://pyiron_database.readthedocs.io",
        "Homepage": "https://pyiron.org/",
        "Repository": "https://github.com/pyiron/pyiron_database"
    },
    "split_keywords": [
        "pyiron"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "897c39bb69249f2d14bf26af172b7d0b8f9cb4dbe0b3cf384d8d9a13e28a34f9",
                "md5": "38218af7a151a1b14fee608dac088365",
                "sha256": "6343cadf5fbc794ccecfa6d3d23ba57df5c1f174783e2b27463e1a250cf73681"
            },
            "downloads": -1,
            "filename": "pyiron_database-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "38218af7a151a1b14fee608dac088365",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 23612,
            "upload_time": "2025-02-14T11:39:27",
            "upload_time_iso_8601": "2025-02-14T11:39:27.327373Z",
            "url": "https://files.pythonhosted.org/packages/89/7c/39bb69249f2d14bf26af172b7d0b8f9cb4dbe0b3cf384d8d9a13e28a34f9/pyiron_database-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5385bd14c7c856368507d16b41ec19814a8ac4f8b19b69a848409d44027b66db",
                "md5": "49129683488fa9701e48b579d92b7b54",
                "sha256": "9fd04d3874a22ec9535cbec71e5892203417a47fd42d5f9ecab2fd054764ad18"
            },
            "downloads": -1,
            "filename": "pyiron_database-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "49129683488fa9701e48b579d92b7b54",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 13521,
            "upload_time": "2025-02-14T11:39:29",
            "upload_time_iso_8601": "2025-02-14T11:39:29.637840Z",
            "url": "https://files.pythonhosted.org/packages/53/85/bd14c7c856368507d16b41ec19814a8ac4f8b19b69a848409d44027b66db/pyiron_database-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-14 11:39:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pyiron",
    "github_project": "pyiron_database",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pyiron-database"
}
        
Elapsed time: 0.39726s