Add support of JSONL and CSV input file formats in CLI tabulate utility by astanin · Pull Request #419 · astanin/python-tabulate · GitHub
Skip to content

Add support of JSONL and CSV input file formats in CLI tabulate utility#419

Merged
astanin merged 7 commits into
masterfrom
dev/jsonl
Mar 11, 2026
Merged

Add support of JSONL and CSV input file formats in CLI tabulate utility#419
astanin merged 7 commits into
masterfrom
dev/jsonl

Conversation

@astanin

@astanin astanin commented Mar 10, 2026

Copy link
Copy Markdown
Owner

fix #173

New CLI parameters:

--headers HEADERS
where HEADERS can be "firstrow", "keys", "HEADER1,HEADER2,..." (for CSV data), "HEADER1,KEY2:HEADER2,..." (for JSONL data)

--read FILEFORMAT
where FILEFORMAT can be "rsv" (default), "csv", "jsonl"

Deprecated CLI parameter:

  • --header

Usage examples:

cat ./examples/people.csv | tabulate -r csv --headers firstrow
  id  name    email              "favorite" fruit
----  ------  -----------------  ------------------
   1  Alice   alice@example.com  apple, kiwi
   2  Bob     bob@example.com    banana,
                                 orange,
                                 lychee
   3  Carol                      pear
cat ./examples/people.jsonl | tabulate -r jsonl -f grid --headers 'id:ID,name:First Name,email:Email'
+------+--------------+-------------------+
|   ID | First Name   | Email             |
+======+==============+===================+
|    1 | Alice        | alice@example.com |
+------+--------------+-------------------+
|    2 | Bob          | bob@example.com   |
+------+--------------+-------------------+

astanin added 5 commits March 9, 2026 17:09
fix #173

New CLI parameter:

--headers HEADERS
  where HEADERS can be "firstrow", "keys", "HEADER1,HEADER2,...", "KEY1:HEADER1,KEY2:HEADER2,..."

--read FILEFORMAT
  where FILEFORMAT can be "rsv" (default), "csv", "jsonl"

Deprecated CLI parameter:

--header

Usage examples:

cat ./examples/people.csv | tabulate -r csv --headers firstrow
  id  name    email              "favorite" fruit
----  ------  -----------------  ------------------
   1  Alice   alice@example.com  apple, kiwi
   2  Bob     bob@example.com    banana,
                                 orange,
                                 lychee
   3  Carol                      pear

cat ./examples/people.jsonl | tabulate -r jsonl -f grid --headers 'id:ID,name:First Name,email:Email'
+------+--------------+-------------------+
|   ID | First Name   | Email             |
+======+==============+===================+
|    1 | Alice        | alice@example.com |
+------+--------------+-------------------+
|    2 | Bob          | bob@example.com   |
+------+--------------+-------------------+
- old tests: launch tabulate via subprocess (still necessary)
- new tests: the same checks for coverage reports
@codecov-commenter

codecov-commenter commented Mar 10, 2026

Copy link
Copy Markdown

@astanin astanin added this to the v0.11.0 milestone Mar 10, 2026
@astanin astanin added CLI enhancement New feature or request labels Mar 10, 2026
@astanin astanin mentioned this pull request Mar 10, 2026
@astanin astanin merged commit 52dc17b into master Mar 11, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to tabulate JSON from stdin?

2 participants