Metadata-Version: 2.4
Name: deployramp
Version: 0.1.5
Summary: DeployRamp SDK - Feature flag management for Python
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: websockets>=12.0
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# DeployRamp Python SDK

Python SDK for [DeployRamp](https://deployramp.com) — AI-native feature flag management.

## Installation

```bash
pip install deployramp
```

## Usage

```python
import deployramp

deployramp.init(deployramp.SdkConfig(
    base_url="https://api.deployramp.com",
    public_token="your-public-token",
    traits={"plan": "pro", "region": "us-east"},
))

if deployramp.flag("my-feature"):
    # feature is enabled
    pass

# Report errors for automatic rollback
try:
    do_something()
except Exception as e:
    deployramp.report(e, flag_name="my-feature")

deployramp.close()
```

## API

### `init(config: SdkConfig) -> None`

Initialize the SDK. Fetches flags and opens a WebSocket for real-time updates.

### `flag(name: str, trait_overrides: dict | None = None) -> bool`

Evaluate a feature flag. Returns `False` if the SDK is not initialized or the flag is unknown/disabled.

### `set_traits(traits: dict[str, str]) -> None`

Replace the current traits used for flag evaluation.

### `report(error: Exception | str, flag_name: str | None = None, trait_overrides: dict | None = None) -> None`

Report an error to DeployRamp for automatic rollback monitoring.

### `close() -> None`

Flush pending evaluations and close connections.

## Requirements

- Python 3.10+
- `websockets >= 12.0`

## License

MIT
