rich-tables


Namerich-tables JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/snejus/rich-tables
SummaryReady-made rich tables for various purposes
upload_time2023-08-16 21:34:26
maintainer
docs_urlNone
authorŠarūnas Nejus
requires_python>=3.7,<4
licenseMIT
keywords json pretty rich console terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 analyze / 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)

### 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)

### 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": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4",
    "maintainer_email": "",
    "keywords": "json,pretty,rich,console,terminal",
    "author": "\u0160ar\u016bnas Nejus",
    "author_email": "snejus@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/b9/7f/45314f9ca7b9402ef061289d48150c5623063321a4fc2074710e320e6d35/rich_tables-0.3.0.tar.gz",
    "platform": null,
    "description": "# 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\nis constantly 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 analyze / make sense of it just by looking at it.\n\nThis project initially started as a way to solve this issue - it takes JSON data as an\ninput and prints it in _(rich-)tables_, making it somewhat more readable for humans. With time,\nit'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` - feel free test it but\ndo not 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, commits\nand pushes them upstream.\n\nIt got setup because this entire thing got built without intention - 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\n  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 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` fixture](https://github.com/snejus/rich-tables/blob/e25ac771a543b160c40dbed0764b579f0983a4c0/tests/test_outputs.py#L21-L33), after the `yield` statement\n\n## Examples\n### Album\n\n![image](svgs/album.svg)\n\n### Calendar\n\n![image](svgs/calendar.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### 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.3.0",
    "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": "6a185c5ff7931b3c2ad8c776ccd2c52d517bd038015d24b30456ad0198909c43",
                "md5": "3e23a5c151e4481f9dee2b79fb122c22",
                "sha256": "364bbb1e8da7166aac675dfaad082be4b902534de9e1a35b39a1a907e3c62998"
            },
            "downloads": -1,
            "filename": "rich_tables-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e23a5c151e4481f9dee2b79fb122c22",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4",
            "size": 22905,
            "upload_time": "2023-08-16T21:34:24",
            "upload_time_iso_8601": "2023-08-16T21:34:24.559144Z",
            "url": "https://files.pythonhosted.org/packages/6a/18/5c5ff7931b3c2ad8c776ccd2c52d517bd038015d24b30456ad0198909c43/rich_tables-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b97f45314f9ca7b9402ef061289d48150c5623063321a4fc2074710e320e6d35",
                "md5": "f770f3e1d740f0fe62b5213e0734915e",
                "sha256": "0dc5f08c82565fc3f59b29aac4fb49d727d2c062a90057f09d52ed23f3baafde"
            },
            "downloads": -1,
            "filename": "rich_tables-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f770f3e1d740f0fe62b5213e0734915e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4",
            "size": 21509,
            "upload_time": "2023-08-16T21:34:26",
            "upload_time_iso_8601": "2023-08-16T21:34:26.173620Z",
            "url": "https://files.pythonhosted.org/packages/b9/7f/45314f9ca7b9402ef061289d48150c5623063321a4fc2074710e320e6d35/rich_tables-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-16 21:34:26",
    "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: 0.10688s