Skip to main content

Intrepid Python SDK

Project description

Build and Install

Create a new conda environment with conda create -n intrepid python=3.10

Activate environment with

conda activate intrepid

Install poetry with pip install poetry and all requirements pip install -r requirements.txt

Build Python Intrepid SDK

poetry build
poetry install

And check that all has been installed correctly

python examples/ex0.py

This should print

Hello from Intrepid SDK

Example for showcasing Python bindings

Create Python Node

A Python node is created from dashboard and rendered according to the Python function signature that is attached.

A Python SDK allows to

  1. register any user-defined function to the runtime and
  2. execute the service that exposes such function(s)

In the example below, two functions are declared and registered to the Intrepid runtime. Finally the runtime is started and made ready for execution

import asyncio
from intrepid_python_sdk import Intrepid
from pydantic import BaseModel


def simple_node(a: int, b: int) -> int:
    """Example node that adds two numbers"""
    return a + b

def simple_node_with_defaults(a: int = 10, b: int = 10) -> int:
    """Example node that adds two numbers (with default values)"""
    return a + b


if __name__ == "__main__":
    runtime = Intrepid(namespace="test")
    runtime.register_node(simple_node)
    runtime.register_node(simple_node_with_defaults, label="SimpleNodeDefault", description="A node handling types with default values")
    runtime.start("0.0.0.0", 8765)

The code above can be saved to my_node.py and executed with python my_node.py

You can now connect Intrepid Agent to `0.0.0.0:8765`

Start Intrepid Runtime Core

Execute the Intrepid runtime (intrepid-agent) with arguments --web to expose the control dashboard to localhost --load ws://<host>:<port> where the service is running

./intrepid-agent --web --load ws://localhost:8765

This should show

  ╔══════════════════════════════════╗
                                       🚀  Web service is running on:                                          🔗  http://127.0.0.1:9180                                              ╚══════════════════════════════════╝

Point the browser to http://127.0.0.1:9180 and search for the exposed nodes (right click and search) At this point you can create the behavior you need, by importing and connecting the nodes you need. Click Run to execute such behavior.

Publish node

Not yet implemented.

Examples

An exhaustive list of sample nodes is provided in examples/agent/run_demo.py. An example to call ROS2 utilities is provided in examples/agent/ros2_demo.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intrepid_python_sdk-0.1.14.tar.gz (37.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intrepid_python_sdk-0.1.14-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

Details for the file intrepid_python_sdk-0.1.14.tar.gz.

File metadata

  • Download URL: intrepid_python_sdk-0.1.14.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for intrepid_python_sdk-0.1.14.tar.gz
Algorithm Hash digest
SHA256 a9dc0c7d677070bc2d61c6d2f14a181536c214929260aeb4c5584ab19d21febc
MD5 059b0627028a595b79dc604827fe1347
BLAKE2b-256 8e941efd5fe6fe302072c2042f078295f5ae7a72e937ef1463a2f5f3dbd61a00

See more details on using hashes here.

File details

Details for the file intrepid_python_sdk-0.1.14-py3-none-any.whl.

File metadata

File hashes

Hashes for intrepid_python_sdk-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 435648263de2934f3f24af581b590beb773be33376264fc988064f50369689b5
MD5 265a83579565c82f32409871090ca980
BLAKE2b-256 c3aa0e07b136e73ffaa36db7b62ccb5c98de2c0ca9377513911bbb667baa55d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page