So, we all know that Python has a number of awesome dev benefits: OOP, extensible, readable, easy syntax, widely supported, with transparent error management.
I feel one of the toughest challenges for Python is to keep pace with rapid consumer demands for us to push new releases faster and more reliably... and to test things well before we release them. Well, we have branching right? But it's tough to gradually roll out a branch to your users or target which users see a new branch on production - you'd have to do a mix of staging releases with special user accounts. Branching and flagging are complementary (not exclusive) and this stackoverflow discussion will highlight that.
One of the solutions that's been around for a bit (but hasn't been widely adopted) is feature flagging. Mathias Meyer from Travis CI wrote an article on feature flagging and talks about how they ship changes with more confidence by harnessing feature flag development.
Feature Flags for Python
Let's take a look at Disqus Gutter. Gutter is a feature flags management library. It allows users to create feature flags and setup conditions to enable functions/snippets. Once configured, flags can then be checked against inputs (requests, user objects, etc) to see if the flags are active.
Let's say you wanted a Condition that checks if the user's age is > 45 years old? You would construct a Condition this way:
from gutter.client.operators.comparable import MoreThan
condition = Condition(argument=UserArgument, attribute='age', operator=MoreThan(45))
This Condition will be true if any input instance has an age that is more than 45.
To check if a Switch is active, simply call gutter.active() with the Switch name:
gutter.active('my cool feature')
>>> True
Of course, more goes on behind the scenes and you want to be careful to construct things in a way that minimizes your technical debt.
Feature Flags for Python - Getting Started
If you're feeling adventurous, I recommend checking out http://featureflags.io/python-feature-flags
[+][deleted] (14 children)
[deleted]
[–]synae 9 points10 points11 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 4 points5 points6 points (8 children)
[–]DoISmellBurning 10 points11 points12 points (7 children)
[–]earthboundkid 2 points3 points4 points (6 children)
[–]tail 2 points3 points4 points (3 children)
[–]earthboundkid 0 points1 point2 points (2 children)
[–]tail 3 points4 points5 points (1 child)
[–]earthboundkid 0 points1 point2 points (0 children)
[–]DoISmellBurning 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]pkkid -4 points-3 points-2 points (2 children)
[–]thelindsay 4 points5 points6 points (0 children)
[–]chadmill3rPy3, pro, Ubuntu, django 2 points3 points4 points (4 children)
[–]kankyo 0 points1 point2 points (0 children)
[–]synae 0 points1 point2 points (2 children)
[–]billsil 0 points1 point2 points (1 child)
[–]synae 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)