Name | tabulato JSON |
Version |
1.0.3
JSON |
| download |
home_page | |
Summary | This is a Python package that provides functionality for generating tabulated representations of data with customizable colors and formatting options. It offers a user-friendly interface for creating visually appealing tables in terminal output. |
upload_time | 2024-03-07 12:48:10 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.9 |
license | MIT License Copyright (c) 2024 crispengari Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
tabulato
tables
pretty-table
console
styling
text-formatting
cli
ansi
print
text-decoration
csv
tabulate-data
|
VCS |
|
bugtrack_url |
|
requirements |
colorama
iniconfig
packaging
pluggy
pytest
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
### tabulato
`tabulato` is a Python package that provides functionality for generating tabulated representations of data with customizable colors and formatting options. It offers a user-friendly interface for creating visually appealing tables in terminal output.
With `tabulato`, you can easily format your data into tables with specified headers, apply different colors to headers and rows, and customize the appearance of your tabulated data. Whether you're working on command-line applications, data analysis scripts, or any other project that requires presenting data in a tabular format, `tabulato` can help streamline the process and enhance the visual presentation of your data.
<p align="center">
<a href="https://pypi.python.org/pypi/tabulato"><img src="https://badge.fury.io/py/tabulato.svg"></a>
<a href="https://github.com/crispengari/tabulato/actions/workflows/ci.yml"><img src="https://github.com/crispengari/tabulato/actions/workflows/ci.yml/badge.svg"></a>
<a href="/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green"></a>
<a href="https://pypi.python.org/pypi/tabulato"><img src="https://img.shields.io/pypi/pyversions/tabulato.svg"></a>
</p>
### Table of Contents
- [tabulato](#tabulato)
- [Table of Contents](#table-of-contents)
- [Key features of tabulato include:](#key-features-of-tabulato-include)
- [Installation](#installation)
- [Python Version](#python-version)
- [Example](#example)
- [What's missing on this package?](#whats-missing-on-this-package)
- [License](#license)
### Key features of tabulato include:
- Generating tables with customizable colors for headers, even rows, and odd rows.
- Specifying required columns to ensure important data is always displayed.
- Option to make headers bold for emphasis.
- User-friendly API for straightforward integration into your Python projects.
> tabulato simplifies the task of formatting and presenting tabular data in terminal environments, making it an essential tool for developers and data scientists working with command-line interfaces.
### Installation
To install tabulato, you can use pip:
```bash
pip install tabulato
```
### Python Version
This package support python version `>=3.10`
### Example
In the following examples shows you how you can use
```py
from tabulato import colorful_tabulate, TableRowStyle
headers = ["Name", "Student Number", "DOB", "Email Address"]
data = [
["John Doe", "S12345", "1995-07-15", "john@example.com"],
["Alice Smith", "S67890", "1998-03-22", "alice@example.com"],
["Bob Johnson", "S54321", "1997-11-10", "bob@example.com"],
["Emma Brown", "S98765", "1996-09-18", "emma@example.com"],
["Michael Lee", "S24680", "1999-05-30", "michael@example.com"],
["Sophia Wang", "S13579", "1994-12-05", "sophia@example.com"],
["David Chen", "S75310", "1992-04-08", "david@example.com"],
["Olivia Kim", "S36924", "1993-10-25", "olivia@example.com"],
]
colorful_tabulate(
data=data,
column_widths=[20, 20, 20, 30],
)
```
The above function will result in the following table being created in the terminal.
```shell
+----------------------+----------------------+----------------------+--------------------------------+
| name | student number | dob | email |
+----------------------+----------------------+----------------------+--------------------------------+
| John Doe | S12345 | 1995-07-15 | john@example.com |
| Alice Smith | S67890 | 1998-03-22 | alice@example.com |
| Bob Johnson | S54321 | 1997-11-10 | bob@example.com |
| Emma Brown | S98765 | 1996-09-18 | emma@example.com |
| Michael Lee | S24680 | 1999-05-30 | michael@example.com |
| Sophia Wang | S13579 | 1994-12-05 | sophia@example.com |
| David Chen | S75310 | 1992-04-08 | david@example.com |
| Olivia Kim | S36924 | 1993-10-25 | olivia@example.com |
+----------------------+----------------------+----------------------+--------------------------------+
```
The colorful table will look as follows:
<p align='center'><img src='https://github.com/CrispenGari/tabulato/blob/main/images/0.jpg?raw=true' alt='demo' width="400"/></p>
However you can style the rows of the table using the `TableRowStyle` class by specifying the options as follows:
```py
colorful_tabulate(
data=data,
column_widths=[20, 20, 20, 30],
header_style=TableRowStyle(
bold=True,
italic=False,
color="BLUE",
background="BG_BLUE",
),
even_row_style=TableRowStyle(
bold=False,
italic=False,
color="GREEN",
underline=True,
),
odd_row_style=TableRowStyle(
bold=False,
italic=False,
color="YELLOW",
strikethrough=True,
),
)
```
<p align='center'><img src='https://github.com/CrispenGari/tabulato/blob/main/images/1.jpg?raw=true' alt='demo' width="400"/></p>
The table data can also be a list of python dictionaries. Here is an example of using a list of python dictionaries to generate a table.
```py
data = [
{
"name": "John Doe",
"student number": "S12345",
"dob": "1995-07-15",
"email": "john@example.com",
},
{
"name": "Alice Smith",
"student number": "S67890",
"dob": "1998-03-22",
"email": "alice@example.com",
},
{
"name": "Bob Johnson",
"student number": "S54321",
"dob": "1997-11-10",
"email": "bob@example.com",
},
{
"name": "Emma Brown",
"student number": "S98765",
"dob": "1996-09-18",
"email": "emma@example.com",
},
{
"name": "Michael Lee",
"student number": "S24680",
"dob": "1999-05-30",
"email": "michael@example.com",
},
{
"name": "Sophia Wang",
"student number": "S13579",
"dob": "1994-12-05",
"email": "sophia@example.com",
},
{
"name": "David Chen",
"student number": "S75310",
"dob": "1992-04-08",
"email": "david@example.com",
},
{
"name": "Olivia Kim",
"student number": "S36924",
"dob": "1993-10-25",
"email": "olivia@example.com",
},
]
colorful_tabulate(
data=data,
column_widths=[20, 20, 20, 30],
)
```
The `colorful_tabulate` is a useful function for visually enhancing tabulated data in terminal output by applying colors and styling. The following are the parameters that this function takes.
| Parameter | Description | Type | Default | Required |
| ---------------- | -------------------------------------- | --------------- | -------------------------------------------------------------------------- | -------- |
| `data` | The list of data to be displayed. | `list` | - | `Yes` |
| `headers` | The list of column headers. | `list` | `None` | `No` |
| `colorful` | Whether to display the table in color. | `bool` | `True` | `No` |
| `bold_header` | Whether to display the header in bold. | `bool` | `True` | `No` |
| `header_style` | Style for the header row. | `TableRowStyle` | `TableRowStyle(bold=True, italic=False, color="BLUE", background=None)` | `No` |
| `even_row_style` | Style for even-numbered rows. | `TableRowStyle` | `TableRowStyle(bold=False, italic=False, color="GREEN", background=None)` | `No` |
| `odd_row_style` | Style for odd-numbered rows. | `TableRowStyle` | `TableRowStyle(bold=False, italic=False, color="YELLOW", background=None)` | `No` |
| `column_widths` | List of column widths. | `list` | `[]` | `No` |
The following are the color literals that can be passed to the `color` abd `background` respectively.
| Color | Description |
| ---------- | ----------- |
| `"BLACK"` | Black |
| `"RED"` | Red |
| `"GREEN"` | Green |
| `"YELLOW"` | Yellow |
| `"BLUE"` | Blue |
| `"PURPLE"` | Purple |
| `"CYAN"` | Cyan |
| `"WHITE"` | White |
| Background | Description |
| ------------- | ----------------- |
| `"BG_BLACK"` | Black background |
| `"BG_RED"` | Red background |
| `"BG_GREEN"` | Green background |
| `"BG_BLUE"` | Blue background |
| `"BG_PURPLE"` | Purple background |
| `"BG_CYAN"` | Cyan background |
| `"BG_WHITE"` | White background |
| `"BG_YELLOW"` | Yellow background |
### What's missing on this package?
This package lacks `wrapping` of text for long lines. This `version` only support small tables. Long column data might not end up displayed well, however with small column data like this package is the best.
### License
This project is licensed under the MIT License - see the [LICENSE](/LISENSE) file for details.
Raw data
{
"_id": null,
"home_page": "",
"name": "tabulato",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "tabulato,tables,pretty-table,console,styling,text-formatting,CLI,ANSI,print,text-decoration,csv,tabulate-data",
"author": "",
"author_email": "Crispen Gari <crispengari@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/a5/00/e67e347c3bdfc7684227c4947a64a084c96eb41004e3bf0133ccddf72601/tabulato-1.0.3.tar.gz",
"platform": null,
"description": "### tabulato\n\n`tabulato` is a Python package that provides functionality for generating tabulated representations of data with customizable colors and formatting options. It offers a user-friendly interface for creating visually appealing tables in terminal output.\n\nWith `tabulato`, you can easily format your data into tables with specified headers, apply different colors to headers and rows, and customize the appearance of your tabulated data. Whether you're working on command-line applications, data analysis scripts, or any other project that requires presenting data in a tabular format, `tabulato` can help streamline the process and enhance the visual presentation of your data.\n\n<p align=\"center\">\n <a href=\"https://pypi.python.org/pypi/tabulato\"><img src=\"https://badge.fury.io/py/tabulato.svg\"></a>\n <a href=\"https://github.com/crispengari/tabulato/actions/workflows/ci.yml\"><img src=\"https://github.com/crispengari/tabulato/actions/workflows/ci.yml/badge.svg\"></a>\n <a href=\"/LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-green\"></a>\n <a href=\"https://pypi.python.org/pypi/tabulato\"><img src=\"https://img.shields.io/pypi/pyversions/tabulato.svg\"></a>\n</p>\n\n### Table of Contents\n\n- [tabulato](#tabulato)\n- [Table of Contents](#table-of-contents)\n- [Key features of tabulato include:](#key-features-of-tabulato-include)\n- [Installation](#installation)\n- [Python Version](#python-version)\n- [Example](#example)\n- [What's missing on this package?](#whats-missing-on-this-package)\n- [License](#license)\n\n### Key features of tabulato include:\n\n- Generating tables with customizable colors for headers, even rows, and odd rows.\n- Specifying required columns to ensure important data is always displayed.\n- Option to make headers bold for emphasis.\n- User-friendly API for straightforward integration into your Python projects.\n\n> tabulato simplifies the task of formatting and presenting tabular data in terminal environments, making it an essential tool for developers and data scientists working with command-line interfaces.\n\n### Installation\n\nTo install tabulato, you can use pip:\n\n```bash\npip install tabulato\n```\n\n### Python Version\n\nThis package support python version `>=3.10`\n\n### Example\n\nIn the following examples shows you how you can use\n\n```py\nfrom tabulato import colorful_tabulate, TableRowStyle\n\nheaders = [\"Name\", \"Student Number\", \"DOB\", \"Email Address\"]\n\ndata = [\n [\"John Doe\", \"S12345\", \"1995-07-15\", \"john@example.com\"],\n [\"Alice Smith\", \"S67890\", \"1998-03-22\", \"alice@example.com\"],\n [\"Bob Johnson\", \"S54321\", \"1997-11-10\", \"bob@example.com\"],\n [\"Emma Brown\", \"S98765\", \"1996-09-18\", \"emma@example.com\"],\n [\"Michael Lee\", \"S24680\", \"1999-05-30\", \"michael@example.com\"],\n [\"Sophia Wang\", \"S13579\", \"1994-12-05\", \"sophia@example.com\"],\n [\"David Chen\", \"S75310\", \"1992-04-08\", \"david@example.com\"],\n [\"Olivia Kim\", \"S36924\", \"1993-10-25\", \"olivia@example.com\"],\n]\n\ncolorful_tabulate(\n data=data,\n column_widths=[20, 20, 20, 30],\n)\n```\n\nThe above function will result in the following table being created in the terminal.\n\n```shell\n+----------------------+----------------------+----------------------+--------------------------------+\n| name | student number | dob | email |\n+----------------------+----------------------+----------------------+--------------------------------+\n| John Doe | S12345 | 1995-07-15 | john@example.com |\n| Alice Smith | S67890 | 1998-03-22 | alice@example.com |\n| Bob Johnson | S54321 | 1997-11-10 | bob@example.com |\n| Emma Brown | S98765 | 1996-09-18 | emma@example.com |\n| Michael Lee | S24680 | 1999-05-30 | michael@example.com |\n| Sophia Wang | S13579 | 1994-12-05 | sophia@example.com |\n| David Chen | S75310 | 1992-04-08 | david@example.com |\n| Olivia Kim | S36924 | 1993-10-25 | olivia@example.com |\n+----------------------+----------------------+----------------------+--------------------------------+\n```\n\nThe colorful table will look as follows:\n\n<p align='center'><img src='https://github.com/CrispenGari/tabulato/blob/main/images/0.jpg?raw=true' alt='demo' width=\"400\"/></p>\n\nHowever you can style the rows of the table using the `TableRowStyle` class by specifying the options as follows:\n\n```py\ncolorful_tabulate(\n data=data,\n column_widths=[20, 20, 20, 30],\n header_style=TableRowStyle(\n bold=True,\n italic=False,\n color=\"BLUE\",\n background=\"BG_BLUE\",\n ),\n even_row_style=TableRowStyle(\n bold=False,\n italic=False,\n color=\"GREEN\",\n underline=True,\n ),\n odd_row_style=TableRowStyle(\n bold=False,\n italic=False,\n color=\"YELLOW\",\n strikethrough=True,\n ),\n)\n```\n\n<p align='center'><img src='https://github.com/CrispenGari/tabulato/blob/main/images/1.jpg?raw=true' alt='demo' width=\"400\"/></p>\n\nThe table data can also be a list of python dictionaries. Here is an example of using a list of python dictionaries to generate a table.\n\n```py\n\ndata = [\n {\n \"name\": \"John Doe\",\n \"student number\": \"S12345\",\n \"dob\": \"1995-07-15\",\n \"email\": \"john@example.com\",\n },\n {\n \"name\": \"Alice Smith\",\n \"student number\": \"S67890\",\n \"dob\": \"1998-03-22\",\n \"email\": \"alice@example.com\",\n },\n {\n \"name\": \"Bob Johnson\",\n \"student number\": \"S54321\",\n \"dob\": \"1997-11-10\",\n \"email\": \"bob@example.com\",\n },\n {\n \"name\": \"Emma Brown\",\n \"student number\": \"S98765\",\n \"dob\": \"1996-09-18\",\n \"email\": \"emma@example.com\",\n },\n {\n \"name\": \"Michael Lee\",\n \"student number\": \"S24680\",\n \"dob\": \"1999-05-30\",\n \"email\": \"michael@example.com\",\n },\n {\n \"name\": \"Sophia Wang\",\n \"student number\": \"S13579\",\n \"dob\": \"1994-12-05\",\n \"email\": \"sophia@example.com\",\n },\n {\n \"name\": \"David Chen\",\n \"student number\": \"S75310\",\n \"dob\": \"1992-04-08\",\n \"email\": \"david@example.com\",\n },\n {\n \"name\": \"Olivia Kim\",\n \"student number\": \"S36924\",\n \"dob\": \"1993-10-25\",\n \"email\": \"olivia@example.com\",\n },\n]\n\ncolorful_tabulate(\n data=data,\n column_widths=[20, 20, 20, 30],\n)\n```\n\nThe `colorful_tabulate` is a useful function for visually enhancing tabulated data in terminal output by applying colors and styling. The following are the parameters that this function takes.\n\n| Parameter | Description | Type | Default | Required |\n| ---------------- | -------------------------------------- | --------------- | -------------------------------------------------------------------------- | -------- |\n| `data` | The list of data to be displayed. | `list` | - | `Yes` |\n| `headers` | The list of column headers. | `list` | `None` | `No` |\n| `colorful` | Whether to display the table in color. | `bool` | `True` | `No` |\n| `bold_header` | Whether to display the header in bold. | `bool` | `True` | `No` |\n| `header_style` | Style for the header row. | `TableRowStyle` | `TableRowStyle(bold=True, italic=False, color=\"BLUE\", background=None)` | `No` |\n| `even_row_style` | Style for even-numbered rows. | `TableRowStyle` | `TableRowStyle(bold=False, italic=False, color=\"GREEN\", background=None)` | `No` |\n| `odd_row_style` | Style for odd-numbered rows. | `TableRowStyle` | `TableRowStyle(bold=False, italic=False, color=\"YELLOW\", background=None)` | `No` |\n| `column_widths` | List of column widths. | `list` | `[]` | `No` |\n\nThe following are the color literals that can be passed to the `color` abd `background` respectively.\n\n| Color | Description |\n| ---------- | ----------- |\n| `\"BLACK\"` | Black |\n| `\"RED\"` | Red |\n| `\"GREEN\"` | Green |\n| `\"YELLOW\"` | Yellow |\n| `\"BLUE\"` | Blue |\n| `\"PURPLE\"` | Purple |\n| `\"CYAN\"` | Cyan |\n| `\"WHITE\"` | White |\n\n| Background | Description |\n| ------------- | ----------------- |\n| `\"BG_BLACK\"` | Black background |\n| `\"BG_RED\"` | Red background |\n| `\"BG_GREEN\"` | Green background |\n| `\"BG_BLUE\"` | Blue background |\n| `\"BG_PURPLE\"` | Purple background |\n| `\"BG_CYAN\"` | Cyan background |\n| `\"BG_WHITE\"` | White background |\n| `\"BG_YELLOW\"` | Yellow background |\n\n### What's missing on this package?\n\nThis package lacks `wrapping` of text for long lines. This `version` only support small tables. Long column data might not end up displayed well, however with small column data like this package is the best.\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](/LISENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 crispengari Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "This is a Python package that provides functionality for generating tabulated representations of data with customizable colors and formatting options. It offers a user-friendly interface for creating visually appealing tables in terminal output.",
"version": "1.0.3",
"project_urls": {
"changelog": "https://github.com/CrispenGari/tabulato/blob/main/CHANGELOG.md",
"documentation": "https://github.com/CrispenGari/tabulato/blob/main/README.md",
"homepage": "https://github.com/CrispenGari/tabulato",
"issues": "https://github.com/CrispenGari/tabulato/issues",
"repository": "https://github.com/CrispenGari/tabulato"
},
"split_keywords": [
"tabulato",
"tables",
"pretty-table",
"console",
"styling",
"text-formatting",
"cli",
"ansi",
"print",
"text-decoration",
"csv",
"tabulate-data"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f2b8ece34f3c6fb8d94536c7432076cd9c3b8bcabfd1b3ad600616848cf655e4",
"md5": "dc7dc3e8037c2d4019322ccbf42f3305",
"sha256": "d41b98583ec531d4f575c708e83a72c09878329bad5636c5b652b503465e4ac9"
},
"downloads": -1,
"filename": "tabulato-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dc7dc3e8037c2d4019322ccbf42f3305",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 9232,
"upload_time": "2024-03-07T12:48:07",
"upload_time_iso_8601": "2024-03-07T12:48:07.622718Z",
"url": "https://files.pythonhosted.org/packages/f2/b8/ece34f3c6fb8d94536c7432076cd9c3b8bcabfd1b3ad600616848cf655e4/tabulato-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a500e67e347c3bdfc7684227c4947a64a084c96eb41004e3bf0133ccddf72601",
"md5": "6a228ec2d78c79b3d50ea16245df504b",
"sha256": "1ca5e459b2d61b2adb174f3c431463905fe6da5ca0606d4426a5759b1d568e9f"
},
"downloads": -1,
"filename": "tabulato-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "6a228ec2d78c79b3d50ea16245df504b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 275806,
"upload_time": "2024-03-07T12:48:10",
"upload_time_iso_8601": "2024-03-07T12:48:10.014555Z",
"url": "https://files.pythonhosted.org/packages/a5/00/e67e347c3bdfc7684227c4947a64a084c96eb41004e3bf0133ccddf72601/tabulato-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-07 12:48:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "CrispenGari",
"github_project": "tabulato",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "iniconfig",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"23.2"
]
]
},
{
"name": "pluggy",
"specs": [
[
"==",
"1.4.0"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"8.0.0"
]
]
}
],
"lcname": "tabulato"
}