Skip to main content

Flask-Bitmapist

https://travis-ci.org/cuttlesoft/flask-bitmapist.svg?branch=master https://coveralls.io/repos/github/cuttlesoft/flask-bitmapist/badge.svg?branch=master

Flask extension that creates a simple interface to the Bitmapist analytics library.

About

Bitmapist is:

[A] Python library [that] makes it possible to implement real-time, highly scalable analytics that can answer the following questions:

  • Has user 123 been online today? This week? This month?

  • Has user 123 performed action “X”?

  • How many users have been active this month? This hour?

  • How many unique users have performed action “X” this week?

  • What % of users that were active last week are still active?

  • What % of users that were active last month are still active this month?

  • Which users performed action “X”?

Installation

$ pip install flask-bitmapist

Usage

Example app:

from flask import Flask
from flask_bitmapist import FlaskBitmapist, mark

app = Flask(__name__)

flaskbitmapist = FlaskBitmapist()
flaskbitmapist.init_app(app)

@app.route('/')
@mark('index:visited', 1)  # current_user.id
def index():
    """using the mark decorator, the first argument is the event
       and the second is the id of the current_user
    """
    return 'Hello, world!'

if __name__ == '__main__':
    app.run()

For documentation on the mark decorator, look at the mark_event Bitmapist function.

Config

Name

Type

Description

BITMAPIST_REDIS_SYSTEM

string

Name of Redis System; defaults to default

BITMAPIST_REDIS_URL

string

URL to connect to Redis server; defaults to redis://localhost:6379

BITMAPIST_TRACK_HOURLY

boolean

Tells Bitmapist to track hourly; can also be passed to mark (e.g., @mark('active', 1, track_hourly=False))

BITMAPIST_DISABLE_BLUEPRINT

boolean

Disables registration of default Bitmapist Blueprint

Cohort Blueprint

One of the nice things about Bitmapist is its simple bit operations API and the data cohort that you get. For more information about the cohort, visit the Bitmapist README.

When you initialize the flask-bitmapist extension, a blueprint is registered with the application.

Name

Path

Description

index

/bitmapist/

Default Bitmapist index

cohort

/bitmapist/cohort

Demo cohort retrieval and heatmap generation

Tests

To run the tests, ensure that you have Redis running on port 6399:

$ redis-server --port 6399

Then you can simply run:

$ python setup.py test

To seed fake data for testing, run:

$ python scripts/seed.py

Documentation

The full Flask-Bitmapist documentation is available at ReadTheDocs.

Contributing

If you’re interested in contributing to Flask-Bitmapist, get started by creating an issue here. Thanks!

Release History

0.1.0 (2016-03-30)

  • First release.

Release files for Flask-Bitmapist 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-Bitmapist 0.1.2
File Size Uploaded
Flask-Bitmapist-0.1.2.tar.gz 16.9 kB Details

Release files / Flask-Bitmapist-0.1.2.tar.gz

Download URL Flask-Bitmapist-0.1.2.tar.gz
Size 16.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1d5ea2907e478197f37717d1e5d1a6889239cc6ee4931482d4465dd29ef10d1f
BLAKE2b-256 checksum
How to use checksums
a89b703eaccb0e2b56fe04678315e23fc90e0fe85b9e17cb2cc27c13318ac624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page