mrflagly 0.2.5__cp312-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mrflagly/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: mrflagly
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
Summary: No nonsense feature flagging system
|
|
8
|
+
Home-Page: https://github.com/vangheem/mr.flagly
|
|
9
|
+
Author-email: Nathan Van Gheem <vangheem@gmail.com>>
|
|
10
|
+
License: MIT
|
|
11
|
+
Requires-Python: >=3.7
|
|
12
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
13
|
+
Project-URL: Source Code, https://github.com/vangheem/mr.flagly
|
|
14
|
+
|
|
15
|
+
# Introduction
|
|
16
|
+
|
|
17
|
+
Feature flagging should not be so complicated.
|
|
18
|
+
|
|
19
|
+
Mr Flagly is a decentralized feature flagging system written in Rust with bindings for other languages.
|
|
20
|
+
|
|
21
|
+
It does not depend on third party services or require you to deploy services and databases to manage.
|
|
22
|
+
|
|
23
|
+
Supported feature flag definition sources:
|
|
24
|
+
|
|
25
|
+
- URL
|
|
26
|
+
- JSON Value
|
|
27
|
+
- Environment Variable
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Rust usage
|
|
31
|
+
|
|
32
|
+
Setup your flag service:
|
|
33
|
+
|
|
34
|
+
```rust
|
|
35
|
+
use mrflagly::service::{FlagService, FlagServiceOptions};
|
|
36
|
+
let flag_service = FlagService::new(FlagServiceOptions {
|
|
37
|
+
finder_type: mrflagly::service::types::FlagFinderType::URL,
|
|
38
|
+
url: "https://path/to/hosted/json/file",
|
|
39
|
+
refresh_interval: 600,
|
|
40
|
+
data: None,
|
|
41
|
+
env_var: None,
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Then, to check for feature flag:
|
|
46
|
+
|
|
47
|
+
```rust
|
|
48
|
+
if flag_service.enabled("feature_x", false /* default value */, Some(HashMap::from([(String::from("user_id"), String::from("123")),])) /* optional context */) {
|
|
49
|
+
// do something
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Python support
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
import mrflagly
|
|
58
|
+
|
|
59
|
+
flag_service = mrflagly.FlagService(url="https://path/to/hosted/json/file")
|
|
60
|
+
if flag_service.enabled("feature_x", default=False, context={"foo": "bar"}):
|
|
61
|
+
# do something
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## FlagService constructor parameters
|
|
66
|
+
|
|
67
|
+
- `finder_type`: (NULL, URL, JSON, ENVVAR)
|
|
68
|
+
- `url`: URL to download feature flag json data
|
|
69
|
+
- `refresh_interval`: How often to poll the feature flag data endpoint
|
|
70
|
+
- `data`: Instead of hosting feature flag data from URL, you can provide it as a json blob
|
|
71
|
+
- `env_var`: Provide feature flag data in environment variable
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## JSON format
|
|
76
|
+
|
|
77
|
+
JSON format for feature flag data:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"my_feature": {
|
|
82
|
+
"rollout": 100
|
|
83
|
+
},
|
|
84
|
+
"my_feature_with_variants": {
|
|
85
|
+
"rollout": 0,
|
|
86
|
+
"variants" {
|
|
87
|
+
"user_id": ["123"],
|
|
88
|
+
"company_id": ["123"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
## Example activating for a particular customer
|
|
96
|
+
|
|
97
|
+
JSON config data:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"feature": {
|
|
102
|
+
"rollout": 0,
|
|
103
|
+
"variants": {
|
|
104
|
+
"customer_id": ["123"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
Usage:
|
|
112
|
+
```python
|
|
113
|
+
import mrflagly
|
|
114
|
+
import json
|
|
115
|
+
|
|
116
|
+
flag_service = mrflagly.FlagService(
|
|
117
|
+
data=json.dumps({"feature": {"rollout": 0, "variants": {"customer_id": ["123"]}}}))
|
|
118
|
+
|
|
119
|
+
if flag_service.enabled("feature_x", default=False, context={"customer_id": "123"}):
|
|
120
|
+
# do something
|
|
121
|
+
```
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
mrflagly-0.2.5.dist-info/METADATA,sha256=3AphGNP_BH2rRkGCVha5qg-6TJCde3ad0Y1dxs-rdzE,2929
|
|
2
|
+
mrflagly-0.2.5.dist-info/WHEEL,sha256=ZTY_kOhWGECXxDmzhXy-zxezgT1DhbmPVnjnbRdLmy8,97
|
|
3
|
+
mrflagly/__init__.py,sha256=Zc77-ZUJhQTZtqzyJiiJJOyozxkSOT8B9nZZ1w74g2c,115
|
|
4
|
+
mrflagly/mrflagly.cp312-win_amd64.pyd,sha256=vMeoJTH79aoCOHep1FxsAipbn4VM3_TLsFLwNVpv7T8,1958912
|
|
5
|
+
mrflagly-0.2.5.dist-info/RECORD,,
|