Skip to main content

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](https://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](https://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](https://github.com/pyenv/pyenv) for managing the version of Python
* [pipenv](https://docs.pipenv.org/) for managing dependencies and the Python env
* [pytest](https://docs.pytest.org/en/latest/) for unit testing
* [mypy](http://mypy-lang.org/) for static typing (not yet true)
* [flake8](http://flake8.pycqa.org/en/latest/) 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

1) Bump the version number in `setup.py`

2) Create distribution files:

```
python setup.py sdist bdist_wheel
```

3) Push to pypi:

```
twine upload dist/*
```

4) 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

featureflagclient-0.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

featureflagclient-0.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file featureflagclient-0.1.tar.gz.

File metadata

File hashes

Hashes for featureflagclient-0.1.tar.gz
Algorithm Hash digest
SHA256 a2955c2f6026117fbf49d88d5b6c849beb5aeb22d4534922b5de95befd019df8
MD5 cd811b1d5a377cc375195ef10e75b127
BLAKE2b-256 5654cd1feddd4e2b491ca39ad53e0b1f19a430b6396d0f4562262761e2b9666f

See more details on using hashes here.

File details

Details for the file featureflagclient-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for featureflagclient-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89c47b66e95ced5baec56b219503ee4aa7c9ee66a4903af14919ba84fd5e737e
MD5 65351bfd31e7632a7690600a533e7147
BLAKE2b-256 41e329bd2762764e3a00a8178c0c46ecd731e054abcc3b907eafb58659451274

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page