nextpipe


Namenextpipe JSON
Version 0.1.0.dev7 PyPI version JSON
download
home_pageNone
SummaryFramework for Decision Pipeline modeling and execution
upload_time2025-03-22 00:27:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
license# LICENSE Business Source License 1.1 Parameters Licensor: nextmv.io inc Licensed Work: nextpipe Change Date: Four years from the date the Licensed Work is published. Change License: GPLv3 For information about alternative licensing arrangements for the Software, please email info@nextmv.io. Notice The Business Source License (this document, or the “License”) is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License. License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc. ----------------------------------------------------------------------------- ## Terms The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use. Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate. If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work. All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor. You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work. Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work. This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the trademark “Business Source License”, as long as you comply with the Covenants of Licensor below. ## Covenants of Licensor In consideration of the right to use this License’s text and the “Business Source License” name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor: To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where “compatible” means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text “None” to specify a Change Date. Not to modify this License in any other way. License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
keywords decision automation decision engineering decision pipelines decision science decision workflows decisions nextmv operations research optimization pipelines workflows
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nextpipe

Framework for Decision Pipeline modeling and execution.

## Installation

```bash
pip install nextpipe
```

## Preview

Example of a pipeline utilizing multiple routing solvers, and picking the best result.

```mermaid
graph LR
  fetch_data(prepare_data)
  fetch_data --> run_nextroute
  fetch_data --> run_ortools
  fetch_data --> run_pyvroom
  run_nextroute{ }
  run_nextroute_join{ }
  run_nextroute_0(run_nextroute_0)
  run_nextroute --> run_nextroute_0
  run_nextroute_0 --> run_nextroute_join
  run_nextroute_1(run_nextroute_1)
  run_nextroute --> run_nextroute_1
  run_nextroute_1 --> run_nextroute_join
  run_nextroute_2(run_nextroute_2)
  run_nextroute --> run_nextroute_2
  run_nextroute_2 --> run_nextroute_join
  run_nextroute_join --> pick_best
  run_ortools(run_ortools)
  run_ortools --> pick_best
  run_pyvroom(run_pyvroom)
  run_pyvroom --> pick_best
  pick_best(pick_best)
```

## Modeling

Pipeline modeling is done by defining a flow as steps and decorating them.
The following example demonstrates a 3 step pipeline that makes use of dynamic fanout and joining of results.

```python
from nextpipe import AppOption, AppRunConfig, FlowSpec, app, foreach, join, needs, step


class Flow(FlowSpec):
    @foreach()  # Run the successor step for each item in the result list of this step
    @step
    def prepare(data: dict):
        """
        Creates 3 copies of the input and configures them for 3 different app parameters.
        """
        inputs = [copy.deepcopy(data) for _ in range(3)]
        run_configs = [AppRunConfig(input, [AppOption("param", i)]) for i, input in enumerate(inputs)]
        return run_configs

    @app(app_id="echo")
    @needs(predecessors=[prepare])
    @step
    def solve():
        """
        Imitates a solver app.
        """
        pass

    @needs(predecessors=[solve])
    @join()  # Collect the results from the previous 'foreach' step and combine them into a list passed as the arg
    @step
    def merge(results: list[dict]):
        """Merges the results."""
        return results
```

The pipeline can simply be executed from the main func of the app.

```python
# Run workflow
flow = Flow("DecisionFlow", input.data)
flow.run()

# Write out the result
print(json.dumps(flow.get_result(flow.merge)))
```

## Examples

You can find further examples of how to use `nextpipe` in the [examples](./examples) directory.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nextpipe",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Nextmv <tech@nextmv.io>",
    "keywords": "decision automation, decision engineering, decision pipelines, decision science, decision workflows, decisions, nextmv, operations research, optimization, pipelines, workflows",
    "author": null,
    "author_email": "Nextmv <tech@nextmv.io>",
    "download_url": "https://files.pythonhosted.org/packages/12/c5/1536e44ee7c680b16bac3603a12e25a92b5e78d32165fb0680f4769a69d2/nextpipe-0.1.0.dev7.tar.gz",
    "platform": null,
    "description": "# nextpipe\n\nFramework for Decision Pipeline modeling and execution.\n\n## Installation\n\n```bash\npip install nextpipe\n```\n\n## Preview\n\nExample of a pipeline utilizing multiple routing solvers, and picking the best result.\n\n```mermaid\ngraph LR\n  fetch_data(prepare_data)\n  fetch_data --> run_nextroute\n  fetch_data --> run_ortools\n  fetch_data --> run_pyvroom\n  run_nextroute{ }\n  run_nextroute_join{ }\n  run_nextroute_0(run_nextroute_0)\n  run_nextroute --> run_nextroute_0\n  run_nextroute_0 --> run_nextroute_join\n  run_nextroute_1(run_nextroute_1)\n  run_nextroute --> run_nextroute_1\n  run_nextroute_1 --> run_nextroute_join\n  run_nextroute_2(run_nextroute_2)\n  run_nextroute --> run_nextroute_2\n  run_nextroute_2 --> run_nextroute_join\n  run_nextroute_join --> pick_best\n  run_ortools(run_ortools)\n  run_ortools --> pick_best\n  run_pyvroom(run_pyvroom)\n  run_pyvroom --> pick_best\n  pick_best(pick_best)\n```\n\n## Modeling\n\nPipeline modeling is done by defining a flow as steps and decorating them.\nThe following example demonstrates a 3 step pipeline that makes use of dynamic fanout and joining of results.\n\n```python\nfrom nextpipe import AppOption, AppRunConfig, FlowSpec, app, foreach, join, needs, step\n\n\nclass Flow(FlowSpec):\n    @foreach()  # Run the successor step for each item in the result list of this step\n    @step\n    def prepare(data: dict):\n        \"\"\"\n        Creates 3 copies of the input and configures them for 3 different app parameters.\n        \"\"\"\n        inputs = [copy.deepcopy(data) for _ in range(3)]\n        run_configs = [AppRunConfig(input, [AppOption(\"param\", i)]) for i, input in enumerate(inputs)]\n        return run_configs\n\n    @app(app_id=\"echo\")\n    @needs(predecessors=[prepare])\n    @step\n    def solve():\n        \"\"\"\n        Imitates a solver app.\n        \"\"\"\n        pass\n\n    @needs(predecessors=[solve])\n    @join()  # Collect the results from the previous 'foreach' step and combine them into a list passed as the arg\n    @step\n    def merge(results: list[dict]):\n        \"\"\"Merges the results.\"\"\"\n        return results\n```\n\nThe pipeline can simply be executed from the main func of the app.\n\n```python\n# Run workflow\nflow = Flow(\"DecisionFlow\", input.data)\nflow.run()\n\n# Write out the result\nprint(json.dumps(flow.get_result(flow.merge)))\n```\n\n## Examples\n\nYou can find further examples of how to use `nextpipe` in the [examples](./examples) directory.\n",
    "bugtrack_url": null,
    "license": "# LICENSE\n        \n        Business Source License 1.1\n        \n        Parameters\n        \n        Licensor:             nextmv.io inc\n        Licensed Work:        nextpipe\n        \n        Change Date:          Four years from the date the Licensed Work is published.\n        Change License:       GPLv3\n        \n        For information about alternative licensing arrangements for the Software,\n        please email info@nextmv.io.\n        \n        Notice\n        \n        The Business Source License (this document, or the \u201cLicense\u201d) is not an Open\n        Source license. However, the Licensed Work will eventually be made available\n        under an Open Source License, as stated in this License.\n        \n        License text copyright \u00a9 2023 MariaDB plc, All Rights Reserved. \u201cBusiness Source\n        License\u201d is a trademark of MariaDB plc.\n        \n        -----------------------------------------------------------------------------\n        \n        ## Terms\n        \n        The Licensor hereby grants you the right to copy, modify, create derivative\n        works, redistribute, and make non-production use of the Licensed Work. The\n        Licensor may make an Additional Use Grant, above, permitting limited production\n        use.\n        \n        Effective on the Change Date, or the fourth anniversary of the first publicly\n        available distribution of a specific version of the Licensed Work under this\n        License, whichever comes first, the Licensor hereby grants you rights under the\n        terms of the Change License, and the rights granted in the paragraph above\n        terminate.\n        \n        If your use of the Licensed Work does not comply with the requirements currently\n        in effect as described in this License, you must purchase a commercial license\n        from the Licensor, its affiliated entities, or authorized resellers, or you must\n        refrain from using the Licensed Work.\n        \n        All copies of the original and modified Licensed Work, and derivative works of\n        the Licensed Work, are subject to this License. This License applies separately\n        for each version of the Licensed Work and the Change Date may vary for each\n        version of the Licensed Work released by Licensor.\n        \n        You must conspicuously display this License on each original or modified copy of\n        the Licensed Work. If you receive the Licensed Work in original or modified form\n        from a third party, the terms and conditions set forth in this License apply to\n        your use of that work.\n        \n        Any use of the Licensed Work in violation of this License will automatically\n        terminate your rights under this License for the current and all other versions\n        of the Licensed Work.\n        \n        This License does not grant you any right in any trademark or logo of Licensor\n        or its affiliates (provided that you may use a trademark or logo of Licensor as\n        expressly required by this License).TO THE EXTENT PERMITTED BY APPLICABLE LAW,\n        THE LICENSED WORK IS PROVIDED ON AN \u201cAS IS\u201d BASIS. LICENSOR HEREBY DISCLAIMS ALL\n        WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION)\n        WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,\n        NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this\n        License\u2019s text to license your works, and to refer to it using the trademark\n        \u201cBusiness Source License\u201d, as long as you comply with the Covenants of Licensor\n        below.\n        \n        ## Covenants of Licensor\n        \n        In consideration of the right to use this License\u2019s text and the \u201cBusiness\n        Source License\u201d name and trademark, Licensor covenants to MariaDB, and to all\n        other recipients of the licensed work to be provided by Licensor:\n        \n        To specify as the Change License the GPL Version 2.0 or any later version, or a\n        license that is compatible with GPL Version 2.0 or a later version, where\n        \u201ccompatible\u201d means that software provided under the Change License can be\n        included in a program with software provided under GPL Version 2.0 or a later\n        version. Licensor may specify additional Change Licenses without limitation. To\n        either: (a) specify an additional grant of rights to use that does not impose\n        any additional restriction on the right granted in this License, as the\n        Additional Use Grant; or (b) insert the text \u201cNone\u201d to specify a Change Date.\n        Not to modify this License in any other way.\n        \n        License text copyright \u00a9 2023 MariaDB plc, All Rights Reserved. \u201cBusiness Source\n        License\u201d is a trademark of MariaDB plc.",
    "summary": "Framework for Decision Pipeline modeling and execution",
    "version": "0.1.0.dev7",
    "project_urls": {
        "Documentation": "https://www.nextmv.io/docs",
        "Homepage": "https://www.nextmv.io",
        "Repository": "https://github.com/nextmv-io/nextpipe"
    },
    "split_keywords": [
        "decision automation",
        " decision engineering",
        " decision pipelines",
        " decision science",
        " decision workflows",
        " decisions",
        " nextmv",
        " operations research",
        " optimization",
        " pipelines",
        " workflows"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "74b24ae6cb3e37f7fdd52e880dba11bea5211b89cdd690928c396ac0c4a3af20",
                "md5": "d81f7efc0d19a4e7af09d08d8b6ce911",
                "sha256": "c37a98cfa1a86c3632e62c6861e18c70c23e7d9fc2ea198f398eb06059b24153"
            },
            "downloads": -1,
            "filename": "nextpipe-0.1.0.dev7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d81f7efc0d19a4e7af09d08d8b6ce911",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 18486,
            "upload_time": "2025-03-22T00:27:00",
            "upload_time_iso_8601": "2025-03-22T00:27:00.510409Z",
            "url": "https://files.pythonhosted.org/packages/74/b2/4ae6cb3e37f7fdd52e880dba11bea5211b89cdd690928c396ac0c4a3af20/nextpipe-0.1.0.dev7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "12c51536e44ee7c680b16bac3603a12e25a92b5e78d32165fb0680f4769a69d2",
                "md5": "b8ca9babbccdbeb5c36faf2029ab3f89",
                "sha256": "428de8ef95756d299d1f52f418086f8a6dd5a94d9b01d01f66f45ab4f98e3435"
            },
            "downloads": -1,
            "filename": "nextpipe-0.1.0.dev7.tar.gz",
            "has_sig": false,
            "md5_digest": "b8ca9babbccdbeb5c36faf2029ab3f89",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 26392,
            "upload_time": "2025-03-22T00:27:01",
            "upload_time_iso_8601": "2025-03-22T00:27:01.872346Z",
            "url": "https://files.pythonhosted.org/packages/12/c5/1536e44ee7c680b16bac3603a12e25a92b5e78d32165fb0680f4769a69d2/nextpipe-0.1.0.dev7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-22 00:27:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nextmv-io",
    "github_project": "nextpipe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nextpipe"
}
        
Elapsed time: 1.05572s