{"id":13494118,"url":"https://github.com/nschloe/termtables","last_synced_at":"2025-05-08T21:23:49.017Z","repository":{"id":50942440,"uuid":"195530851","full_name":"nschloe/termtables","owner":"nschloe","description":":desktop_computer: Pretty tables in the terminal","archived":false,"fork":false,"pushed_at":"2021-05-27T07:23:46.000Z","size":140,"stargazers_count":97,"open_issues_count":7,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-12T00:42:25.885Z","etag":null,"topics":["pypi","python","table","terminal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nschloe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-06T11:15:34.000Z","updated_at":"2024-03-20T15:54:14.000Z","dependencies_parsed_at":"2022-08-25T14:00:32.133Z","dependency_job_id":null,"html_url":"https://github.com/nschloe/termtables","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermtables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermtables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermtables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nschloe%2Ftermtables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nschloe","download_url":"https://codeload.github.com/nschloe/termtables/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238044093,"owners_count":19407128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pypi","python","table","terminal"],"created_at":"2024-07-31T19:01:22.055Z","updated_at":"2025-02-10T02:09:16.275Z","avatar_url":"https://github.com/nschloe.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/nschloe/termtables\"\u003e\u003cimg alt=\"termtables\" src=\"https://nschloe.github.io/termtables/termtables.svg\" width=\"60%\"\u003e\u003c/a\u003e\n  \u003cp align=\"center\"\u003eThe tables have termed.\u003c/p\u003e\n\u003c/p\u003e\n\n[![PyPi Version](https://img.shields.io/pypi/v/termtables.svg?style=flat-square)](https://pypi.org/project/termtables)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/termtables.svg?style=flat-square)](https://pypi.org/pypi/termtables/)\n[![GitHub stars](https://img.shields.io/github/stars/nschloe/termtables.svg?logo=github\u0026label=Stars\u0026logoColor=white\u0026style=flat-square)](https://github.com/nschloe/termtables)\n[![PyPi downloads](https://img.shields.io/pypi/dm/termtables.svg?style=flat-square)](https://pypistats.org/packages/termtables)\n\n[![gh-actions](https://img.shields.io/github/workflow/status/nschloe/termtables/ci?style=flat-square)](https://github.com/nschloe/termtables/actions?query=workflow%3Aci)\n[![codecov](https://img.shields.io/codecov/c/github/nschloe/termtables.svg?style=flat-square)](https://codecov.io/gh/nschloe/termtables)\n[![LGTM](https://img.shields.io/lgtm/grade/python/github/nschloe/termtables.svg?style=flat-square)](https://lgtm.com/projects/g/nschloe/termtables)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n\n\ntermtables is a lightweight Python 3 package for pretty-printing tables on the command\nline. Install with\n```\npip install termtables\n```\nThe code\n```python\nimport termtables as tt\nimport numpy\n\nnumpy.random.seed(0)\ndata = numpy.random.rand(5, 2)\n\ntt.print(data)\n# tt.to_string(data) returns the string\n```\nproduces\n\n![table1](https://nschloe.github.io/termtables/table1.png)\n\nYou can control border style, padding, alignment, and various other attributes. For\nexample,\n```python\nimport termtables as tt\n\nheader = [\"a\", \"bb\", \"ccc\"]\ndata = [\n    [1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]\n]\n\ntt.print(\n    data,\n    header=header,\n    style=tt.styles.markdown,\n    padding=(0, 1),\n    alignment=\"lcr\"\n)\n```\nproduces\n\u003c!--pytest-codeblocks:expected-output--\u003e\n```\n| a               |       bb        |             ccc |\n|-----------------|-----------------|-----------------|\n| 1               |        2        |               3 |\n| 613.23236243236 | 613.23236243236 | 613.23236243236 |\n```\nwhich is useful for copy-pasting into websites that support Markdown (like GitHub).\n\nSee\n[`test/test_termtables.py`](https://github.com/nschloe/termtables/blob/master/test/test_termtables.py)\nfor more examples.\n\nIf the styles in `termtables.styles`\n```\nthin\nthin_thick\nthin_double\nrounded\nrounded_thick\nrounded_double\nthick\nthick_thin\ndouble\ndouble_thin\nbooktabs\n\nascii_thin\nascii_thin_double\nascii_double\nascii_double_thin\nascii_booktabs\n\nmarkdown\n```\naren't good enough for you, simply provide your own\nstyle as a string of length  11 or 15 (the extra 4 including header-separating\ncharacters). For example\n```python\nimport termtables as tt\n\nheader = [\"a\", \"bb\", \"ccc\"]\ndata = [\n    [1, 2, 3], [613.23236243236, 613.23236243236, 613.23236243236]\n]\n\ntt.print(\n    data,\n    header=header,\n    style=\"x0123456789abcd\"\n)\n```\nproduces\n\u003c!--pytest-codeblocks:expected-output--\u003e\n```\n1xxxxxxxxxxxxxxxxx7xxxxxxxxxxxxxxxxx7xxxxxxxxxxxxxxxxx2\n0 a               0 bb              0 ccc             0\nabbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbcbbbbbbbbbbbbbbbbbd\n0 1               0 2               0 3               0\n5xxxxxxxxxxxxxxxxx9xxxxxxxxxxxxxxxxx9xxxxxxxxxxxxxxxxx6\n0 613.23236243236 0 613.23236243236 0 613.23236243236 0\n3xxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxx8xxxxxxxxxxxxxxxxx4\n```\n\n\n### Testing\n\nTo run the termtables unit tests, check out this repository and type\n```\ntox\n```\n\n### Other software for terminal tables\n\n * [Rich](https://github.com/willmcgugan/rich)\n\n### License\nThis software is published under the [GPL-3.0\nlicense](https://www.gnu.org/licenses/gpl-3.0.en.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Ftermtables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnschloe%2Ftermtables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnschloe%2Ftermtables/lists"}