.. figure:: https://github.com/man-group/PyBloqs/raw/master/logo/logo50.png
:alt: pybloqs
pybloqs
|CircleCI| |PyPI| |ReadTheDocs| |Coverage Status|
PyBloqs is a flexible framework for visualizing data and automated
creation of reports.
.. figure:: https://github.com/man-group/PyBloqs/raw/master/pybloqs_in_notebook.png
:alt: pybloqs in use in ipython notebook
pybloqs in use in ipython notebook
It works with Pandas <http://pandas.pydata.org>
,
matplotlib <http://matplotlib.org>
and
highcharts <http://www.highcharts.com>
__. 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 <https://pybloqs.readthedocs.io/en/latest/installation.html>`__
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 <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: 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 <http://www.ahl.com/>`__ since 2013.
Original concept and implementation: `Tom
Farnbauer <https://github.com/SleepingPills>`__
Contributors:
- `Dominik Christ <https://github.com/DominikMChrist>`__
- `Barry Fitzgerald <https://github.com/pablojim>`__
- `Wilfred Hughes <https://github.com/wilfred>`__
- `James Munro <https://github.com/jamesmunro>`__
- `Bogdan Cozmaciuc <https://github.com/cozmacib>`__
- `Dave Jepson <https://github.com/swedishhh>`__
- `Jason Matthews <https://github.com/jjbmatthews>`__
- `Rhodri Richards <https://github.com/rhodrich>`__
- `Doug Bruce <https://github.com/douglasbruce88>`__
- `Jonathan Nye <https://github.com/jonnynye>`__
- `Matthew Dodds <https://github.com/doddsiedodds>`__
- `Han Wei Teo <https://github.com/HanTeo>`__
- `Manjunath Goudreddy <https://github.com/manjugoudreddy>`__
- `Edwin Flores <https://github.com/edf825>`__
- … and many others …
Contributions welcome!
License
-------
PyBloqs is licensed under the GNU LGPL v2.1. A copy of which is included
in `LICENSE <https://github.com/man-group/PyBloqs/raw/master/LICENSE>`__
.. |CircleCI| image:: https://circleci.com/gh/man-group/PyBloqs.svg?style=shield
:target: https://circleci.com/gh/man-group/PyBloqs
.. |PyPI| image:: https://img.shields.io/pypi/pyversions/pybloqs.svg
:target: https://pypi.python.org/pypi/pybloqs/
.. |ReadTheDocs| image:: https://readthedocs.org/projects/pybloqs/badge
:target: https://pybloqs.readthedocs.io
.. |Coverage Status| image:: https://coveralls.io/repos/github/manahl/PyBloqs/badge.svg?branch=master
:target: https://coveralls.io/github/manahl/PyBloqs?branch=master
Changelog
1.0.0 (2017-04-07)
.. _section-1:
1.0.1 (2017-04-13)
- Integration with pypi and ReadTheDocs.
- Installation on Mac and Windows.
.. _section-2:
1.0.2 (2017-04-26)
- Metadata and badge for Python version.
- Python 3 compatibility changes, part 1.
- Installation with Coveralls.
.. _section-3:
1.0.3 (2017-04-26)
- Bugfix: Import of urlparse corrected, fixes Block.show() .
.. _section-4:
1.1.0 (2017-05-10)
- jQuery DataTables support.
- HTML anchors.
- Bugfix: Width of HTML-body no longer hard-coded.
.. _section-5:
1.1.1 (2017-05-10)
- Bugfix: Static data including DataTables CSS.
.. _section-6:
1.1.2 (2017-06-2)
~~~~~~~~~~~~~~~~~
- Bugfix: Image size for Matplotlib figure no longer truncated to whole
number.
- Updated download path for wkhtmltopdf in CI setup.
.. _section-7:
1.1.3 (2017-06-6)
~~~~~~~~~~~~~~~~~
- Bugfix: Expansion of user home directory for show().
- Bugfix: Flexible definition of default type handling for Block() that
allows updating.
.. _section-8:
1.1.4 (2017-06-22)
- Bugfix: When applying operator on rows or columns (e.g. in totals
row), replace nan with zero.
.. _section-9:
1.1.5 (2017-08-22)
- Bugfix: Multi-index formatter can now digest DataFrame with
nun-unique multi-index.
- Bugfix: ReadTheDocs autodoc build fixed.
.. _section-10:
1.1.6 (2017-08-23)
- Bugfix: Unicode meta tag set in html output and unicode strings
working wit Raw() block.
.. _section-11:
1.1.7 (2018-02-23)
- Feature: More SMTP options
- Feature: UTF-8 email mime-type
- Feature: Allow BCC for email
.. _section-12:
1.1.8 (2018-03-26)
- Bugfix: FmtHighlightText - explicitly set non-bold for column header
- Feature: Add page break example to documentation
- Bugfix: Pass
apply_to_header_and_index
to base class on all
formatters
.. _section-13:
1.1.9 (2018-09-19)
- Bugfix: Indexing error in table.html with non-unique indices
- Bugfix: Removed Pandas warning in tests
- Remove WidePanel, update ipynb
- Feature: Add support for specifying different text colors for
MultiIndex levels
- Feature: Add a context manager for temporarily setting plot
format/DPI
.. _section-14:
1.2.0 (2018-11-21)
- Feature: Python 3 support
- Feature: Support for Bokeh plots
- Feature: Support for Plotly plots
- Feature: Allow use of different HTML conversion backends
- Feature: Added Chrome-headless backend for HTML->PDF conversion
- Updated CircleCI configuration to version 2
.. _section-15:
1.2.1 (2018-11-23)
- Bugfix: Removed pybloqs.plot import from top-level **init**.py
- Bugfix: puppeteer.js now included in egg/wheel packaging
.. _section-16:
1.2.2 (2018-11-27)
- Bugfix: Added missing formatter arg for wkhtmltox failure logging
.. _section-17:
1.2.3 (2018-12-03)
- Bugfix: Ensured python2 strings were being correctly encoded
.. _section-18:
1.2.4 (2019-03-27)
- Bugfix: Maintain static import ordering
.. _section-19:
1.2.5 (2019-06-25)
- Bugfix: Totals Row formatter no longer inserts NaN for non-numeric
columns.
.. _section-20:
1.2.6 (2019-07-17)
- Feature: Passing kwargs to plotly plot function.
.. _section-21:
1.2.7 (2019-08-06)
- Bugfix: Use require.js for Plotly and Highcharts inside Jupyter
- Moved id_precision to user_config
- Use tmp_html_dir everywhere
.. _section-22:
1.2.8 (2020-08-25)
- Bugfix: Use colgroup tag for FmtHeader width specification
- Bugfix: Do not merge MultiIndex cells if parent cells not merged
- Bugfix: Pass actual header cell contents to formatter methods
- Feature: Add ability to vertically merge MultiIndex labels
.. _section-23:
1.2.9 (2020-12-02)
- Bugfix: Fix header positions when index is a MultiIndex
- Bugfix: Fix MultiIndex styling
- Feature: Add formatter for vertical-align
.. _section-24:
1.2.10 (2020-12-03)
- Bugfix: Pass only single row name into formatter from jinja table
template
.. _section-25:
1.2.11 (2020-12-03)
- Bugfix: Stop MultiIndex flattening columns from being rendered
.. _section-26:
1.2.12 (2022-01-18)
- Feature: Add CommonTableFormatter builder to configuring table
formatting
- Bugfix: Fix striped background for table formatting
- Deprecate Python 2.7, make Python 3.6 minimum required version
.. _section-27:
1.2.13 (2022-01-25)
- Bugfix: Fix output of Plotly blocks no longer showing in newer
versions of Jupyter
- Bugfix: Add static output to Bokeh and Plotly to enable sending
within email body