Skip to main content

🔧 Rich Tools

A python package with helpful functions for use alongside with the rich python library.

PyPI version Supported Python Versions Test


The current features are:

  • Convert a Pandas DataFrame into a rich Table ➜ df_to_table()

    By making this conversion, we can now pretty print a DataFrame in the terminal with rich. Bridging the gap between pandas and rich also provides a path for loading external data into a rich Table using Pandas functions such as .from_csv()!

  • Convert a rich Table into a Pandas DataFrame ➜ table_to_df()

    By bridging the gap between a rich Table and a DataFrame, we can now take additional actions on our data such as
    saving the data to a csv using the Pandas function .to_csv()!

  • Convert a rich Table into a list of dictionaries. ➜ table_to_dicts()

    Get your tables rows as a list of dictionaries with column names as key, and row contents as values.

  • Strip rich markup tags from a string. ➜ strip_markup_tags()

    Helper function to remove tags from text formatted with rich. "[bold]Bold[/bold]" becomes "Bold"

Installation

$ pip install rich-tools

Example

Additional examples can be found in the examples dir.

# Print csv data to the terminal as a pretty printed rich formatted table

import pandas as pd
from rich import print
from rich_tools import df_to_table

if __name__ == '__main__':
    df = pd.read_csv("sample_input.csv")
    table = df_to_table(df)
    print(table)

Credits

  • Like the rich package itself, its creator Will McGugan is awesome! Check out Textual "a TUI (Text User Interface) framework for Python inspired by modern web development". Thank you for the advice you've given on this project! 🙏
  • I am grateful for folks who give some of their time to this project in any form. Check out the list of contributors and learn more about contributing here.

Metadata

Release files for rich-tools 0.6.0

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

Source distribution (sdist)

Source distribution for rich-tools 0.6.0
File Size Uploaded
rich_tools-0.6.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rich-tools 0.6.0
File Interpreter ABI Platform
rich_tools-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / rich_tools-0.6.0.tar.gz

Download URL rich_tools-0.6.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
039fd87b076bf2d4fcd30e3a9b4b561b67d3ca98a1ffdb49416cb74e566896fc
BLAKE2b-256 checksum
How to use checksums
1a81e7b5dae7aa5bdf89a833845fdd12d5f1e0d622f308298f8a664f65bc0f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Windows/11

Release files / rich_tools-0.6.0-py3-none-any.whl

Download URL rich_tools-0.6.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a6971af5821c63f1d3fceb777b91f2e1215c3b9a086b00b0b78231306a40851
BLAKE2b-256 checksum
How to use checksums
c5f40d88dd4ce83b789194900b0713a58573f8b66a016b99b1004a2e84f95fe3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.12.6 Windows/11

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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