Skip to main content

Intrepid Python SDK

Project description

Build and Install

Build from pip

pip install intrepid-python-sdk

Build from sources

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

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.15.tar.gz (37.1 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.15-py3-none-any.whl (47.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intrepid_python_sdk-0.1.15.tar.gz
  • Upload date:
  • Size: 37.1 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.15.tar.gz
Algorithm Hash digest
SHA256 a10ad975a88b07c8a343ed860d6b251c048be2a2c76fa248236ff3603fcaecc7
MD5 a8309d9baccf2219dd960a5d3235e351
BLAKE2b-256 090289ac84c3b285a36ffa0aaa569ddf1e8cb7a651ed6e358f0c8527a8d47103

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for intrepid_python_sdk-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 642a207fd976255492c13ea446d3829e806fbc2f88da81b63786c5ba01f16b1d
MD5 c90c70f6e5580f8197b9b6f7b2b7d9ee
BLAKE2b-256 9d45f661f9d02ed0de4e504206e1e69747e673813407f8125da01f389c9450db

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