shipyard-bp-utils


Nameshipyard-bp-utils JSON
Version 1.2.0 PyPI version JSON
download
home_pageNone
SummaryUtility functions for blueprints
upload_time2024-03-21 18:32:27
maintainerNone
docs_urlNone
authorwrp801
requires_python<4.0,>=3.9
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Shipyard BP Utils

Readme based of version 1.0.0a1

## Table of Contents

- [Overview](#overview)
    - [Args](#args)
    - [Artifacts](#artifacts)
        - [Logs](#logs)
        - [Responses](#responses)
        - [Variables](#variables)
    - [Custom Artifacts](#custom-artifacts)
    - [Files](#files)
    - [Text](#text)

### Overview

This package is a collection of utils that are intended for universal use across all Shipyard Blueprints.

#### Args

These Utils are used to handle common parsing of arguments from the application to the blueprint along with handling
common env var manipulations.

#### Artifacts

This util mainly manages the creation of files and folders so that the blueprint can store data for cross blueprint
communication.

By default, it has the following artifacts:

- logs: shipyard-vendor/artifacts/logs
- responses: shipyard-vendor/artifacts/responses
- variables: shipyard-vendor/artifacts/variables

##### Logs

This artifact is used to store logs that are generated by the blueprint. Prior to it was uses to store responses and
variables.
Currently, does not have a strong use case but later may be useful to add a handler to the Shipyard Logger to log to
this artifact.
Another use case which currently is most likely not be possible is to store the attempt logs

##### Responses

This artifact is used to store responses that are generated by the blueprint.
example

```python
from shipyard_bp_utils.artifacts import Artifacts

artifacts = Artifacts('jira')

response = jira.create_issue(fields=fields)
artifacts.responses.write_json('create_issue', response)
artifacts.variables.write_json('new_issue', response['issueId'])
```

if needed to pull values from another vessel you can do the following:

```python
from shipyard_bp_utils.artifacts import Artifacts

artifacts = Artifacts('jira')

response = artifacts.responses.read_json('create_issue')
```

##### Variables

This artifact is used to store variables that are generated by the blueprint.
The difference between the expectation of responses and variables is variables should contain the final result/side
effect of the vessal run that may be needed by another vessel and not the raw response details of individual responses
of a http requests.

for example:

```python
from shipyard_bp_utils.artifacts import Artifacts

artifacts = Artifacts('slack')

response = slack.send_message(channel=channel, text=text)
artifacts.responses.write_json('send_message', response)
artifacts.variables.write_json('message',
                               {'message_ts': response['ts'],
                                'channel': response['channel'],
                                'contain_attachment': False})
``` 

if needed to pull values from another vessel you can do the following:

```python
from shipyard_bp_utils.artifacts import Artifacts

artifacts = Artifacts('slack')

message_details = artifacts.variables.read_json('message')
# alternatively: message_details = artifacts.variables.read('message','json')
if message_details['contain_attachment']:
    print('There was a report sent this week')
else:
    print('There was no report sent this week. Did something go wrong?')
```

#### Custom Artifacts

You can also create custom artifacts if you need to store data that is not a response or variable.
For example, if you wanted to store the details of a user that was created by the blueprint you could do the following:

```python
from shipyard_bp_utils.artifacts import Artifacts

artifacts = Artifacts('jira')
artifacts.users = artifacts.SubFolder('users')

response = jira.users.write('create_user', 'name='
test_user
',**user_details)
response = jira.response.write_json('create_user', response)
```

Note: If you need the behaivor of what was once `logs.determine_base_artifact_folder` you can do the following:

```python
from shipyard_bp_utils.artifacts import Artifacts

base_artifact_folder = Artifacts('jira').base_folder
```

### Files

This util is used for common file manipulation and folder management.
It is used to create, read, update, and delete files and folders.

### Text

This util is used for common text manipulation.
Currently unused

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "shipyard-bp-utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "wrp801",
    "author_email": "wespoulsen@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/33/95/8548989f92d68f86515b57c1e8f55062f716c86479ea5d36bdcbba37295a/shipyard_bp_utils-1.2.0.tar.gz",
    "platform": null,
    "description": "# Shipyard BP Utils\n\nReadme based of version 1.0.0a1\n\n## Table of Contents\n\n- [Overview](#overview)\n    - [Args](#args)\n    - [Artifacts](#artifacts)\n        - [Logs](#logs)\n        - [Responses](#responses)\n        - [Variables](#variables)\n    - [Custom Artifacts](#custom-artifacts)\n    - [Files](#files)\n    - [Text](#text)\n\n### Overview\n\nThis package is a collection of utils that are intended for universal use across all Shipyard Blueprints.\n\n#### Args\n\nThese Utils are used to handle common parsing of arguments from the application to the blueprint along with handling\ncommon env var manipulations.\n\n#### Artifacts\n\nThis util mainly manages the creation of files and folders so that the blueprint can store data for cross blueprint\ncommunication.\n\nBy default, it has the following artifacts:\n\n- logs: shipyard-vendor/artifacts/logs\n- responses: shipyard-vendor/artifacts/responses\n- variables: shipyard-vendor/artifacts/variables\n\n##### Logs\n\nThis artifact is used to store logs that are generated by the blueprint. Prior to it was uses to store responses and\nvariables.\nCurrently, does not have a strong use case but later may be useful to add a handler to the Shipyard Logger to log to\nthis artifact.\nAnother use case which currently is most likely not be possible is to store the attempt logs\n\n##### Responses\n\nThis artifact is used to store responses that are generated by the blueprint.\nexample\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nartifacts = Artifacts('jira')\n\nresponse = jira.create_issue(fields=fields)\nartifacts.responses.write_json('create_issue', response)\nartifacts.variables.write_json('new_issue', response['issueId'])\n```\n\nif needed to pull values from another vessel you can do the following:\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nartifacts = Artifacts('jira')\n\nresponse = artifacts.responses.read_json('create_issue')\n```\n\n##### Variables\n\nThis artifact is used to store variables that are generated by the blueprint.\nThe difference between the expectation of responses and variables is variables should contain the final result/side\neffect of the vessal run that may be needed by another vessel and not the raw response details of individual responses\nof a http requests.\n\nfor example:\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nartifacts = Artifacts('slack')\n\nresponse = slack.send_message(channel=channel, text=text)\nartifacts.responses.write_json('send_message', response)\nartifacts.variables.write_json('message',\n                               {'message_ts': response['ts'],\n                                'channel': response['channel'],\n                                'contain_attachment': False})\n``` \n\nif needed to pull values from another vessel you can do the following:\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nartifacts = Artifacts('slack')\n\nmessage_details = artifacts.variables.read_json('message')\n# alternatively: message_details = artifacts.variables.read('message','json')\nif message_details['contain_attachment']:\n    print('There was a report sent this week')\nelse:\n    print('There was no report sent this week. Did something go wrong?')\n```\n\n#### Custom Artifacts\n\nYou can also create custom artifacts if you need to store data that is not a response or variable.\nFor example, if you wanted to store the details of a user that was created by the blueprint you could do the following:\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nartifacts = Artifacts('jira')\nartifacts.users = artifacts.SubFolder('users')\n\nresponse = jira.users.write('create_user', 'name='\ntest_user\n',**user_details)\nresponse = jira.response.write_json('create_user', response)\n```\n\nNote: If you need the behaivor of what was once `logs.determine_base_artifact_folder` you can do the following:\n\n```python\nfrom shipyard_bp_utils.artifacts import Artifacts\n\nbase_artifact_folder = Artifacts('jira').base_folder\n```\n\n### Files\n\nThis util is used for common file manipulation and folder management.\nIt is used to create, read, update, and delete files and folders.\n\n### Text\n\nThis util is used for common text manipulation.\nCurrently unused\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Utility functions for blueprints",
    "version": "1.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb896862bce18d1306e47dfd0d129d1fda5d38f0fefbc155d3c707250cecf7f7",
                "md5": "610549f226b7999eee5d20be3c6d84c7",
                "sha256": "790a5a0f561b58eb3e592764204b36e612d243bcbd46994747ba4130f5988e03"
            },
            "downloads": -1,
            "filename": "shipyard_bp_utils-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "610549f226b7999eee5d20be3c6d84c7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 9269,
            "upload_time": "2024-03-21T18:32:26",
            "upload_time_iso_8601": "2024-03-21T18:32:26.247302Z",
            "url": "https://files.pythonhosted.org/packages/eb/89/6862bce18d1306e47dfd0d129d1fda5d38f0fefbc155d3c707250cecf7f7/shipyard_bp_utils-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33958548989f92d68f86515b57c1e8f55062f716c86479ea5d36bdcbba37295a",
                "md5": "3405723a6d4efdc2cd34aff8228f4a98",
                "sha256": "bbed2cb71899462a73cd5d3f323315aa012ac81b7c1a193a49ebb17b75778372"
            },
            "downloads": -1,
            "filename": "shipyard_bp_utils-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3405723a6d4efdc2cd34aff8228f4a98",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 9117,
            "upload_time": "2024-03-21T18:32:27",
            "upload_time_iso_8601": "2024-03-21T18:32:27.778680Z",
            "url": "https://files.pythonhosted.org/packages/33/95/8548989f92d68f86515b57c1e8f55062f716c86479ea5d36bdcbba37295a/shipyard_bp_utils-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-21 18:32:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "shipyard-bp-utils"
}
        
Elapsed time: 0.36035s