Service agnostic featureflag client
Project description
featureflagclient
Allows you to use feature flags in your code, works with any JSON feature flag service.
Features:
- Extremely light-weight.
- Feature flag service agnostic.
Created by featureflag.tech.
Get started
You can install this via pip from the package index as
pip install featureflagclient
If you have a JSON file in the cloud like this one:
featureflag.tech/node/exampleflag.json
You can access it like so
from featureflagclient.client import Featureflagclient
f2c = Featureflagclient("https://featureflag.tech/node/exampleflag.json")
if (f2c.get( "trueBoolean" )) {
// do some python
}
A great way to use feature flags is to use the values from your flag source but override them in specific contexts. For example with a web application, you can have a feature disabled by default in your live production, but then override the value using a cookie or parameter in the request.
For example:
from featureflagclient.client import Featureflagclient
f2c = Featureflagclient(
"https://featureflag.tech/node/exampleflag.json",
{
"falseBoolean": req.param("falseBooleanOverride") or None
}
)
if (f2c.get( "trueBoolean" )) {
// do some python
}
Developing
Setting up from scratch
Project uses the following Python libs:
- Python 3.6
- pyenv for managing the version of Python
- pipenv for managing dependencies and the Python env
- pytest for unit testing
- mypy for static typing (not yet true)
- flake8 for code linting (not yet true)
pyenv - python version manager
brew install pyenv
Add this to .bash_profile
eval "$(pyenv init -)"
reload terminal session.
python 3.6.5
pyenv install 3.6.5
Setup env with dependencies
cd [repo directory]
pipenv install
pipenv shell
Run the tests
pytest -v
Release new version
-
Bump the version number in
setup.py
-
Delete all the contents of the
dist
dir -
Create distribution files:
python setup.py sdist bdist_wheel
- Push to pypi:
twine upload dist/*
- Check the deployment at:
https://pypi.org/manage/project/featureflagclient/releases/
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
Built Distribution
Hashes for featureflagclient-0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a10b300e6c6ca617b537d4d2fdb09c2f19e4116b0390a24abba620fe08d53895 |
|
MD5 | 366807d33b012a06c50fa5ca1a5e3fd0 |
|
BLAKE2b-256 | 6c707049c62e4d31d8ee59cac1cc178637120841ebac68de3a4621fa59ede7ba |