Skip to main content

REST API client for interacting with Exobrain Actions services, providing access to action management endpoints.

Project description

exobrain-actions-client

License: Private Python 3.12+

This package provides a REST API client for interacting with the Exobrain Actions API.

Key features:

  • Access to various API resources such as version status and health checks (ping).
  • Retrieval, triggering, or updating of action data specific to a service or organization.
  • Standardized HTTP calls to different API endpoints (version, health, action data, calculation triggers, KPI updates).

User Guide

Installation

To install the Exobrain Actions Client, use the following command:

pip install exobrain-actions-client

Usage

To update the actual KPIs of a given action, create a client, instantiate the accessor, and call update_actuals with the service name, organization ID, action ID, and a dictionary of KPI values.

from uuid import UUID

from exobrain.actions.client.accessor import ActionsAccessor
from exobrain.actions.client.http_client import ClientType, create_client
from exobrain.actions.client.http_client.interfaces import HTTPStatusError

org_id = UUID("12345678-1234-5678-1234-567812345678")
action_id = UUID("87654321-4321-8765-4321-876543218765")
kpis = {
    "RESPONSIVENESS": 0.87,
    "RELIABILITY": 0.75,
    "INVENTORY_COVERAGE": 0.37,
    "INVENTORY_VALUE": 0.314
}

base_url = "https://actions-service.com/"
service = "stock-rebalancing"

client = create_client(
    ClientType.REQUESTS,
    base_url=base_url,
    verify=True,  # Set to False if you want to disable SSL verification
    timeout=10,
)
accessor = ActionsAccessor(client)
try:
    accessor.update_actuals(service, org_id, action_id, kpis=kpis)
except HTTPStatusError as e:
    print(f"Failed to update KPIs: {e.response.status_code} - {e}")
else:
    print("KPIs updated successfully!")

Development workflow

Prerequisites

Before starting development, make sure you have the following tools installed:

  • Hatch: a modern Python project, environment, and packaging manager.

  • uv: a fast Python package installer and resolver.

Project Structure

  • Code: Place your models in exobrain/actions/client/.
  • Tests: Add your tests in tests/.

Development Commands

All tasks (testing, linting, type checking, packaging, etc.) are managed via hatch environments and scripts:

1. Installing Dependencies

Install all dependencies (including development tools):

hatch env create

2. Running Tests

Launch all tests using pytest:

hatch test

3. Linting and Formatting

Format your code:

hatch fmt -f

Check code style:

hatch fmt

4. Type Checking

Run type checks with mypy:

hatch run types:check

5. Coverage

Check test coverage with:

hatch test --cover

6. Building the Package

Build the package for distribution:

hatch build

7. Releasing

The release process uses uv and Github Actions.

  • For pre-release on TestPyPI: push a tag with rc or beta in the version (0.1rc1, 0.2b1 etc.).
  • For release: push a tag type v0.1 (main release) on main branch.
  • Configure secrets for PyPI tokens in repository settings (PYPI_TOKEN, TEST_PYPI_TOKEN).

Continuous Integration

All pushes and pull requests on main or development branches trigger the Continuous Integration pipeline
(see .github/workflows/ directory for details).


License

This project is private and confidential.

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

exobrain_actions_client-0.3.0.tar.gz (62.1 kB view details)

Uploaded Source

Built Distribution

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

exobrain_actions_client-0.3.0-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file exobrain_actions_client-0.3.0.tar.gz.

File metadata

  • Download URL: exobrain_actions_client-0.3.0.tar.gz
  • Upload date:
  • Size: 62.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for exobrain_actions_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8d96c0aa4a1ca7d0e780cdb84d0f004cedcdfeec637fd15d74358cd93f1c6375
MD5 a8ce94a450aa1f5c09edd2510150ca04
BLAKE2b-256 f3d7afbf5fe7effd71ef0b65b3f6ea67fc60f84b16e6b972f42a8c0366070590

See more details on using hashes here.

File details

Details for the file exobrain_actions_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for exobrain_actions_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 606db5e17bd7c501948f97fc5960dce9fdca1f2a4125e1b71eb15754f7164ac6
MD5 c02e93ad8ff2f14a990e016b2ee16462
BLAKE2b-256 4214cfe8c96cb1e98ff8bf9bdf07470bd0f15e3c7d39fe7b2f289a572a1aaa77

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