Giter Club home page Giter Club logo

brint's Introduction

Brint

Brint is a feature gating library without feature flags.
Each feature is associated with a version, and automatically enabled depending on the current module version.

Example

See example/test.py.

pip install brint
python -m example.test

Install

cd brint-py
python setup.py install --user

cd ../brint-cli
cargo install --path .

brint-py

@brint.feature(..) decorates functions and classes.
You can override an old entity with new one, or the new with the old.

import brint

@brint.feature(name='feature name', version='3.0.0',
    old=<old replacement>,            # optional
    new=<new replacement>,            # optional
    author='@author',                 # optional
    description='might increase CPR', # optional
)

brint-cli

These features can be listed in the command line.

❯ brint

Last
    [0.9.2]
    ..

Current
    [1.0.0]
        new "dark default theme"
            - def default_theme in ./main.py:20
            - def web_default_theme in ./user.py:30

        new "multi-threaded processor"
            - class Processor in ./main.py:50

        obsolete "temporary feature1"
        obsolete "temporary feature2"


Upcoming
    [1.0.1]
    ..

    [1.0.2]
    ..

Pre-release and Build metadata

Pre-release is intentionally ignored when checking the version. Brint will complain about any pre-release in the condition.

@brint.feature('1')  # this featute is included in 1.0.0-alpha.1, 1.0.0-beta, 1.0.0
@brint.feature('1.0.0-beta.1')  # error
@brint.feature('1.0.0+20210101')  # same as '1.0.0'. build metadata is ignored

Brint.toml (TODO)

Feature flags can be defined in Brint.toml.
This is useful for (1) sharing feature flags in a cross-language codebase, and (2) managing feature flags in one place.

[features]
feature-name-1 = "1.0.0"
feature-name-2 = { version = "2", author = "@dev", description = "desc" }
@brint.feature('feature-name-1', new=new_fn)
def old_fn(): ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.