semvec/pypi-packages huggingface dataset:
python-setenv 0.0.3
Set env (e.g. HF_TOKEN) from colab/kaggle secrets or dotenv .env env files
Requires Python: >=3.8

<!---[![pytest](https://github.com/ffreemt/python-setenv/actions/workflows/routine-tests.yml/badge.svg)](https://github.com/ffreemt/python-setenv/actions)-->
# python-setenv
[![pytest](https://github.com/ffreemt/python-setenv/actions/workflows/routine-tests.yml/badge.svg)](https://github.com/ffreemt/python-setenv/actions)[![python](https://img.shields.io/static/v1?label=python+&message=3.8%2B&color=blue)](https://www.python.org/downloads/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)[![PyPI version](https://badge.fury.io/py/python-setenv.svg)](https://badge.fury.io/py/python-setenv)

Set an environ variable from colab, kaggle or dotenv (search default .env/dotenv/env)

### Why `python-setenv`

colab and kaggle both provide a way to manage secrets (typically API tokens).

`python-setenv` is mainly for running ipynb (jupyter notebook) files in colab/kaggle or cloud instance when we need to set an environ variable, for example, `HF_TOKEN` to download models or datasets from huggingdace hub, other scenarios include `WANDB_API_KEY` or `NGROK_AUTHCODE` or `OPENAI_API_KEY` etc.

When running an ipynb in a cloud instance, we may use `dotenv` (`pip install python-dotenv`) to set environ varibales based on `.env`.

### Install it
```
pip install python-setenv
```

### Setup Secrets or Upload `.env`

* In colab, set Secrets

    <img src="https://github.com/ffreemt/python-setenv/raw/main/img/colab.png" width="300" />

    <!---![](img/colab.png)-->

* In kaggle, set Add-ons/Secrets

    <img src="https://github.com/ffreemt/python-setenv/raw/main/img/kaggle.png" width="300" />

    <!---![](./img/kaggle.png)-->

* In other jupyter environ/cloud instance, upload .env, with contents, e.g.
```
HF_TOKEN=...
WANDB_API_KEY=...
```
In some cases, files start with a dot are not allowed. Rename `.env` to `dotenv` or `env` instead, `setenv` will auto-search for `.env`, `dotenv` and `env`.

## Use it
```
from setenv import setenv

# e.g.
setenv("HF_TOKEN")
setenv("WANDB_API_KEY")
setenv("NGROK_AUTHCODE")
```

Sometimes we want to set HF_TOKEN to HF_TOKEN_W (with write-permission).
```
from setenv import setenv
setenv(env_var="HF_TOKEN", source_var="HF_TOKEN_W")
```
This is effectively equivalent to `os.environ["HF_TOKEN"] = get_secret("HF_TOKEN_W")` when in colab or kaggle, or `os.environ["HF_TOKEN"] = dotenv.dotenv_values().get("HF_TOKEN_W")`.
phonexia-audio-intelligence-client 0.1.0
Phonexia Audio Intelligence CLI client
Requires Python: >=3.11

# phx-audio-intelligence-client

CLI client for the Phonexia Audio Intelligence API.

## Installation

From the repository root, you can run the client without installing it system-wide.

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client --help
```

If you want an editable install into the repo virtual environment:

```bash
uv pip install -e phx_audio_intelligence_client
```

## Usage

All commands accept `--help`.

### Create a collection

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client create-collection \
  --base-url http://localhost:1234/api \
  my-collection
```

### List collections

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client list-collections \
  --base-url http://localhost:1234/api
```

### Upload files

Upload explicit files:

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client upload \
  --base-url http://localhost:1234/api \
  --collection my-collection \
  path/to/file1.wav path/to/file2.txt
```

Upload a whole directory (recursively discovers supported files):

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client upload \
  --base-url http://localhost:1234/api \
  --collection my-collection \
  --dir path/to/data \
  --concurrency 4
```

For audio uploads, optional sidecar JSON files can be provided via:

- `--transcription-dir` (expects `<audio_stem>.json`)
- `--diarization-dir` (expects `<audio_stem>.json`)

### Query (RAG)

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client query \
  --api-base http://localhost:1234/api \
  --collection my-collection \
  "What is this collection about?"
```

Optionally upload an audio file with the target speaker before querying (used by the backend to
extract a speaker embedding and retrieve recordings with that speaker; the question is not about
this audio):

```bash
uv run --project phx_audio_intelligence_client phx-audio-intelligence-client query \
  --api-base http://localhost:1234/api \
  --collection my-collection \
  --target-speaker-audio path/to/target_speaker.wav \
  "Summarize the audio"
```