semvec/pypi-packages huggingface dataset:
use-nacos 0.1.6
A python nacos client based on the official open-api
License: MIT
Requires Python: <4.0,>=3.8

# use-nacos

<a href="https://github.com/use-py/use-nacos/actions/workflows/test.yml?query=event%3Apush+branch%3Amain" target="_blank">
    <img src="https://github.com/use-py/use-nacos/actions/workflows/test.yml/badge.svg?branch=main&event=push" alt="Test">
</a>
<a href="https://pypi.org/project/use-nacos" target="_blank">
    <img src="https://img.shields.io/pypi/v/use-nacos.svg" alt="Package version">
</a>

<a href="https://pypi.org/project/use-nacos" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/use-nacos.svg" alt="Supported Python versions">
</a>

A python nacos client based on the official [open-api](https://nacos.io/zh-cn/docs/open-api.html).

## install

```shell
pip install use-nacos
```

## usage

### config

```python
from use_nacos import NacosClient

client = NacosClient(...)

# publish config
client.config.publish("test_config", "DEFAULT_GROUP", "test_value")
# get config
assert client.config.get("test_config", "DEFAULT_GROUP") == "test_value"


# subscribe config

def config_update(config):
    print(config)


client.config.subscribe(
    "test_config",
    "DEFAULT_GROUP",
    callback=config_update
)
```

### instance

```python
from use_nacos import NacosClient

nacos = NacosClient()

nacos.instance.register(
    service_name="test",
    ip="10.10.10.10",
    port=8000,
    weight=10.0
)

nacos.instance.heartbeat(
    service_name="test",
    ip="10.10.10.10",
    port=8000,
)
```

### 😘support `async` mode

```python
# example: fastapi

from contextlib import asynccontextmanager

import uvicorn
from fastapi import FastAPI

from use_nacos import NacosAsyncClient


def config_update(config):
    print(config)


@asynccontextmanager
async def lifespan(app: FastAPI):
    nacos = NacosAsyncClient()

    config_subscriber = await nacos.config.subscribe(
        data_id="test-config",
        group="DEFAULT_GROUP",
        callback=config_update,
    )
    yield
    config_subscriber.cancel()


app = FastAPI(lifespan=lifespan)

if __name__ == '__main__':
    uvicorn.run("in_fastapi:app", host="0.0.0.0", port=1081)
```

## Developing

```text
make install  # Run `poetry install`
make lint  # Runs bandit and black in check mode
make format  # Formats you code with Black
make test  # run pytest with coverage
make publish  # run `poetry publish --build` to build source and wheel package and publish to pypi
```
agentbox-wrapper 1.0.0
AgentBox SDK that give agents cloud environments
License: MIT
Requires Python: <4.0,>=3.9

## What is AgentBox?
[AgentBox](https://agentbox.cloud/) is an open-source infrastructure that allows you to run AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes.


## PKG agentbox sdk
```bash
python3 -m venv venv
source venv/bin/activate
pip install openapi-python-client
pip install pyyaml

# API
make generate-api

# edit pyproject.toml

poetry install
poetry build
pip install dist/agentbox-1.5.1-py3-none-any.whl

```


## Run your first Sandbox

### 1. Install SDK

```
pip install agentbox
```

### 2. Get your AgentBox API key
1. Sign up to AgentBox [here](https://agentbox.cloud).
2. Get your API key [here](https://agentbox.cloud/dashboard?tab=keys).
3. Set environment variable with your API key
```
E2B_API_KEY=e2b_***
```     

### 3. Execute code with code interpreter inside Sandbox

```py
from agentbox_code_interpreter import Sandbox

with Sandbox() as sandbox:
    sandbox.run_code("x = 1")
    execution = sandbox.run_code("x+=1; x")
    print(execution.text)  # outputs 2
```

### 4. Check docs
Visit [AgentBox documentation](https://agentbox.cloud/docs).

### 5. AgentBox cookbook
Visit our [Cookbook](https://github.com/agengbox/agentbox-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.