rich-tables


Namerich-tables JSON
Version 0.6.1 PyPI version JSON
download
home_pagehttps://github.com/snejus/rich-tables
SummaryReady-made rich tables for various purposes
upload_time2024-08-26 14:19:36
maintainerNone
docs_urlNone
authorŠarūnas Nejus
requires_python<4,>=3.8
licenseMIT
keywords json pretty rich console terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Coverage Status](https://coveralls.io/repos/github/snejus/rich-tables/badge.svg?branch=main)](https://coveralls.io/github/snejus/rich-tables?branch=main)

# Rich tables

JSON human-prettifier based on the brilliant [rich](https://github.com/Textualize/rich)
python library.

Since my usual day involves building and interacting with various APIs, JSON data is
constantly flying around the terminal. Reading JSON data (even when it's prettified by,
say, `jq`) requires a fair bit of mental effort; and it's basically impossible to analyse
/ make sense of it just by looking at it.

This project initially started as a way to solve this issue – it takes JSON data as an
input and prints it in _(rich-)tables_, making it somewhat more readable for humans. With
time, it's become the main handler for most of structured data that gets displayed in my
terminal and is now one of my core every day tools.

## Releases

It's WIP but installable through pip: `pip install rich-tables` – feel free test it but do
not expect it to be stable yet.

If we have enough interest, I am more than happy to prepare a release with a somewhat
stable API.

## Some bits to be aware of

##### Most commits are made by a daily cron job

You will find commits named

    Automatic backup <date>

There is a daily cronjob which checks my local copy of the repository for changes,
commits, and pushes them upstream.

It got setup because this entire thing got built without intention – whenever I came
across data that was not handled by `rich-tables`, I opened the code, quickly added the
logic and continued on with the original work without committing. Eventually, I'd have to
deal with a huge diff with a lot of unrelated changes.

##### Tests simply attempt to render data in each test case without making any assertions

- At least at this point I only want to know whether every piece of data is rendered fine.

##### For each `tests/json/<name>.json` test case, the rendered output is saved to `svgs/<name>.svg` file

- Allows to see the visual difference a certain change makes
- Helps to detect unintended side effects: if we're expecting an update of `album.svg`
  **only** but see that `pr.svg` is also updated, we know something's not right
- In commit details, GitHub shows visual difference for `svg` file changes
  - This is very helpful when one is trying to track down the culprit behind some missing
    border

##### README is populated with pictures dynamically when tests pass

- Once tests finish successfully, a subsection is added for every picture in the `svgs/`
  folder (in the alphabetical order). `case.svg` would be found under the subsection
  `Case`.
- This logic lives in [a session-scoped `pytest`
  fixture](https://github.com/snejus/rich-tables/blob/e25ac771a543b160c40dbed0764b579f0983a4c0/tests/test_outputs.py#L21-L33),
  after the `yield` statement.

## Examples

### Album

![image](svgs/album.svg)

### Calendar

![image](svgs/calendar.svg)

### Diff

![image](svgs/diff.svg)

### Emails

![image](svgs/emails.svg)

### Hue

![image](svgs/hue.svg)

### Jira diff

![image](svgs/jira_diff.svg)

### Nested JSON

![image](svgs/nested_json.svg)

### Pr

![image](svgs/pr.svg)

### Simple JSON

![image](svgs/simple_json.svg)

### Sql

![image](svgs/sql.svg)

### Tasks

![image](svgs/tasks.svg)

### Timed

![image](svgs/timed.svg)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/snejus/rich-tables",
    "name": "rich-tables",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.8",
    "maintainer_email": null,
    "keywords": "json, pretty, rich, console, terminal",
    "author": "\u0160ar\u016bnas Nejus",
    "author_email": "snejus@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/43/f7/a6df8933c9d638c72f113d18a34247291474763226aa63359ff6d6f7e3f7/rich_tables-0.6.1.tar.gz",
    "platform": null,
    "description": "[![Coverage Status](https://coveralls.io/repos/github/snejus/rich-tables/badge.svg?branch=main)](https://coveralls.io/github/snejus/rich-tables?branch=main)\n\n# Rich tables\n\nJSON human-prettifier based on the brilliant [rich](https://github.com/Textualize/rich)\npython library.\n\nSince my usual day involves building and interacting with various APIs, JSON data is\nconstantly flying around the terminal. Reading JSON data (even when it's prettified by,\nsay, `jq`) requires a fair bit of mental effort; and it's basically impossible to analyse\n/ make sense of it just by looking at it.\n\nThis project initially started as a way to solve this issue \u2013 it takes JSON data as an\ninput and prints it in _(rich-)tables_, making it somewhat more readable for humans. With\ntime, it's become the main handler for most of structured data that gets displayed in my\nterminal and is now one of my core every day tools.\n\n## Releases\n\nIt's WIP but installable through pip: `pip install rich-tables` \u2013 feel free test it but do\nnot expect it to be stable yet.\n\nIf we have enough interest, I am more than happy to prepare a release with a somewhat\nstable API.\n\n## Some bits to be aware of\n\n##### Most commits are made by a daily cron job\n\nYou will find commits named\n\n    Automatic backup <date>\n\nThere is a daily cronjob which checks my local copy of the repository for changes,\ncommits, and pushes them upstream.\n\nIt got setup because this entire thing got built without intention \u2013 whenever I came\nacross data that was not handled by `rich-tables`, I opened the code, quickly added the\nlogic and continued on with the original work without committing. Eventually, I'd have to\ndeal with a huge diff with a lot of unrelated changes.\n\n##### Tests simply attempt to render data in each test case without making any assertions\n\n- At least at this point I only want to know whether every piece of data is rendered fine.\n\n##### For each `tests/json/<name>.json` test case, the rendered output is saved to `svgs/<name>.svg` file\n\n- Allows to see the visual difference a certain change makes\n- Helps to detect unintended side effects: if we're expecting an update of `album.svg`\n  **only** but see that `pr.svg` is also updated, we know something's not right\n- In commit details, GitHub shows visual difference for `svg` file changes\n  - This is very helpful when one is trying to track down the culprit behind some missing\n    border\n\n##### README is populated with pictures dynamically when tests pass\n\n- Once tests finish successfully, a subsection is added for every picture in the `svgs/`\n  folder (in the alphabetical order). `case.svg` would be found under the subsection\n  `Case`.\n- This logic lives in [a session-scoped `pytest`\n  fixture](https://github.com/snejus/rich-tables/blob/e25ac771a543b160c40dbed0764b579f0983a4c0/tests/test_outputs.py#L21-L33),\n  after the `yield` statement.\n\n## Examples\n\n### Album\n\n![image](svgs/album.svg)\n\n### Calendar\n\n![image](svgs/calendar.svg)\n\n### Diff\n\n![image](svgs/diff.svg)\n\n### Emails\n\n![image](svgs/emails.svg)\n\n### Hue\n\n![image](svgs/hue.svg)\n\n### Jira diff\n\n![image](svgs/jira_diff.svg)\n\n### Nested JSON\n\n![image](svgs/nested_json.svg)\n\n### Pr\n\n![image](svgs/pr.svg)\n\n### Simple JSON\n\n![image](svgs/simple_json.svg)\n\n### Sql\n\n![image](svgs/sql.svg)\n\n### Tasks\n\n![image](svgs/tasks.svg)\n\n### Timed\n\n![image](svgs/timed.svg)",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Ready-made rich tables for various purposes",
    "version": "0.6.1",
    "project_urls": {
        "Homepage": "https://github.com/snejus/rich-tables",
        "Repository": "https://github.com/snejus/rich-tables"
    },
    "split_keywords": [
        "json",
        " pretty",
        " rich",
        " console",
        " terminal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ffb6d3351a504ee662910884353902d3029eb2b3e4a0cb1f3f218b872c180371",
                "md5": "4dc7bc8f7f91a43f94114e4c26703332",
                "sha256": "9d7ee5ea2300d1669d066d0ef2d0694e669b90f50c5a8573edba05e086f007d3"
            },
            "downloads": -1,
            "filename": "rich_tables-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4dc7bc8f7f91a43f94114e4c26703332",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.8",
            "size": 26034,
            "upload_time": "2024-08-26T14:19:35",
            "upload_time_iso_8601": "2024-08-26T14:19:35.237650Z",
            "url": "https://files.pythonhosted.org/packages/ff/b6/d3351a504ee662910884353902d3029eb2b3e4a0cb1f3f218b872c180371/rich_tables-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43f7a6df8933c9d638c72f113d18a34247291474763226aa63359ff6d6f7e3f7",
                "md5": "ab53b3f7414b29273b468ebda6479052",
                "sha256": "57a1a5bbd2051b2ab2b3c30170f095846119e52df80ddf276647e656de3ac632"
            },
            "downloads": -1,
            "filename": "rich_tables-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ab53b3f7414b29273b468ebda6479052",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.8",
            "size": 23435,
            "upload_time": "2024-08-26T14:19:36",
            "upload_time_iso_8601": "2024-08-26T14:19:36.671366Z",
            "url": "https://files.pythonhosted.org/packages/43/f7/a6df8933c9d638c72f113d18a34247291474763226aa63359ff6d6f7e3f7/rich_tables-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-26 14:19:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "snejus",
    "github_project": "rich-tables",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "rich-tables"
}
        
Elapsed time: 1.03748s