{"id":13424720,"url":"https://github.com/Pytlicek/fastapi-featureflags","last_synced_at":"2025-03-15T18:35:47.483Z","repository":{"id":57428489,"uuid":"431191676","full_name":"Pytlicek/fastapi-featureflags","owner":"Pytlicek","description":"FastAPI Feature Flags","archived":false,"fork":false,"pushed_at":"2024-06-10T13:35:59.000Z","size":93,"stargazers_count":58,"open_issues_count":4,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-15T02:09:35.991Z","etag":null,"topics":["api","fastapi","fastapi-featureflags","feature-flags","featureflags","hacktoberfest","hacktoberfest-accepted","python","python-framework","python-library","serverless"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/fastapi-featureflags/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pytlicek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"ko_fi":"pytlicek"}},"created_at":"2021-11-23T17:22:43.000Z","updated_at":"2025-02-07T03:05:20.000Z","dependencies_parsed_at":"2024-01-03T02:30:01.615Z","dependency_job_id":"5c808c1b-5f1c-428d-b9ef-700329f6d2ba","html_url":"https://github.com/Pytlicek/fastapi-featureflags","commit_stats":{"total_commits":61,"total_committers":3,"mean_commits":"20.333333333333332","dds":0.5081967213114754,"last_synced_commit":"900ac4e023f8fa05d52886857de2545c02df2990"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pytlicek%2Ffastapi-featureflags","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pytlicek%2Ffastapi-featureflags/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pytlicek%2Ffastapi-featureflags/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pytlicek%2Ffastapi-featureflags/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pytlicek","download_url":"https://codeload.github.com/Pytlicek/fastapi-featureflags/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243775915,"owners_count":20346286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","fastapi","fastapi-featureflags","feature-flags","featureflags","hacktoberfest","hacktoberfest-accepted","python","python-framework","python-library","serverless"],"created_at":"2024-07-31T00:00:58.314Z","updated_at":"2025-03-15T18:35:42.471Z","avatar_url":"https://github.com/Pytlicek.png","language":"Python","readme":"[![Test Python package](https://github.com/Pytlicek/fastapi-featureflags/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/Pytlicek/fastapi-featureflags/actions/workflows/python-package.yml) \n[![codecov](https://codecov.io/gh/Pytlicek/fastapi-featureflags/branch/main/graph/badge.svg?token=CVULQJ2SSA)](https://codecov.io/gh/Pytlicek/fastapi-featureflags) \n[![Upload Python Package to PyPI](https://github.com/Pytlicek/fastapi-featureflags/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Pytlicek/fastapi-featureflags/actions/workflows/python-publish.yml) \n![PythonVersions](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue) \n[![Sourcery](https://img.shields.io/badge/Sourcery-enabled-brightgreen)](https://sourcery.ai) \n[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black) \n[![Snyk](https://snyk-widget.herokuapp.com/badge/pip/sheet2dict/badge.svg)](https://snyk.io/advisor/python/fastapi-featureflags) \n[![Downloads](https://pepy.tech/badge/fastapi-featureflags)](https://pepy.tech/project/fastapi-featureflags)\n[![Twitter Follow](https://img.shields.io/twitter/follow/Pytlicek?color=1DA1F2\u0026logo=twitter\u0026style=flat)](https://twitter.com/Pytlicek) \n\n\n# FastAPI Feature Flags\n\nVery simple implementation of feature flags for FastAPI.  \n- Minimum configuration required \n- No unnecessary dependencies\n- Does its job\n\n## Installing\nTo install the package from pip, first run:\n```bash\npip install fastapi-featureflags\n```\n\n## Usage\nA simple example of feature flags:\n```python\nfrom fastapi_featureflags import FeatureFlags, feature_flag, feature_enabled\n\nFeatureFlags(conf_from_url=\"https://pastebin.com/raw/4Ai3j2DC\")\nprint(\"Enabled Features:\", FeatureFlags.get_features())\n\n\n@feature_flag(\"web_1\")\ndef web_1_enabled():\n    print(\"Feature Should be enabled: web_1\")\n\nweb_1_enabled()\n\nif feature_enabled(\"web_2\"):\n    print(\"Feature Should be disabled: web_2\")\n```\n\nYou can get FF (feature flags) from a **File**, **URL**, **Dictionary or ENV Variables**:\n```python\nFeatureFlags.load_conf_from_url(\"https://pastebin.com/raw/4Ai3j2DC\")\nFeatureFlags.load_conf_from_json(\"tests/features.json\")\nFeatureFlags.load_conf_from_dict({\"web_1\": True, \"web_2\": False})\n\nFeatureFlags.reload_feature_flags()\n```\nThere is also a handler that recognizes if the \"@feature_flag\" wrapper is used and the flag is not registered in the config. \nThis way you can also use FF at runtime. Defaults to False, so it's safer if you forget the feature flag in the code.\n\nFunction `get_features` returns a list of all registered FF  \nYou can enable or disable functions on the fly with `enable_feature` or `enable_feature`  \n\nWhen needed you can reload all feature flags with `reload_feature_flags`, \nthis is useful when you want to read and change features from URL. \nAll unregistered or on-the-fly created FF, that are not in the configuration will be omitted.   \n\nFor non-production testing, a router is available, \nso you can see the paths in swagger-ui docs.\nUse `include_in_schema=False` when defining the router for public deployments\n```python\nfrom fastapi_featureflags import router as ff_router\napp.include_router(ff_router, prefix=\"/ff\", tags=[\"FeatureFlags\"])\n```\n---\n\u003cimg width=\"100%\" alt=\"FastAPI-FF\" src=\"https://user-images.githubusercontent.com/1430522/144305907-5e231e64-c120-4bde-9aad-58b9b194a361.png\"\u003e\n\n# Contributing and Code of Conduct  \n### Contributing to fastapi-featureflags  \nAs an open source project, fastapi-featureflags welcomes contributions of many forms.  \nPlease read and follow our [Contributing to fastapi-featureflags](CONTRIBUTING.md)  \n\n### Code of Conduct  \nAs a contributor, you can help us keep the fastapi-featureflags project open and inclusive.  \nPlease read and follow our [Code of Conduct](CODE_OF_CONDUCT.md)  \n","funding_links":["https://ko-fi.com/pytlicek"],"categories":["Third-Party Extensions"],"sub_categories":["Utils"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPytlicek%2Ffastapi-featureflags","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPytlicek%2Ffastapi-featureflags","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPytlicek%2Ffastapi-featureflags/lists"}