Metadata-Version: 2.4
Name: flagsman
Version: 1.0.0
Summary: Flagsman server SDK: zero-dependency, in-process feature-flag evaluation with streaming updates.
Author-email: Flagsman <hello@flagsman.com>
License: MIT
Project-URL: Homepage, https://flagsman.com
Project-URL: Documentation, https://docs.flagsman.com
Project-URL: Source, https://github.com/flagsman/sdk-python
Project-URL: Issues, https://github.com/flagsman/sdk-python/issues
Keywords: feature-flags,feature-flag,feature-toggles,experimentation,ab-testing,flagsman
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Flagsman — Python server SDK

Zero-dependency, in-process feature-flag evaluation for Python. The SDK streams
your environment's ruleset into memory and evaluates flags locally in
microseconds — no network call on your hot path, no per-evaluation charges.

- **Local evaluation** — decisions are computed in-process from a streamed ruleset.
- **Streaming updates** — flag changes converge in well under a second (falls back to polling).
- **Rigorous** — the same `decide()` spec every Flagsman SDK implements, asserted by a shared conformance suite.
- **No dependencies** — pure standard library.

## Install

```bash
pip install flagsman
```

## Usage

```python
from flagsman import FlagsmanClient

client = FlagsmanClient(
    base_url="https://api.flagsman.com",
    server_key="flags-server-...",   # your environment's server-side SDK key
)
client.start()

ctx = {"key": "user-123", "country": "US", "plan": "pro"}

# Boolean flag
if client.bool_variation("checkout.new-payment-flow", ctx, default=False):
    render_new_checkout()

# Multivariate flag (string / number / json)
color = client.variation("ui.button-color", ctx, default="blue")

# With evaluation reason (for debugging)
detail = client.variation_detail("ui.button-color", ctx, default="blue")

# Every flag for a context
flags = client.all_flags(ctx)

# Track an experiment goal / conversion
client.track("signup_completed", ctx)

client.stop()   # flushes buffered events and stops the stream
```

## Configuration

`FlagsmanClient(base_url, server_key, use_stream=True, poll_interval=30.0, request_timeout=10.0, send_events=False, flush_interval=5.0, event_batch_size=25)`

- `use_stream` — stream the ruleset (recommended); set `False` to poll.
- `send_events` — send exposure/goal analytics events back to Flagsman.

## Links

- Documentation: https://docs.flagsman.com
- Homepage: https://flagsman.com

MIT licensed.
