• Stars
    star
    151
  • Rank 246,057 (Top 5 %)
  • Language
    Python
  • License
    GNU Lesser Genera...
  • Created over 8 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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

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 wkhtmltopdf explicitly:

python setup.py load_wkhtmltopdf --wkhtmltopdf=/path/to/binary
  • Node.js with comander and puppeteer (optional; for PDF output with 'chrome_headless' backend). Please make sure these are available globally. In development mode, you can run
npm install

in the main PyBloqs directory.

  • Bokeh (optional). To install Bokeh dependency, you can use:
pip install pybloqs[bokeh]
  • Plotly (optional). To install Plotly dependency, you can use:
pip install pybloqs[plotly]

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. This config file allows you to setup a call setup and login sequence against an smtplib.SMTP (https://docs.python.org/2/library/smtplib.html#smtplib.SMTP) object. The following works for Google gmail - more details here (https://support.google.com/a/answer/176600?hl=en)

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

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:

Contributions welcome!

License

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

More Repositories

1

dtale

Visualizer for pandas data structures
TypeScript
4,687
star
2

arctic

High performance datastore for time series and tick data
Python
3,053
star
3

ArcticDB

ArcticDB is a high performance, serverless DataFrame database built for the Python Data Science ecosystem.
C++
1,480
star
4

notebooker

Productionise & schedule your Jupyter Notebooks as easily as you wrote them.
Python
856
star
5

pytest-plugins

A grab-bag of nifty pytest plugins
Python
562
star
6

PythonTrainingExercises

Code to exercise your Python knowledge.
Python
259
star
7

dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
C#
175
star
8

mdf

Data-flow programming toolkit for Python
Python
167
star
9

page-objects

Page Objects web testing pattern for Python
Python
126
star
10

pynorama

Natural Language Processing Visualization in Python
JavaScript
108
star
11

partialtesting

Run only the tests that are relevant for your changes
Python
73
star
12

jupyterlab-autoplot

Magical Plotting in JupyterLab
Python
65
star
13

okcli

An Oracle-DB command line client
Python
50
star
14

adaero

A platform for managing peer-to-peer feedback
Python
43
star
15

pkglib

Company-centric Python packaging and testing library
Python
39
star
16

openstack_load_leveller

Openstack Load Leveller / Load Balancer
Python
30
star
17

prometheus-flashblade-exporter

Export metrics from Pure Storage FlashBlade to Prometheus
Go
29
star
18

mockextras

Addon library for the python Mock library
Python
25
star
19

hubot-servicenow-tickets

a servicenow plugin for hubot
JavaScript
19
star
20

jenkins-blueprint-plugin

Build Jenkins projects according to a .jenkins.yml file in the repository.
Java
17
star
21

sparrow

C++20 idiomatic APIs for the Apache Arrow Columnar Format
C++
15
star
22

ftp-coredump

FTP core dump script and related Ansible roles
Shell
13
star
23

servicenow-lite

utility library for interacting with servicenow
JavaScript
11
star
24

hiveminder

Python
8
star
25

hexplode

Python
8
star
26

microbit

Information and examples about the BBC micro:bit
Python
5
star
27

pydata2022

3
star