Migrate from tabulate to texttable
texttable
- texttable
-
Remove
tabulate
from readme -
Remove no longer necessary
--install-types
option to installtypes-tabulate
subs module formypy
pre-commit hook
Better tool? (was easier to develop history
), available in most distributions: Debian, Fedora, Arch, FreeBSD…
Differences
-
tabulate
uses a list of lists -
texttable
uses also a list of lists
To be checked, were there an other difference?
- Show closed items
- #218Backlog
- #340Backlog
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Moul added ~319 enhancement labels
added ~319 enhancement labels
- Moul mentioned in issue #124 (closed)
mentioned in issue #124 (closed)
- Moul changed the description
changed the description
- Moul mentioned in issue #22 (closed)
mentioned in issue #22 (closed)
- Moul changed title from Migrate from tabulate to texttable to Choose between tabulate and texttable
changed title from Migrate from tabulate to texttable to Choose between tabulate and texttable
- Moul changed the description
changed the description
- Maintainer
Since I would like to begin working on #218 (Add
--full-pubkey
option), I would like to know if you chose. Tabulate is used in almost every command excepthistory
.If we have to choose, maybe we should set a list of criteria. I begin.
tl;dr : both are very similar. Good point for Tabulate is styles. Good point for texttable is max width of tables. I would search a workaround to use a max width with tabulate.
Criteria to be checked
Assign a maximum width for the table
-
texttable. It is used in
history
, it is great on small display. - tabulate can't. On small display, tables wrap strangely and are difficult to read. We could find a workaround, but it would be quite annoying.
multiline (#340) : what do we want ?
This (multi-line cells, both do):
+--------+--------+ |a line |a cell | |another | | +--------+--------+
or this (to my understanding, none can. To be checked.):
+--------+--------+ |a line | a cell | +--------+ | |another | | +--------+--------+
Format
- texttable deals with the type of data (str, int, float, exp, auto)
text float exp int auto ============================================== abcd 67.000 6.540e+02 89 128.001 efghijk 67.543 6.540e-01 90 1.280e+22 lmn 0.000 5.000e-78 89 0.000 opqrstu 0.023 5.000e+78 92 1.280e+22
- both can align float on the comma, which is nice to display monetary info. But they don't do it the same way.
tabulate :
>>> print(tabulate([[1.2345],[123.45],[12.345],[12345],[1234.5]])) ---------- 1.2345 123.45 12.345 12345 1234.5 ----------
Styles
- texttable has only one style, we can choose to use only/combine headers, columns, lines, borders (see
set_deco
) - tabulate has much more available styles.
note : some users include silkaj in scripts, and parse the output. Having custom characters like those used by tabulate styles is not very nice to them.
Availability in UNIX-like distributions
Available in most distribution not a problem:
Lightness
difference is negligible since both are small
- tabulate: 24 kB
- texttable: 10 kB
Speed
according to tabulates propaganda, tabulate is ~2x faster than texttable.
Personal conclusion
I would like to have all the nice styles of tabulate. However, the fact that it can't deal with a fixed with is really a bad point.
I would search a workaround for table width with tabulate, and if I don't find, we should go for texttable.
Edited by matograine 1 -
texttable. It is used in
- Moul changed the description
changed the description
- Moul marked this issue as related to #22 (closed)
marked this issue as related to #22 (closed)
- Maintainer
OR we can use Texttable.set_chars() to get similar table styles as tabulate's "fancy-grid" (not as nice, though) :
Transactions history from: AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK:CWj Current balance: 1344300.75 ĞTest, 46.73 UD ĞTest on the 2020-12-10 15:14:13 ┼───────────────┼──────────────┼──────────────┼──────────────┼──────────────┼ │ Date │ Issuers/Reci │ Amounts │ Amounts │ Comment │ │ │ pients │ ĞTest │ UDĞTest │ │ ┼───────────────┼──────────────┼──────────────┼──────────────┼──────────────┼ │ 2020-12-07 │ 6upqFiJ6…:7x │ 300 │ 0.010 │ DEMAIN DES │ │ 19:00:00 │ o │ │ │ L_AUBE │ ┼───────────────┼──────────────┼──────────────┼──────────────┼──────────────┼
Transactions history from: AhRMHUxMPXSeG7qXZrE6qCdjwK9p2bu5Eqei7xAWVEDK:CWj Current balance: 1344300.75 ĞTest, 46.73 UD ĞTest on the 2020-12-10 15:16:02 ┼───────────────┼──────────────┼──────────────┼──────────────┼──────────────┼ │ Date │ Issuers/Reci │ Amounts │ Amounts │ Comment │ │ │ pients │ ĞTest │ UDĞTest │ │ ┼═══════════════┼══════════════┼══════════════┼══════════════┼══════════════┼ │ 2020-12-07 │ 6upqFiJ6…:7x │ 300 │ 0.010 │ DEMAIN DES │ │ 19:00:00 │ o │ │ │ L_AUBE │ ┼───────────────┼──────────────┼──────────────┼──────────────┼──────────────┼
Edited by matograine