Skip to main content

Python reporting tool.

Project description

Pyreball

Python pypi Tests

Pyreball is a Python reporting tool that generates HTML reports from Python scripts.

Main features:

The main motivation is to allow users to create persistent reports in the form of HTML pages from scripts retaining the Python syntax. The advantage of using regular Python scripts as the source of these HTML pages is that they are easy to maintain, can be refactored quickly through various IDEs, etc.

Pyreball is designed not to require any dependencies, unless you decide to use them. For example, if you decide to print pandas DataFrames to HTML tables and plot altair charts, you need to install pandas and altair.

Install

pip install pyreball

Quick Example

Create a regular python script, for example report.py:

import matplotlib.pyplot as plt
import pandas as pd
import pyreball as pb
import seaborn as sns

pb.set_title("Pyreball Illustration")

pb.print_h1("Introduction")

pb.print_div(
    "Pyreball has many features, among others:",
    pb.ulist(
        "Plots in altair, plotly, bokeh, and matplotlib (and thus also seaborn etc.).",
        "Sortable and scrollable tables from pandas DataFrame.",
        f'Basic text formatting such as {pb.bold("headings")}, {pb.em("emphasis")}, and {pb.code("lists")}.',
        f'{pb.link("hyperlinks", "https://www.python.org/")}, references and table of contents.',
    ),
)

pb.print_h1("Tables and Plots")

# Print a table
df = pd.DataFrame({"x": [1, 2, 3], "y": [4, 6, 5]})
pb.print_table(df, caption="A data table.")

# Plot a graph
fig, ax = plt.subplots()
sns.lineplot(x="x", y="y", ax=ax, data=df)
ax.set(xlabel="x", ylabel="y")
pb.print_figure(fig, caption="The first plot.")

In this particular example, we are using a few 3rd party packages, so let's install them too:

pip install pandas matplotlib seaborn

Then generate an HTML report by running:

pyreball report.py

pyreball command will generate report.html with the final report that should look like this:

Pyreball Screenshot

Documentation

See documentation for more examples and information about Pyreball.

Setting up Pyreball in PyCharm

There is no plugin but you can use it as an "external tool".

In PyCharm, go PyCharm -> Preferences... -> Tools -> External Tools and add a new tool with the following settings:

  • Name: pyreball
  • Description: pyreball
  • Program: $PyInterpreterDirectory$/pyreball
  • Arguments: $FilePath$
  • Working directory: $ProjectFileDir$

Then it is possible to run pyreball on the open Python script by clicking Tools -> External Tools -> pyreball or by right-clicking on the script and then selecting External Tools -> pyreball from the context menu.

The work can be simplified even further by creating action icon for pyreball in the main toolbar. Navigate to appropriate menu by opening PyCharm -> Preferences -> Appearance & Behavior -> Menus and Toolbars -> Main Toolbar ..., where you add action that will point to external tool pyreball. It is also possible to set up a keyboard shortcut for this external tool in PyCharm -> Preferences -> Keymap.

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

pyreball-2.2.1.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyreball-2.2.1-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file pyreball-2.2.1.tar.gz.

File metadata

  • Download URL: pyreball-2.2.1.tar.gz
  • Upload date:
  • Size: 32.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyreball-2.2.1.tar.gz
Algorithm Hash digest
SHA256 d13a7389fbd6096684fad3fff237803de8f6616caca8746e95d153fa7c35a056
MD5 6f2aba9c2bbbed48d1febe7224b45dfa
BLAKE2b-256 e44b954a872d78c3e11364ae723005901a06ac40e8e82e3280613582ddcf497e

See more details on using hashes here.

File details

Details for the file pyreball-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: pyreball-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyreball-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e0dc48ba715c99e84d5b5470a67f47b71e97e1e5919e3de25b2e0f5b585f57bc
MD5 95dbd35bf43b3a2c88d45cf00e39f445
BLAKE2b-256 c4c697af978a30df1ed1ba1e114d7a3ca2e343ce1794e4fa25d7ac1584901bf5

See more details on using hashes here.

Supported by

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