flager


Nameflager JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/daxartio/flager
Summary
upload_time2023-10-16 17:46:37
maintainer
docs_urlNone
authorDanil Akhtarov
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flager

[![PyPI](https://img.shields.io/pypi/v/flager)](https://pypi.org/project/flager/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flager)](https://www.python.org/downloads/)
[![GitHub last commit](https://img.shields.io/github/last-commit/daxartio/flager)](https://github.com/daxartio/flager)
[![GitHub stars](https://img.shields.io/github/stars/daxartio/flager?style=social)](https://github.com/daxartio/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

```python
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

```python
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

* [MIT LICENSE](LICENSE)

## Contribution

[Contribution guidelines for this project](CONTRIBUTING.md)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/daxartio/flager",
    "name": "flager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Danil Akhtarov",
    "author_email": "daxartio@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/30/0a/67d62337e00b834615ef0c983b08131254b4228725cad84940ba7b260f9e/flager-0.1.2.tar.gz",
    "platform": null,
    "description": "# Flager\n\n[![PyPI](https://img.shields.io/pypi/v/flager)](https://pypi.org/project/flager/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/flager)](https://www.python.org/downloads/)\n[![GitHub last commit](https://img.shields.io/github/last-commit/daxartio/flager)](https://github.com/daxartio/flager)\n[![GitHub stars](https://img.shields.io/github/stars/daxartio/flager?style=social)](https://github.com/daxartio/flager)\n\nFeature flags updater for python\n\n## Installation\n\n```\npip install flager\n```\n\n## Features\n\n- Anyio\n- Abstract code for any backend, e.g., flipt, redis, etc.\n\n## Usage\n\nfeature flags updater\n\n```python\nimport asyncio\nfrom dataclasses import dataclass\nfrom typing import Dict, Optional\n\nfrom flager import FeatureFlagsUpdater\n\n\nasync def show_flags(flags: Dict[str, bool]) -> None:\n    while True:\n        print(flags)\n        await asyncio.sleep(1)\n\n\nasync def main() -> None:\n    flags = {\"flag_1\": False}\n    ff_updater = FeatureFlagsUpdater([flags], client=Client(), interval=5)\n    await asyncio.gather(ff_updater.run(), show_flags(flags))\n\n\n@dataclass\nclass Flag:\n    key: str\n    enabled: Optional[bool]\n\n\nclass Client:\n    flags = {\"flag_1\": Flag(\"flag_1\", True)}\n\n    async def get_flag(self, key: str) -> Optional[Flag]:\n        return self.flags[key]\n\n\nasyncio.run(main())\n```\n\nfeature flag proxy\n\n```python\nfrom flager import FeatureFlagsProxy\n\n\nasync def main() -> None:\n    flags = {\"flag_1\": False}\n    flags_proxy = FeatureFlagsProxy(flags, client=Client())\n    print(await flags_proxy[\"flag_1\"])\n```\n\n## License\n\n* [MIT LICENSE](LICENSE)\n\n## Contribution\n\n[Contribution guidelines for this project](CONTRIBUTING.md)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "",
    "version": "0.1.2",
    "project_urls": {
        "Changelog": "https://github.com/daxartio/flager/blob/main/CHANGELOG.md/",
        "Homepage": "https://github.com/daxartio/flager",
        "Repository": "https://github.com/daxartio/flager"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8909ce9ce29bdd6df327a171b8c4c965a00157156da687576508db17096392f3",
                "md5": "7cb297db8747cc5de8c1467802c51171",
                "sha256": "4cd26b8277c4f27e221c3d59f2abc347230eb1a30c10080d8daaa8631b98da3d"
            },
            "downloads": -1,
            "filename": "flager-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7cb297db8747cc5de8c1467802c51171",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 5024,
            "upload_time": "2023-10-16T17:46:35",
            "upload_time_iso_8601": "2023-10-16T17:46:35.728677Z",
            "url": "https://files.pythonhosted.org/packages/89/09/ce9ce29bdd6df327a171b8c4c965a00157156da687576508db17096392f3/flager-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "300a67d62337e00b834615ef0c983b08131254b4228725cad84940ba7b260f9e",
                "md5": "976ff915dd7d1385e9b15691c6ab8d92",
                "sha256": "20069190bb73b099c2c3c2a45d93b562c5a72adadeddcc7b282fdb5bf1fd7515"
            },
            "downloads": -1,
            "filename": "flager-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "976ff915dd7d1385e9b15691c6ab8d92",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 4397,
            "upload_time": "2023-10-16T17:46:37",
            "upload_time_iso_8601": "2023-10-16T17:46:37.275590Z",
            "url": "https://files.pythonhosted.org/packages/30/0a/67d62337e00b834615ef0c983b08131254b4228725cad84940ba7b260f9e/flager-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-16 17:46:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "daxartio",
    "github_project": "flager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flager"
}
        
Elapsed time: 0.16026s