pyreball


Namepyreball JSON
Version 2.1.0 PyPI version JSON
download
home_pageNone
SummaryPython reporting tool.
upload_time2024-04-15 19:48:59
maintainerNone
docs_urlNone
authorKarel Vaculik
requires_python>=3.8
licenseApache-2.0
keywords python reporting html
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pyreball

<p style="text-align: center">

![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)
[![pypi](https://img.shields.io/pypi/v/pyreball.svg)](https://pypi.python.org/pypi/pyreball)
[![Tests](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml/badge.svg)](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml)

</p>

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

Main features:

- Plots in [Vega-Altair](https://altair-viz.github.io/index.html), [Plotly](https://plotly.com/), [Bokeh](https://bokeh.org/), and [Matplotlib](https://matplotlib.org/) (and thus also [Seaborn](https://seaborn.pydata.org/) etc.).
- Interactive tables based on [DataTables](https://datatables.net/) library and created from [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html).
- Basic text formatting such as headings, emphasis, and lists.
- Hyperlinks, references and table of contents.

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

```shell
pip install pyreball
```

## Quick Example

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

```python
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:

```shell
pip install pandas matplotlib seaborn
```

Then generate an HTML report by running:

```shell
pyreball report.py
```

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

![Pyreball Screenshot](pyreball_result_screenshot.png)

## Documentation

See [documentation](https://pyreball.readthedocs.io/) 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`.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyreball",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "python, reporting, html",
    "author": "Karel Vaculik",
    "author_email": "vaculik.dev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/58/6d/2a12e28a3dd312efa9918e9a2ac4dcf9c7b807002d035f019474f52c11be/pyreball-2.1.0.tar.gz",
    "platform": null,
    "description": "# Pyreball\n\n<p style=\"text-align: center\">\n\n![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)\n[![pypi](https://img.shields.io/pypi/v/pyreball.svg)](https://pypi.python.org/pypi/pyreball)\n[![Tests](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml/badge.svg)](https://github.com/karelvaculik/pyreball/actions/workflows/tests.yml)\n\n</p>\n\nPyreball is a Python reporting tool that generates HTML reports from Python scripts.\n\nMain features:\n\n- Plots in [Vega-Altair](https://altair-viz.github.io/index.html), [Plotly](https://plotly.com/), [Bokeh](https://bokeh.org/), and [Matplotlib](https://matplotlib.org/) (and thus also [Seaborn](https://seaborn.pydata.org/) etc.).\n- Interactive tables based on [DataTables](https://datatables.net/) library and created from [pandas DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html).\n- Basic text formatting such as headings, emphasis, and lists.\n- Hyperlinks, references and table of contents.\n\nThe main motivation is to allow users to create persistent reports in the form of HTML pages from scripts retaining the\nPython syntax.\nThe advantage of using *regular* Python scripts as the source of these HTML pages is that they are easy to maintain, can\nbe refactored quickly through various IDEs, etc.\n\nPyreball is designed not to require any dependencies, unless you decide to use them. For example, if you decide to print\npandas DataFrames to HTML tables and plot altair charts, you need to install pandas and altair.\n\n## Install\n\n```shell\npip install pyreball\n```\n\n## Quick Example\n\nCreate a regular python script, for example `report.py`:\n\n```python\nimport matplotlib.pyplot as plt\nimport pandas as pd\nimport pyreball as pb\nimport seaborn as sns\n\npb.set_title(\"Pyreball Illustration\")\n\npb.print_h1(\"Introduction\")\n\npb.print_div(\n    \"Pyreball has many features, among others:\",\n    pb.ulist(\n        \"Plots in altair, plotly, bokeh, and matplotlib (and thus also seaborn etc.).\",\n        \"Sortable and scrollable tables from pandas DataFrame.\",\n        f'Basic text formatting such as {pb.bold(\"headings\")}, {pb.em(\"emphasis\")}, and {pb.code(\"lists\")}.',\n        f'{pb.link(\"hyperlinks\", \"https://www.python.org/\")}, references and table of contents.',\n    ),\n)\n\npb.print_h1(\"Tables and Plots\")\n\n# Print a table\ndf = pd.DataFrame({\"x\": [1, 2, 3], \"y\": [4, 6, 5]})\npb.print_table(df, caption=\"A data table.\")\n\n# Plot a graph\nfig, ax = plt.subplots()\nsns.lineplot(x=\"x\", y=\"y\", ax=ax, data=df)\nax.set(xlabel=\"x\", ylabel=\"y\")\npb.print_figure(fig, caption=\"The first plot.\")\n```\n\nIn this particular example, we are using a few 3rd party packages, so let's install them too:\n\n```shell\npip install pandas matplotlib seaborn\n```\n\nThen generate an HTML report by running:\n\n```shell\npyreball report.py\n```\n\n`pyreball` command will generate `report.html` with the final report that should look like this:\n\n![Pyreball Screenshot](pyreball_result_screenshot.png)\n\n## Documentation\n\nSee [documentation](https://pyreball.readthedocs.io/) for more examples and information about Pyreball.\n\n## Setting up Pyreball in PyCharm\n\nThere is no plugin but you can use it as an \"external tool\".\n\nIn PyCharm, go `PyCharm -> Preferences... -> Tools -> External Tools` and add a new tool with the following settings:\n\n- Name: `pyreball`\n- Description: `pyreball`\n- Program: `$PyInterpreterDirectory$/pyreball`\n- Arguments: `$FilePath$`\n- Working directory: `$ProjectFileDir$`\n\nThen it is possible to run `pyreball` on the open Python script by clicking\n`Tools -> External Tools -> pyreball` or by right-clicking on the script and then selecting\n`External Tools -> pyreball` from the context menu.\n\nThe work can be simplified even further by creating action icon for `pyreball` in the main toolbar. Navigate to\nappropriate menu by opening\n`PyCharm -> Preferences -> Appearance & Behavior -> Menus and Toolbars -> Main Toolbar ...`, where you *add action*\nthat will point to external tool `pyreball`. It is also possible to set up a keyboard shortcut for this external tool\nin `PyCharm -> Preferences -> Keymap`.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python reporting tool.",
    "version": "2.1.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        " reporting",
        " html"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "995b9e1aad9d6f04b3f9c5008e8b94e8a64265f955607c8de2b15d32cf23e781",
                "md5": "4051ec294801edaac3dab452ee411b56",
                "sha256": "15b4cd43ee8742ff2e9a21121a11a40c26653864b40221e8cc7c92f02b72f81b"
            },
            "downloads": -1,
            "filename": "pyreball-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4051ec294801edaac3dab452ee411b56",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 34892,
            "upload_time": "2024-04-15T19:48:57",
            "upload_time_iso_8601": "2024-04-15T19:48:57.623181Z",
            "url": "https://files.pythonhosted.org/packages/99/5b/9e1aad9d6f04b3f9c5008e8b94e8a64265f955607c8de2b15d32cf23e781/pyreball-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "586d2a12e28a3dd312efa9918e9a2ac4dcf9c7b807002d035f019474f52c11be",
                "md5": "ff73c4ffd46911b9217a0d5f70ea7d6d",
                "sha256": "05185f270f8b8d02dc996cb9cb7566d63600175070cd7335fbcfcf7ee7ff5383"
            },
            "downloads": -1,
            "filename": "pyreball-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ff73c4ffd46911b9217a0d5f70ea7d6d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 32744,
            "upload_time": "2024-04-15T19:48:59",
            "upload_time_iso_8601": "2024-04-15T19:48:59.598398Z",
            "url": "https://files.pythonhosted.org/packages/58/6d/2a12e28a3dd312efa9918e9a2ac4dcf9c7b807002d035f019474f52c11be/pyreball-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-15 19:48:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyreball"
}
        
Elapsed time: 0.24285s