ob-events


Nameob-events JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA minimal Python client to publish events to the Outerbounds platform.
upload_time2025-11-12 01:59:59
maintainerNone
docs_urlNone
authorOuterbounds, Inc.
requires_python~=3.7
licenseNone
keywords mlops data science machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python package to publish Events to Outerbounds platform

## Installation

Install the package using `pip`:

```bash
pip install ob-events
```

This library has no dependencies for standard, inline configurations.

If you need to load configurations from AWS Secrets Manager, you must install the boto3 library. You can do this by installing the aws extra:

```bash
pip install ob-events[aws]
```

### Usage Example

#### Metaflow Flow (The Receiver)

First, assume you have a Metaflow Flow that is triggered by an event, like `my_event`.

```python
from metaflow import FlowSpec, step, current, trigger


@trigger(event='my_event')
class NodeSimpleTriggeredFlow(FlowSpec):
    @step
    def start(self):
        self.var_1 = ["h", "e", "l", "l"]
        self.next(self.b, foreach='var_1')

    @step
    def b(self):
        print("In B")
        self.next(self.join)

    @step
    def join(self, inputs):
        self.next(self.end)

    @step
    def end(self):
        print("In end")

if __name__ == "__main__":
    NodeSimpleTriggeredFlow()
```

#### Python Trigger (The Sender)

You can trigger this flow using the ob-events Python library. This assumes you are using Service Principals for programmatic auth. You can get the configString for the machine user from the OBP UI.

```python
from ob_events import EventTrigger, ConfigError, TriggerError

try:
    # Event name, must match what's in @trigger
    event_trigger = EventTrigger("my_event")

    # Initialize the library with the config string from the OBP UI
    # This can also be a file path:
    # event_trigger.init(config_file_path="/path/to/config.json")
    event_trigger.init(config_string="awssm-arn:...")

    # OR static API key:
    # event_trigger.init_from_service_principal(
    #     service_principal_name="some-static-key-principal",
    #     deployment_domain="mycompany.obp.outerbounds.com",
    #     perimeter="default",
    #     jwt_token="...key goes here..."
    # )

    # Trigger the event with an optional payload
    print("Triggering event 'my_event'...")
    event_trigger.trigger(payload={"foo": "bar", "source": "my-service"})
    print("Event triggered successfully!")

except ConfigError as e:
    print(f"Configuration error: {e}")
except TriggerError as e:
    print(f"Trigger error: {e}")
except ImportError as e:
    print(f"Dependency error: {e}")
    print("If using AWS Secrets Manager, please run 'pip install ob-events[aws]'")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ob-events",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.7",
    "maintainer_email": null,
    "keywords": "MLOps, data science, machine learning",
    "author": "Outerbounds, Inc.",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/58/97/1f53b1e49e7f9a3d14bef9edb3bafb732cb577911715e8205f2c13517c4c/ob_events-0.1.0.tar.gz",
    "platform": null,
    "description": "# Python package to publish Events to Outerbounds platform\n\n## Installation\n\nInstall the package using `pip`:\n\n```bash\npip install ob-events\n```\n\nThis library has no dependencies for standard, inline configurations.\n\nIf you need to load configurations from AWS Secrets Manager, you must install the boto3 library. You can do this by installing the aws extra:\n\n```bash\npip install ob-events[aws]\n```\n\n### Usage Example\n\n#### Metaflow Flow (The Receiver)\n\nFirst, assume you have a Metaflow Flow that is triggered by an event, like `my_event`.\n\n```python\nfrom metaflow import FlowSpec, step, current, trigger\n\n\n@trigger(event='my_event')\nclass NodeSimpleTriggeredFlow(FlowSpec):\n    @step\n    def start(self):\n        self.var_1 = [\"h\", \"e\", \"l\", \"l\"]\n        self.next(self.b, foreach='var_1')\n\n    @step\n    def b(self):\n        print(\"In B\")\n        self.next(self.join)\n\n    @step\n    def join(self, inputs):\n        self.next(self.end)\n\n    @step\n    def end(self):\n        print(\"In end\")\n\nif __name__ == \"__main__\":\n    NodeSimpleTriggeredFlow()\n```\n\n#### Python Trigger (The Sender)\n\nYou can trigger this flow using the ob-events Python library. This assumes you are using Service Principals for programmatic auth. You can get the configString for the machine user from the OBP UI.\n\n```python\nfrom ob_events import EventTrigger, ConfigError, TriggerError\n\ntry:\n    # Event name, must match what's in @trigger\n    event_trigger = EventTrigger(\"my_event\")\n\n    # Initialize the library with the config string from the OBP UI\n    # This can also be a file path:\n    # event_trigger.init(config_file_path=\"/path/to/config.json\")\n    event_trigger.init(config_string=\"awssm-arn:...\")\n\n    # OR static API key:\n    # event_trigger.init_from_service_principal(\n    #     service_principal_name=\"some-static-key-principal\",\n    #     deployment_domain=\"mycompany.obp.outerbounds.com\",\n    #     perimeter=\"default\",\n    #     jwt_token=\"...key goes here...\"\n    # )\n\n    # Trigger the event with an optional payload\n    print(\"Triggering event 'my_event'...\")\n    event_trigger.trigger(payload={\"foo\": \"bar\", \"source\": \"my-service\"})\n    print(\"Event triggered successfully!\")\n\nexcept ConfigError as e:\n    print(f\"Configuration error: {e}\")\nexcept TriggerError as e:\n    print(f\"Trigger error: {e}\")\nexcept ImportError as e:\n    print(f\"Dependency error: {e}\")\n    print(\"If using AWS Secrets Manager, please run 'pip install ob-events[aws]'\")\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A minimal Python client to publish events to the Outerbounds platform.",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://docs.metaflow.org"
    },
    "split_keywords": [
        "mlops",
        " data science",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9c033052e7de04a013bf945a730b5b5904ff999d60e55ff04e59c2d9c452b4e3",
                "md5": "13ef2939ce53861f127c21c901e2a276",
                "sha256": "d9c98a8ace9036b9c30e7eb17d4ffd9b5e6256ea098f43ed40351d4fb0b1d6bb"
            },
            "downloads": -1,
            "filename": "ob_events-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13ef2939ce53861f127c21c901e2a276",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.7",
            "size": 5350,
            "upload_time": "2025-11-12T01:59:58",
            "upload_time_iso_8601": "2025-11-12T01:59:58.290239Z",
            "url": "https://files.pythonhosted.org/packages/9c/03/3052e7de04a013bf945a730b5b5904ff999d60e55ff04e59c2d9c452b4e3/ob_events-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "58971f53b1e49e7f9a3d14bef9edb3bafb732cb577911715e8205f2c13517c4c",
                "md5": "8e5632d30477e57b811f21e5a73f240e",
                "sha256": "6bfbe2dff1eb7ddba18e4b4e37e96dbcaa1248a7d477f005c387e7694b3e55c2"
            },
            "downloads": -1,
            "filename": "ob_events-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8e5632d30477e57b811f21e5a73f240e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.7",
            "size": 23609,
            "upload_time": "2025-11-12T01:59:59",
            "upload_time_iso_8601": "2025-11-12T01:59:59.605805Z",
            "url": "https://files.pythonhosted.org/packages/58/97/1f53b1e49e7f9a3d14bef9edb3bafb732cb577911715e8205f2c13517c4c/ob_events-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-12 01:59:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ob-events"
}
        
Elapsed time: 4.58390s