Skip to main content

REPORTS

https://badge.fury.io/py/reports.svg https://travis-ci.org/cokelaer/reports.svg?branch=master https://coveralls.io/repos/github/cokelaer/reports/badge.svg?branch=master Documentation Status
Python version:

Python 3.7, 3.8, 3.9

Online documentation:

On readthedocs

Issues and bug reports:

On github

Reports is a Python package that provides tools to create HTML documents. It is based on a set of JINJA templates and a class called Report. In addition tools such as HTMLTable can help in the creation of HTML table to be included in the report.

The package relies on Pandas for the HTML table creation, as shown in the example below.

We provide a simple JINJA example (stored with the pacakge in ./share/data/templates/generic directory) and we let the users design their own templates.

This is used in GDSCTools.

Warnings

Reports is maintained but no new future will be added. It is maintained for the GDSCTools project but if you find it useful please feel free to use it.

Installation

pip install reports

Usage

Example

Here below, we show the code used to create this example.

# We will create a Report and insert an HTML table in it
from reports import Report, HTMLTable

# Let us create some data. It will be a HTML table built using Pandas
# but you could create the HTML table code yourself.
import pandas as pd

# create a dataframe to play with. Note that there is a numeric column
# In addition, there is a column (Entry name) that will be transformed into URLs
df = pd.DataFrame({
    "Entry name":["ZAP70_HUMAN", "TBK1_HUMAN"],
    "Entry": ["P43403", "Q9UHD2"],
    "Frequency": [0.5,0.9]})

# From reports, we convert the dataframe into a HTMLTable
table = HTMLTable(df)

# a numeric column can be colorized
table.add_bgcolor('Frequency', cmap="copper")

# part of URLs can be added to the content of a column
table.add_href('Entry', url='http://uniprot.org/uniprot/', suffix="")
html = table.to_html()

# Create a generic report. It has a set of tags that can be filled
# using the **jinja** attribute.
r = Report("generic")

# set the **summary** tag with the HTML code of the table
r.jinja['summary'] = html

# Generate and show the report
r.create_report(onweb=True)

See the results in example

Using your own JINJA template

Create a directory called test and add a file called index.html

Add this code:

<h1> {{ title }} </h1>
<p> Number of reads : {{ reads }} </p>

Now, create your HTML files:

from reports import Report
report = Report("test")
report.jinja['title'] = 'Simple Example'
report.jinja['reads'] = "123456"
report.create_report(onweb=True)

Issues

Please fill bug report in https://github.com/cokelaer/reports

Metadata

Release files for reports 0.4.1

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

Source distribution (sdist)

Source distribution for reports 0.4.1
File Size Uploaded Provenance
reports-0.4.1.tar.gz 150.4 kB Without provenance Details

Release files / reports-0.4.1.tar.gz

Download URL reports-0.4.1.tar.gz
Size 150.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2221c1f5c268b56d1d862189319cdc6fd84a3041a29edd51ab5aa71c9354edae
BLAKE2b-256 checksum
How to use checksums
5ada28384bc3239358fbed271ab158588bb6a0adc744ca0163e5f1b665f43212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.3

Security for reports 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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