No project description provided
Project description
Flager
Feature flags updater for python
Installation
pip install flager
Features
- Anyio
- Abstract code for any backend, e.g., flipt, redis, etc.
Usage
feature flags updater
import asyncio
from dataclasses import dataclass
from typing import Dict, Optional
from flager import FeatureFlagsUpdater
async def show_flags(flags: Dict[str, bool]) -> None:
while True:
print(flags)
await asyncio.sleep(1)
async def main() -> None:
flags = {"flag_1": False}
ff_updater = FeatureFlagsUpdater([flags], client=Client(), interval=5)
await asyncio.gather(ff_updater.run(), show_flags(flags))
@dataclass
class Flag:
key: str
enabled: Optional[bool]
class Client:
flags = {"flag_1": Flag("flag_1", True)}
async def get_flag(self, key: str) -> Optional[Flag]:
return self.flags[key]
asyncio.run(main())
feature flag proxy
from flager import FeatureFlagsProxy
async def main() -> None:
flags = {"flag_1": False}
flags_proxy = FeatureFlagsProxy(flags, client=Client())
print(await flags_proxy["flag_1"])
License
Contribution
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flager-0.1.2.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file flager-0.1.2.tar.gz
.
File metadata
- Download URL: flager-0.1.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.8.18 Linux/6.2.0-1012-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20069190bb73b099c2c3c2a45d93b562c5a72adadeddcc7b282fdb5bf1fd7515 |
|
MD5 | 976ff915dd7d1385e9b15691c6ab8d92 |
|
BLAKE2b-256 | 300a67d62337e00b834615ef0c983b08131254b4228725cad84940ba7b260f9e |
File details
Details for the file flager-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: flager-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.8.18 Linux/6.2.0-1012-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cd26b8277c4f27e221c3d59f2abc347230eb1a30c10080d8daaa8631b98da3d |
|
MD5 | 7cb297db8747cc5de8c1467802c51171 |
|
BLAKE2b-256 | 8909ce9ce29bdd6df327a171b8c4c965a00157156da687576508db17096392f3 |