Skip to main content

Data Visualization and Report Building

Project description

CircleCI PyPI ReadTheDocs Coverage Status

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

pybloqs in use in ipython notebook

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

For a minimal install without HighCharts support run:

pip install pybloqs

or when installing in development mode:

python setup.py develop

This will allow you to run the example code below.

External dependencies

For full functionality, PyBloqs requires the following 3rd party programs and libraries. For some, the file location must be specified at install time:

pip install --install-option="INSTALL OPTIONS" git+https://github.com/manahl/pybloqs.git

e.g.

pip install --install-option="--highcharts=~/node_modules/highcharts/,~/node_modules/highcharts-heatmap/" git+https://github.com/manahl/pybloqs.git

wkhtmltopdf is not bundled with PyBloqs. You need to install it from your distribution’s repository (Linux) or download it from the project page (https://wkhtmltopdf.org) . The binaries wkhtmltopdf and wkhtmltoimage are used for file output other than HTML. PyBloqs will search for the binaries on the system path. If you would like to use a local copy of the binaries, install with following option:

--wkhtmltopdf=/path/to/binary

When installing in development mode you can load highcharts explicitly:

python setup.py load_wkhtmltopdf --wkhtmltopdf=/path/to/binary

Highcharts is not bundled with PyBloqs. To create blocks with Highcharts plots, you need to download Highcharts separately (e.g. with npm install highcharts, npm install highcharts-heatmap etc.), and provide the path to your highcharts installation. Please make sure you have the right license for Highcharts. For full functionality you will need the following highcharts packages: highcharts, highcharts-heatmap, highcharts-funnel, highcharts-exporting, highcharts-export-csv (this example assumes, npm installed files into directory ~/node_modules).

--highcharts=~/node_modules/highcharts/,
~/node_modules/highcharts-heatmap/,~/node_modules/highcharts-funnel,~/node_modules/highcharts-exporting,
~/node_modules/highcharts-export-csv

When installing in development mode you can load highcharts explicitly (this example assumes, npm installed files into directory ~/node_modules)

python setup.py load_highcharts --highcharts=~/node_modules/highcharts/,~/node_modules/highcharts-heatmap/,\
~/node_modules/highcharts-funnel,~/node_modules/highcharts-exporting,~/node_modules/highcharts-export-csv

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:

user_email_address: some@email.com  # Default: user name
public_dir: /some/dir               # Default: /tmp
tmp_html_dir: /some/dir             # Default: /tmp
smtp_server: url.for.email.server   # Default: ''

Documentation

Have a look at the detailed documentation.

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 from AHL Tech team:

Contributions welcome!

License

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

Changelog

1.0.0 (2017-04-07)

  • Initial public release

1.0.1 (2017-04-13)

  • Integration with pypi and ReadTheDocs.

  • Installation on Mac and Windows.

1.0.2 (2017-04-26)

  • Metadata and badge for Python version.

  • Python 3 compatibility changes, part 1.

  • Installation with Coveralls.

1.0.3 (2017-04-26)

  • Bugfix: Import of urlparse corrected, fixes Block.show() .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybloqs-1.0.3.tar.gz (55.9 kB view details)

Uploaded Source

Built Distributions

pybloqs-1.0.3-py2.7.egg (49.5 kB view details)

Uploaded Source

pybloqs-1.0.3-py2-none-any.whl (53.8 kB view details)

Uploaded Python 2

File details

Details for the file pybloqs-1.0.3.tar.gz.

File metadata

  • Download URL: pybloqs-1.0.3.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybloqs-1.0.3.tar.gz
Algorithm Hash digest
SHA256 6806cab41944a99cb8513e52a6ec3a407d07cac6a0cfacd55d4832c0bde4036a
MD5 907f0f2ed2cd077641074155d13d26ee
BLAKE2b-256 0dda433268e25d6eac164fe725e47c8f6d0f89cebe01e5446e3d2a13009def7e

See more details on using hashes here.

File details

Details for the file pybloqs-1.0.3-py2.7.egg.

File metadata

  • Download URL: pybloqs-1.0.3-py2.7.egg
  • Upload date:
  • Size: 49.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybloqs-1.0.3-py2.7.egg
Algorithm Hash digest
SHA256 02fff0fa72c6bc74bcb4131190d556844cdd910f8ea3dda616a6e05e0f6be962
MD5 a51f4a6f8a149b6ab9ed16c986bb6423
BLAKE2b-256 8a481e531b98f801c75f142cd0d795c1c83e60af388d8fab23513d12e242de44

See more details on using hashes here.

File details

Details for the file pybloqs-1.0.3-py2-none-any.whl.

File metadata

File hashes

Hashes for pybloqs-1.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 dca767ff3582fd46dea92d948663e130a0efa625ee90df265f8b56627959a788
MD5 4fd8ce7ab7f75b1ef03f58f7dcb56c11
BLAKE2b-256 585b2b93eee5a63a4a4d3f73a51736e5ae8aad96bc50f5207e9edccf21238bd9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page