Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
0978de5
Fix separating line with dataclasses
baolsen May 23, 2023
392be0f
Fix separating line detection with ndarray values
alugowski Aug 28, 2023
2d3c3df
Merge branch 'master' into patch-1
astanin Sep 26, 2024
600bced
Merge branch 'master' into patch-1
astanin Sep 27, 2024
d29909b
Fix handling "True"/"False" bool str and None
Hnasar Mar 17, 2025
9dedd45
Add missed multiline support for github
May 6, 2025
3c9d404
fix(docs): Correct typo in ANSI support section
snowykr May 25, 2025
97b6c37
Merge pull request #268 from baolsen/2023-05-23-dataclass-sep-line
astanin Jul 23, 2025
b950d58
Merge pull request #288 from alugowski/patch-1
astanin Jul 23, 2025
b23f8f9
Merge pull request #368 from snowykr/fix/readme-typo
astanin Jul 23, 2025
3cfb20c
Merge pull request #366 from CodeGenerator/feature/fix_github_format
astanin Jul 23, 2025
4042e61
Merge pull request #362 from Hnasar/fix-crash
astanin Jul 23, 2025
bf3c2ef
Merge branch 'master' into master
astanin Jul 23, 2025
51f15fa
Merge pull request #218 from adan79/master
astanin Jul 23, 2025
7a19c30
PEP 639 compliance
DimitriPapadopoulos Jul 23, 2025
34bd63a
Fix typo found by codespell
DimitriPapadopoulos Jul 23, 2025
3b82a4e
Merge pull request #370 from DimitriPapadopoulos/PEP639
astanin Jul 23, 2025
74885be
Merge pull request #371 from DimitriPapadopoulos/codespell
astanin Jul 23, 2025
f967017
Robust test for callable objects
DimitriPapadopoulos Sep 13, 2025
3fdc130
Fix asciidoc alignment
J08nY Oct 19, 2023
7a2e5f3
Fix asciidoc tests and docs accordingly
DimitriPapadopoulos Sep 13, 2025
bb1bf9f
Fix crash when cell is empty
gschizas Nov 5, 2025
c59a5ff
Handle ValueError in _format when float conversion fails
bysiber Feb 21, 2026
815bfa5
Merge branch 'master' into master
astanin Mar 4, 2026
4d3809e
Merge pull request #313 from gschizas/master
astanin Mar 4, 2026
886e2ed
fix conflicting wrapping behavior for missing (None) values
astanin Mar 4, 2026
5a579fc
fix "DeprecationWarning: Data type alias 'a' was deprecated in NumPy …
astanin Mar 4, 2026
f0a5df6
apply pre_commit hooks (black)
astanin Mar 4, 2026
38b7333
uncomment [tool.setuptools_scm] to detect package version
astanin Mar 4, 2026
d42acbe
fix test_internal being stuck on test_wrap_text_wide_chars (fix _hand…
astanin Mar 4, 2026
95c815d
re-enable test_alignment_of_decimal_numbers_with_commas
astanin Mar 4, 2026
a3223ed
run pre_commit hooks (black)
astanin Mar 4, 2026
e0a4311
add py314-extra (full Python 3.14 tests) to tox.ini
astanin Mar 4, 2026
27727c2
fix warnings in test_sqlite3 and test_sqlite3_keys
astanin Mar 4, 2026
e13a4d0
update _CustomTextWrap to make it compatible with Python 3.14
astanin Mar 4, 2026
87a9a4e
fix #365 - added a regression test and a fix based on pull request #393
astanin Mar 4, 2026
4582b63
drop Python 3.9 support, add Python 3.14 support
astanin Mar 4, 2026
9d930e8
add Python 3.14 to github workflow, upgrade lint workflow to Python 3.13
astanin Mar 4, 2026
1d11331
Merge pull request #394 from bysiber/fix-maxcolwidths-bool-crash
astanin Mar 4, 2026
197a803
add regression test for issue #209 - test_mixed_bool_strings_and_nume…
astanin Mar 4, 2026
4fa8639
Improve string concatenation
DimitriPapadopoulos Sep 13, 2025
8ca340f
Fix typo in docs
DimitriPapadopoulos Sep 13, 2025
058f022
Merge branch 'master' into fix/asciidoc-align
astanin Mar 4, 2026
d54e6eb
Merge pull request #386 from DimitriPapadopoulos/fix/asciidoc-align
astanin Mar 4, 2026
a384471
Merge pull request #382 from DimitriPapadopoulos/__call__
astanin Mar 4, 2026
5c10c81
update pre-commit hooks as suggested by pull request #373
astanin Mar 4, 2026
b96c59a
run pre-commit hooks (black)
astanin Mar 4, 2026
69f67cd
Do not call `getattr` with a constant value
DimitriPapadopoulos Sep 13, 2025
13508e7
Unnecessary `list` call
DimitriPapadopoulos Sep 13, 2025
76c3d37
Remove spurious space from error message
DimitriPapadopoulos Sep 13, 2025
4d535af
Use specific noqa directives
DimitriPapadopoulos Sep 13, 2025
1b69704
Remove spurious cast in string interpolation
DimitriPapadopoulos Sep 13, 2025
7bacc90
run pre-commit hooks (black)
astanin Mar 4, 2026
37e1ed0
move # nowa: E931 to a different line (flake8)
astanin Mar 4, 2026
37ac76e
restore tabulate.__version__
astanin Mar 4, 2026
35ee0f6
update mini-benchmark table
astanin Mar 4, 2026
3b4cd50
update HOWTOPUBLISH
astanin Mar 4, 2026
36c8b07
add ruff, build, twine, tox as dev dependencies
astanin Mar 4, 2026
75640e2
use ruff instead of black and flake8
astanin Mar 4, 2026
4a95974
check and format everything with ruff
astanin Mar 4, 2026
0e58106
add tox-uv plugin as a dev dependency
astanin Mar 4, 2026
f4f0688
upgrade github actions' versions
astanin Mar 4, 2026
6a1ee34
update the list of contributors
astanin Mar 4, 2026
106b77e
update CHANGELOG
astanin Mar 4, 2026
5768953
[breaking] remove support of the legacy `youtrack` format
astanin Mar 4, 2026
1818a3b
require wcwidth>=0.6.0 (optional dependency for widechars)
astanin Mar 4, 2026
032dc0d
fix #399 - avoid infinite loop in _CustomTextWrap on wide characters …
astanin Mar 4, 2026
8978756
add test_grapheme_clusters.py from pull request #391
astanin Mar 4, 2026
4c9a049
add fallback for measuring visible width with wcwidth < 0.3
jquast Mar 5, 2026
553ecc0
Prefer f-strings
DimitriPapadopoulos Mar 4, 2026
0e842e1
A few ruff / pre-commit details
DimitriPapadopoulos Mar 4, 2026
3381cfc
Apply ruff rule RUF100
DimitriPapadopoulos Mar 4, 2026
8f32086
Apply ruff/Pylint rule PLW0108
DimitriPapadopoulos Mar 4, 2026
5373ebf
fix #176 - implement Decimal fixed-point support
mvadari Mar 5, 2026
877c020
update contributors list and CHANGELOG - add Decimal format support
astanin Mar 5, 2026
c576b07
add test case from pull request #387 - test_wrap_color_line_longword_…
astanin Mar 5, 2026
b577975
minor change to fix issue preventing passing in an interable for show…
Aug 20, 2024
0672716
add test case and update contributors for pull request #337
astanin Mar 5, 2026
ab790a6
Fix colalign in HTML when default is right.
J08nY Oct 19, 2023
ebd50a7
update html and moinmoin output tests - add explicit text-align: left…
astanin Mar 5, 2026
caec0c3
ruff format
astanin Mar 5, 2026
1c7bbd8
update Contributors
astanin Mar 5, 2026
b7dced4
remove py38 and py39 from the env_list in tox.ini
astanin Mar 5, 2026
71282a6
add wcwidth>=0.6.0 as a dependency of the github workflows
astanin Mar 5, 2026
9794747
add codecov to github actions
astanin Mar 5, 2026
28ca4d4
add pytest-cov to the list of github actions' dependencies
astanin Mar 5, 2026
c26c2ef
add code coverage badge to README.md
astanin Mar 5, 2026
40d9cb5
remove `youtrack` examples from the documentation
astanin Mar 5, 2026
9019f2f
add style="text-align: left;" to the examples of the `html` format ou…
astanin Mar 5, 2026
0c7d501
fix examples in README.md to pass doctests
astanin Mar 5, 2026
26ccb78
add README doctests to tox tests and github actions
astanin Mar 5, 2026
d4c0ef0
Enforce ruff/isort rules (I)
DimitriPapadopoulos Mar 5, 2026
f1a64ec
Apply ruff/isort rule I001
DimitriPapadopoulos Mar 5, 2026
47e97ae
Proper initialization for `__version__`
DimitriPapadopoulos Mar 5, 2026
f19e02b
Apply ruff preview rule RUF010
DimitriPapadopoulos Mar 5, 2026
0dc72a9
Apply ruff/Pylint preview rule PLR0402
DimitriPapadopoulos Mar 5, 2026
3fcf88e
Use `is` to compare types
DimitriPapadopoulos Mar 5, 2026
ffac028
Apply ruff/flake8-implicit-str-concat rule ISC003
DimitriPapadopoulos Mar 5, 2026
ce67587
Enforce ruff/flake8-implicit-str-concat rules (ISC)
DimitriPapadopoulos Mar 5, 2026
6050bef
setuptools → flit
DimitriPapadopoulos Mar 5, 2026
2939dc1
add pre_commit to dev dependencies
astanin Mar 5, 2026
3aa568c
fix #408 - remove trailing whitespace from asciidoc output
astanin Mar 5, 2026
7c70bf4
update CHANGELOG
astanin Mar 5, 2026
8014ec6
Fix alignments in `github` tables
kdeldycke Mar 5, 2026
ce67960
Apply ruff/flake8-comprehensions C416
DimitriPapadopoulos Mar 5, 2026
e9a56a6
Apply ruff/flake8-comprehensions rule C417
DimitriPapadopoulos Mar 5, 2026
57e39b1
Apply ruff/flake8-comprehensions rule C419
DimitriPapadopoulos Mar 5, 2026
26269e6
Apply ruff/flake8-comprehensions rule C420
DimitriPapadopoulos Mar 5, 2026
527d31e
Enforce ruff/flake8-comprehensions rules (C4)
DimitriPapadopoulos Mar 5, 2026
86112e6
add [too.pytest.ini_options] to pyproject.toml
astanin Mar 5, 2026
a783de2
add regression test for unescaped pipe character in github output (is…
astanin Mar 5, 2026
8abc5c9
ignore _version.py
astanin Mar 5, 2026
46c9fe3
replace DataRow namedtuple with a dataclass with the same name and an…
astanin Mar 5, 2026
e6a24aa
fix #241 - escape pipe character in github and pipe formats
astanin Mar 5, 2026
4552d6e
A few fixes for flit builds
DimitriPapadopoulos Mar 5, 2026
315f6c1
One last fix for flit builds
DimitriPapadopoulos Mar 5, 2026
7e3925e
Stop testing unsupported Python 3.8 and 3.9
DimitriPapadopoulos Mar 5, 2026
382a933
Simplify version and imports
DimitriPapadopoulos Mar 5, 2026
200b784
Use enumerate
DimitriPapadopoulos Mar 5, 2026
94b7491
Stop testing unsupported Python 3.8 and 3.9 (again)
DimitriPapadopoulos Mar 6, 2026
164b367
fix GH103 and GH103 of sp-repo-review recommendations
astanin Mar 9, 2026
c327d6c
implement support of JSONL and CSV input formats in command line utility
astanin Mar 9, 2026
696c5eb
update README.md and CHANGELOG with new CLI usage (JSONL format, --he…
astanin Mar 9, 2026
b47acc1
move implementation of the CLI utility to tabulate/cli.py
astanin Mar 9, 2026
791c4bf
add tests for the new CLI utility options
astanin Mar 9, 2026
17bf1cf
run all CLI tests also in-process for coverage report
astanin Mar 10, 2026
cf15727
ruff format & ruff check
astanin Mar 10, 2026
2f7f69d
Apply ruff/pyupgrade rule UP007
DimitriPapadopoulos Mar 5, 2026
63c74ac
Apply ruff/pyupgrade rule UP018
DimitriPapadopoulos Mar 5, 2026
4c39df9
Apply ruff/pyupgrade rule UP031
DimitriPapadopoulos Mar 5, 2026
5f87774
Apply ruff/pyupgrade rule UP035
DimitriPapadopoulos Mar 5, 2026
2070736
Enforce ruff/pyupgrade rules (UP)
DimitriPapadopoulos Mar 5, 2026
5313627
Merge branch 'master' into dev/jsonl
astanin Mar 10, 2026
3681fa5
Enforce ruff/flake8-bugbear rules (B)
DimitriPapadopoulos Mar 10, 2026
52dc17b
Merge pull request #419 from dev/jsonl
astanin Mar 11, 2026
268615a
Merge pull request #422 from DimitriPapadopoulos/B
astanin Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
python-version: ['3.13']

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/tabulate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,35 @@ name: pytest
on:
- push
- pull_request
- workflow_dispatch

jobs:
build:
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest numpy pandas
python -m pip install pytest pytest-cov numpy pandas "wcwidth>=0.6.0"
- name: Run tests
run: |
pytest -v --doctest-modules --ignore benchmark/benchmark.py
pytest -v --doctest-modules --ignore benchmark --doctest-glob="README.md" --cov=tabulate --cov-branch --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/tabulate/version.py
/tabulate/_version.py

build
dist
Expand All @@ -19,3 +19,4 @@ website-build/
## Unit test / coverage reports
.coverage
.tox
/tabulate/_version.py
16 changes: 7 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
repos:
- repo: https://github.com/python/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.4
hooks:
- id: black
args: [--safe]
language_version: python3
- id: ruff-check
args: ["--fix", "--show-fixes"]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v6.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: debug-statements
- id: flake8
language_version: python3
11 changes: 9 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
- 0.10.0: Add support for Python 3.11, 3.12, 3.13.
Drop support for Python 3.7, 3.8.
- 0.11.0:
Drop support of the legacy `youtrack` format.
Add support of the `Decimal` data type.
Improve output of `github` and `asciidoc` formats.
Add support of CSV and JSONL input data in CLI utility.
Always add `text-align: left` in HTML output.
Various bug fixes.
- 0.10.0: Add support for Python 3.11, 3.12, 3.13, 3.14.
Drop support for Python 3.7, 3.8, 3.9.
PRESERVE_STERILITY global is replaced with preserve_sterility function argument.
New formatting options: headersglobalalign, headersalign, colglobalalign.
New output format: ``colon_grid`` (Pandoc grid_tables with alignment)
Expand Down
10 changes: 6 additions & 4 deletions HOWTOPUBLISH
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# update contributors and CHANGELOG in README
python -m pre_commit run -a # and then commit changes
tox -e py39-extra,py310-extra,py311-extra,py312-extra,py313-extra
# tag version release
python -m build -s # this will update tabulate/version.py
tox -e py310-extra,py311-extra,py312-extra,py313-extra,py314-extra
# tag version release (vX.Y.Z)
python -m pip install build twine
python -m build -s # this will update tabulate/_version.py
python -m pip install . # install tabulate in the current venv
python -m pip install -r benchmark/requirements.txt
python benchmark/benchmark.py # then update README
# move tag to the last commit
python -m build -s # update tabulate/version.py
python -m build -s # update tabulate/_version.py
python -m build -nswx .
git push # wait for all CI builds to succeed
git push --tags # if CI builds succeed
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
twine upload dist/*
# use __token__ as username andPyPI API token as password (generate at pypi.org → Account settings → API tokens)
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

1 change: 0 additions & 1 deletion README

This file was deleted.

154 changes: 98 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pip install tabulate
Build status
------------

[![python-tabulate](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml/badge.svg)](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml)
[![python-tabulate](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml/badge.svg)](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml) [![codecov](https://codecov.io/github/astanin/python-tabulate/graph/badge.svg?token=Aa6wexP5wq)](https://codecov.io/github/astanin/python-tabulate)

Library usage
-------------
Expand Down Expand Up @@ -196,7 +196,6 @@ Supported table formats are:
- "rst"
- "mediawiki"
- "moinmoin"
- "youtrack"
- "html"
- "unsafehtml"
- "latex"
Expand Down Expand Up @@ -234,12 +233,12 @@ bacon 0
```

`github` follows the conventions of GitHub flavored Markdown. It
corresponds to the `pipe` format without alignment colons:
corresponds to the `pipe` format with the same alignment colons:

```pycon
>>> print(tabulate(table, headers, tablefmt="github"))
| item | qty |
|--------|-------|
|:-------|------:|
| spam | 42 |
| eggs | 451 |
| bacon | 0 |
Expand Down Expand Up @@ -501,12 +500,12 @@ format:

```pycon
>>> print(tabulate(table, headers, tablefmt="asciidoc"))
[cols="8<,7>",options="header"]
[cols="<8,>7",options="header"]
|====
| item | qty
| spam | 42
| eggs | 451
| bacon | 0
| item | qty
| spam | 42
| eggs | 451
| bacon | 0
|====

```
Expand Down Expand Up @@ -577,21 +576,10 @@ MediaWiki-based sites:

```pycon
>>> print(tabulate(table, headers, tablefmt="moinmoin"))
|| ''' item ''' ||<style="text-align: right;"> ''' qty ''' ||
|| spam ||<style="text-align: right;"> 42 ||
|| eggs ||<style="text-align: right;"> 451 ||
|| bacon ||<style="text-align: right;"> 0 ||

```

`youtrack` format produces a table markup used in Youtrack tickets:

```pycon
>>> print(tabulate(table, headers, tablefmt="youtrack"))
|| item || qty ||
| spam | 42 |
| eggs | 451 |
| bacon | 0 |
||<style="text-align: left;"> ''' item ''' ||<style="text-align: right;"> ''' qty ''' ||
||<style="text-align: left;"> spam ||<style="text-align: right;"> 42 ||
||<style="text-align: left;"> eggs ||<style="text-align: right;"> 451 ||
||<style="text-align: left;"> bacon ||<style="text-align: right;"> 0 ||

```

Expand All @@ -616,12 +604,12 @@ and a .str property so that the raw HTML remains accessible.
>>> print(tabulate(table, headers, tablefmt="html"))
<table>
<thead>
<tr><th>item </th><th style="text-align: right;"> qty</th></tr>
<tr><th style="text-align: left;">item </th><th style="text-align: right;"> qty</th></tr>
</thead>
<tbody>
<tr><td>spam </td><td style="text-align: right;"> 42</td></tr>
<tr><td>eggs </td><td style="text-align: right;"> 451</td></tr>
<tr><td>bacon </td><td style="text-align: right;"> 0</td></tr>
<tr><td style="text-align: left;">spam </td><td style="text-align: right;"> 42</td></tr>
<tr><td style="text-align: left;">eggs </td><td style="text-align: right;"> 451</td></tr>
<tr><td style="text-align: left;">bacon </td><td style="text-align: right;"> 0</td></tr>
</tbody>
</table>

Expand Down Expand Up @@ -819,7 +807,7 @@ methods `__str__` and `__float__` defined (and hence is convertible to a
`float` and also has a `str` representation), the appropriate
representation is selected for the column's deduced type. In order to not
lose precision accidentally, types having both an `__int__` and
`__float__` represention will be considered a `float`.
`__float__` representation will be considered a `float`.

Therefore, if your table contains types convertible to int/float but you'd
*prefer* they be represented as strings, or your strings *might* all look
Expand Down Expand Up @@ -1063,6 +1051,36 @@ the lines being wrapped would probably be significantly longer than this.

```

Text is preferably wrapped on whitespaces and right after the hyphens in hyphenated words.

break_long_words (default: True) If true, then words longer than width will be broken in order to ensure that no lines are longer than width.
If it is false, long words will not be broken, and some lines may be longer than width.
(Long words will be put on a line by themselves, in order to minimize the amount by which width is exceeded.)

break_on_hyphens (default: True) If true, wrapping will occur preferably on whitespaces and right after hyphens in compound words, as it is customary in English.
If false, only whitespaces will be considered as potentially good places for line breaks.

```pycon
>>> print(tabulate([["John Smith", "Middle-Manager"]], headers=["Name", "Title"], tablefmt="grid", maxcolwidths=[None, 5], break_long_words=False))
+------------+---------+
| Name | Title |
+============+=========+
| John Smith | Middle- |
| | Manager |
+------------+---------+

```

```pycon
>>> print(tabulate([["John Smith", "Middle-Manager"]], headers=["Name", "Title"], tablefmt="grid", maxcolwidths=[None, 5], break_long_words=False, break_on_hyphens=False))
+------------+----------------+
| Name | Title |
+============+================+
| John Smith | Middle-Manager |
+------------+----------------+

```

### Adding Separating lines
One might want to add one or more separating lines to highlight different sections in a table.

Expand Down Expand Up @@ -1098,7 +1116,7 @@ table, however, ANSI escape sequences are not removed so the original styling is

Some terminals support a special grouping of ANSI escape sequences that are intended to display hyperlinks
much in the same way they are shown in browsers. These are handled just as mentioned before: non-printable
ANSI escape sequences are removed prior to string length calculation. The only diifference with escaped
ANSI escape sequences are removed prior to string length calculation. The only difference with escaped
hyperlinks is that column width will be based on the length of the URL _text_ rather than the URL
itself (terminals would show this text). For example:

Expand All @@ -1109,24 +1127,46 @@ itself (terminals would show this text). For example:
Usage of the command line utility
---------------------------------

Usage: tabulate [options] [FILE ...]

FILE a filename of the file with tabular data;
if "-" or missing, read data from stdin.

Options:

-h, --help show this message
-1, --header use the first row of data as a table header
-o FILE, --output FILE print table to FILE (default: stdout)
-s REGEXP, --sep REGEXP use a custom column separator (default: whitespace)
-F FPFMT, --float FPFMT floating point number format (default: g)
-I INTFMT, --int INTFMT integer point number format (default: "")
-f FMT, --format FMT set output table format; supported formats:
plain, simple, github, grid, fancy_grid, pipe,
orgtbl, rst, mediawiki, html, latex, latex_raw,
latex_booktabs, latex_longtable, tsv
(default: simple)
```
Usage: tabulate [options] [FILE ...]

Pretty-print tabular data. Use Python module for more features.

FILE a filename of the file with tabular data;
if "-" or missing, read data from stdin.

Options:

-h, --help show this message

INPUT:
-r, --read FILEFORMAT parse input FILEs as:
rsv (REGEXP-separated values, default),
csv (comma-separated valued, Excel dialect),
jsonl (one JSON object per line)
-s REGEXP, --sep REGEXP column separator for rsv data (default: whitespace)

FORMAT:
--headers HEADERS HEADERS can be one of:
"firstrow" (for csv and rsv data),
"keys" (for jsonl data),
"HEADER1,HEADER2,..." (for csv and rsv data),
"KEY1:HEADER1,KEY2:HEADER2,..." (for jsonl data)
-1 use the first row of input data as a table header
(the same as --headers firstrow)
-F FPFMT, --float FPFMT floating point number format (default: g)
-I INTFMT, --int INTFMT integer point number format (default: "")
-f FMT, --format FMT set output table format (default: simple)

Supported output formats: asciidoc, colon_grid, double_grid, double_outline,
fancy_grid, fancy_outline, github, grid, heavy_grid, heavy_outline, html, jira,
latex, latex_booktabs, latex_longtable, latex_raw, mediawiki, mixed_grid, mixed_outline,
moinmoin, orgtbl, outline, pipe, plain, presto, pretty, psql, rounded_grid,
rounded_outline, rst, simple, simple_grid, simple_outline, textile, tsv, unsafehtml.

OUTPUT:
-o FILE, --output FILE print table to FILE (default: stdout)
```

Performance considerations
--------------------------
Expand All @@ -1147,17 +1187,17 @@ simply joining lists of values with a tab, comma, or other separator.
At the same time, `tabulate` is comparable to other table
pretty-printers. Given a 10x10 table (a list of lists) of mixed text and
numeric data, `tabulate` appears to be faster than `PrettyTable` and `texttable`.
The following mini-benchmark was run in Python 3.11.9 on Windows 11 (x64):
The following mini-benchmark was run in Python 3.13.7 on Windows 11 (x64):

================================== ========== ===========
Table formatter time, μs rel. time
================================== ========== ===========
join with tabs and newlines 6.3 1.0
csv to StringIO 6.6 1.0
tabulate (0.10.0) 249.2 39.3
tabulate (0.10.0, WIDE_CHARS_MODE) 325.6 51.4
texttable (1.7.0) 579.3 91.5
PrettyTable (3.11.0) 605.5 95.6
csv to StringIO 11.9 1.0
join with tabs and newlines 12.1 1.0
PrettyTable (3.17.0) 468.0 39.3
tabulate (0.10.0) 553.4 46.5
tabulate (0.10.0, WIDE_CHARS_MODE) 612.2 51.4
texttable (1.7.0) 1071.4 90.0
================================== ========== ===========


Expand Down Expand Up @@ -1254,4 +1294,6 @@ Vijaya Krishna Kasula, Furcy Pin, Christian Fibich, Shaun Duncan,
Dimitri Papadopoulos, Élie Goudout, Racerroar888, Phill Zarfos,
Keyacom, Andrew Coffey, Arpit Jain, Israel Roldan, ilya112358,
Dan Nicholson, Frederik Scheerer, cdar07 (cdar), Racerroar888,
Perry Kundert.
Perry Kundert, Hnasar, Jun Koo, Jo2234, Bjorn Olsen, George Schizas,
Kadir Can Ozden, Jeff Quast, Mayukha Vadari, Rebecca Jean Herman,
Ján Jančár (J08nY).
Loading