You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fc33f51
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+39-42Lines changed: 39 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ This SDK is compatible with Featurevisor v3 projects and v2 datafiles.
9
9
## Table of contents <!-- omit in toc -->
10
10
11
11
-[Installation](#installation)
12
+
-[Public API](#public-api)
12
13
-[Initialization](#initialization)
13
14
-[Evaluation types](#evaluation-types)
14
15
-[Context](#context)
@@ -30,16 +31,14 @@ This SDK is compatible with Featurevisor v3 projects and v2 datafiles.
30
31
-[Loading datafiles on demand](#loading-datafiles-on-demand)
31
32
-[Updating datafile](#updating-datafile)
32
33
-[Interval-based update](#interval-based-update)
33
-
-[Logging](#logging)
34
+
-[Diagnostics](#diagnostics)
34
35
-[Levels](#levels)
35
-
-[Customizing levels](#customizing-levels)
36
36
-[Handler](#handler)
37
37
-[Events](#events)
38
38
-[`datafile_set`](#datafile_set)
39
39
-[`context_set`](#context_set)
40
40
-[`sticky_set`](#sticky_set)
41
41
-[`error`](#error)
42
-
-[Diagnostics](#diagnostics)
43
42
-[Modules](#modules)
44
43
-[Defining a module](#defining-a-module)
45
44
-[Registering modules](#registering-modules)
@@ -61,6 +60,20 @@ This SDK is compatible with Featurevisor v3 projects and v2 datafiles.
61
60
pip install featurevisor
62
61
```
63
62
63
+
## Public API
64
+
65
+
The main runtime API is `create_featurevisor()`:
66
+
67
+
```python
68
+
from featurevisor import Featurevisor, create_featurevisor
69
+
70
+
f: Featurevisor = create_featurevisor({
71
+
"datafile": datafile_content,
72
+
})
73
+
```
74
+
75
+
Most applications only need `create_featurevisor` and the `Featurevisor` instance type. Public extension and observability APIs include `FeaturevisorModule`, diagnostics, events, and the datafile dictionaries accepted by the factory.
76
+
64
77
## Initialization
65
78
66
79
Initialize the SDK with Featurevisor datafile content:
@@ -69,14 +82,14 @@ Initialize the SDK with Featurevisor datafile content:
@@ -202,7 +215,7 @@ You can pin feature evaluations with sticky values:
202
215
Sticky values belong to an SDK or child instance. Evaluation options do not accept sticky overrides; use `spawn(context, {"sticky": ...})` when a child needs its own sticky state.
203
216
204
217
```python
205
-
f =create_instance({
218
+
f =create_featurevisor({
206
219
"sticky": {
207
220
"myFeatureKey": {
208
221
"enabled": True,
@@ -264,9 +277,9 @@ This pairs well with [targets](https://featurevisor.com/docs/targets/), where ea
If `onDiagnostic` is not provided, diagnostics are sent to the SDK logger.
353
-
354
-
Every diagnostic has `level`, `code`, `message`, and an object-shaped `details` dictionary. Optional `module`, `moduleName`, and `originalError` fields describe provenance; evaluation metadata belongs in `details`.
350
+
Every diagnostic has `level`, `code`, `message`, and an object-shaped `details` dictionary. Optional `module`, `moduleName`, and `originalError` fields describe provenance. Evaluation metadata belongs in `details`.
355
351
356
352
Diagnostic handlers are isolated from SDK behavior. An exception in a handler does not stop other handlers or evaluations.
357
353
354
+
358
355
## Events
359
356
360
357
Featurevisor SDK implements a simple event emitter that allows you to listen to events that happen in the runtime.
@@ -466,7 +463,7 @@ Modules can be registered at initialization or afterwards:
0 commit comments