← Back to team overview

launchpad-dev team mailing list archive

wave a feature flag today!

 

Feature Flags <http://dev.launchpad.net/LEP/FeatureFlags> are now live
on production (both devel and db-devel) and you can use them in your
own branches.

The basic concept is that rather than having things either hardcoded
to "is_edge" or having it implicit by the presence of that feature
only in a single branch, we will instead split the mechanism of
defining a logical feature, and the policy of where it ought to be
available.

They are one part of the "Release features when they're done"
<https://dev.launchpad.net/LEP/ReleaseFeaturesWhenTheyAreDone>, so
that eventually we may dispense with the edge/lpnet distinction and
have faster deliveries.

How would you use it today?  To make something conditional:

 1- within a page template, use the 'features' macro variable to get a
value, eg

   <div tal:condition="features/show_message">hello world!"</div>

 2- within code, use the lp.services.features.per_thread.features
object to look things up

Then by inserting rows into the featureflags table, you can turn them
on and off within particular scopes.  At the moment the only defined
scope is the somewhat boring 'default', which is always on, but soon
there will be one for beta users, and there are more exciting
possibilities in the LEP.

There is some documentation in
<http://people.canonical.com/~mwh/canonicalapi/lp.services.features.html>
and there will be some more there soon.

-- 
Martin



Follow ups