Skip to content

A flexible framework for visualizing data and automated creation of reports.

License

Notifications You must be signed in to change notification settings

man-group/PyBloqs

Repository files navigation

pybloqs

CircleCI PyPI ReadTheDocs Coverage Status

PyBloqs is a flexible framework for visualizing data and automated creation of reports.

pybloqs in use in ipython notebook

 

It works with Pandas, matplotlib and highcharts. PyBloqs creates atomic blocks containing text, tables (from Pandas DataFrame), plots (matplotlib or highcharts) or images. All blocks can be styled with CSS. Each block can be created and displayed separately for fast development turnover. Lists of blocks can be stacked together to form reports. Reports can be displayed as HTML in the browser or exported in a variety of formats (including HTML, PDF, SVG, PNG).

Quickstart

Install PyBloqs

See the documentation for installation instructions.

Using PyBloqs

from pybloqs import Block, HStack, VStack
import pandas as pd
from matplotlib import pyplot as plt

text_block = Block('This is a text block', styles={'text-align':'center', 'color':'blue'})
text_block.show()

df = pd.DataFrame([[1., 2.],[3.,4.]], columns =['a', 'b'])
table_block = Block(df)
table_block.show()

plot_block = Block(plt.plot(df['a'], df['b']))
plot_block.show()

plot_and_table = HStack([plot_block, table_block])
report = VStack([text_block, plot_and_table])
report.show()
report.save('report.pdf')

Configuration

You can specify per-user default parameters in a yaml-formatted file ~/.pybloqs.cfg. This config file allows you to setup a call setup and login sequence against an smtplib.SMTP object. The following works for Google gmail - more detailshere.

smtp_kwargs:
  host: smtp.gmail.com
  port: 587
smtp_pre_login_calls:
- !!python/tuple
  - ehlo
  - {}
- !!python/tuple
  - starttls
  - {}
- !!python/tuple
  - ehlo
  - {}
smtp_login:
  user: me@gmail.com
  password: a_secret
public_dir: /tmp
tmp_html_dir: /tmp
user_email_address: me@gmail.com

Requirements

PyBloqs works with:

  • matplotlib
  • Pandas
  • html5lib
  • lxml
  • jinja2
  • markdown
  • beautifulsoup4
  • docutils

Acknowledgements

PyBloqs has been under active development at Man AHL since 2013.

Original concept and implementation: Tom Farnbauer

Contributors:

Contributions welcome!

License

PyBloqs is licensed under the GNU LGPL v2.1. A copy of which is included in LICENSE