nicely


Namenicely JSON
Version 0.2439.0 PyPI version JSON
download
home_pageNone
SummaryPython Fancy Printer
upload_time2024-09-20 13:10:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords util
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nicely

Python Fancy Printer


## Abstract

The **nicely** package is yet another 'pretty printer'.

It is meant to:

* have a **readable and consistent** output.
    - Nested levels are indented. (the indentation string is configurable (4 spaces by default))
    - The sequences and the mapping keys are sorted. (can be disabled)
    - Mapping keys are padded. (so the values are aligned)
    - The data types may be shown. (disabled by default)

* be **simple** to use.
    - Only one class is required.
    - Convinience functions are also provided.

* be **extensible**
    - If the provided support for standard types doesn't suit your need, it's easy to modify it.
    - Any object can easaly be supported.

* be able to handle **large data structure**.
    - Sequences, mappings, strings and multi-lines can be truncated as needed.
    - Mapping items can be omitted based on regex.


## Usage

There are several ways to use nicel.

### The Printer class:

    from nicely import Printer

    p = Printer()
    p.print(some_data_structure)

The **Printer.print** method sends a formatted representation of its argument to a file-like destination (stdout by default).

### The dump function:

    from nicely import dump

    dump(some_data_structure)

The **dump** function uses the **Printer** class to 'dump' its argument on stdout as well as to a file ('nicely.dump' by default).

### The format function:

    from nicely import format

    string = format(some_data_structure)

The **format** function uses the **Printer** class to get a string representation of an object.


## Data Types support

There are 2 ways for an object to be "printable" / "dumpable":

### The Formatter class

The **Printer** class needs one **Formatter** for each supported data type (exept for string).

A set of default **Formatter** is provided by the formatters module for Python's builtin types and should be good enough for most purposes.

These formatters can be modified or extended at will to support new types or modify the output for existing ones.

### The __print__ method

Any object can become 'printable' by implementing the **__print__** method which will call the Printer's methods in appropriate ways.


## Installation

    $ pip install nicely

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nicely",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "util",
    "author": null,
    "author_email": "Louis RIVIERE <louis@riviere.xyz>",
    "download_url": "https://files.pythonhosted.org/packages/9f/e2/66d4461b7e85f5d96934958e278dabe7b2b7b02770ccfb510b7a5a336687/nicely-0.2439.0.tar.gz",
    "platform": null,
    "description": "# nicely\n\nPython Fancy Printer\n\n\n## Abstract\n\nThe **nicely** package is yet another 'pretty printer'.\n\nIt is meant to:\n\n* have a **readable and consistent** output.\n    - Nested levels are indented. (the indentation string is configurable (4 spaces by default))\n    - The sequences and the mapping keys are sorted. (can be disabled)\n    - Mapping keys are padded. (so the values are aligned)\n    - The data types may be shown. (disabled by default)\n\n* be **simple** to use.\n    - Only one class is required.\n    - Convinience functions are also provided.\n\n* be **extensible**\n    - If the provided support for standard types doesn't suit your need, it's easy to modify it.\n    - Any object can easaly be supported.\n\n* be able to handle **large data structure**.\n    - Sequences, mappings, strings and multi-lines can be truncated as needed.\n    - Mapping items can be omitted based on regex.\n\n\n## Usage\n\nThere are several ways to use nicel.\n\n### The Printer class:\n\n    from nicely import Printer\n\n    p = Printer()\n    p.print(some_data_structure)\n\nThe **Printer.print** method sends a formatted representation of its argument to a file-like destination (stdout by default).\n\n### The dump function:\n\n    from nicely import dump\n\n    dump(some_data_structure)\n\nThe **dump** function uses the **Printer** class to 'dump' its argument on stdout as well as to a file ('nicely.dump' by default).\n\n### The format function:\n\n    from nicely import format\n\n    string = format(some_data_structure)\n\nThe **format** function uses the **Printer** class to get a string representation of an object.\n\n\n## Data Types support\n\nThere are 2 ways for an object to be \"printable\" / \"dumpable\":\n\n### The Formatter class\n\nThe **Printer** class needs one **Formatter** for each supported data type (exept for string).\n\nA set of default **Formatter** is provided by the formatters module for Python's builtin types and should be good enough for most purposes.\n\nThese formatters can be modified or extended at will to support new types or modify the output for existing ones.\n\n### The __print__ method\n\nAny object can become 'printable' by implementing the **__print__** method which will call the Printer's methods in appropriate ways.\n\n\n## Installation\n\n    $ pip install nicely\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Fancy Printer",
    "version": "0.2439.0",
    "project_urls": {
        "pypi": "https://pypi.org/project/nicely",
        "repository": "https://framagit.org/louis-riviere-xyz/nicely/tree/stable"
    },
    "split_keywords": [
        "util"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c87dbccb36aa30915123cb58ed1433844df741604fe585f423a80d71abf2dc4a",
                "md5": "085169fc75aa49ed4cfc2661b53e3120",
                "sha256": "e2d783433ee581b20ca8258813c7deb16eb2ef287aa21a55d50a15b6b26ca7c8"
            },
            "downloads": -1,
            "filename": "nicely-0.2439.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "085169fc75aa49ed4cfc2661b53e3120",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9150,
            "upload_time": "2024-09-20T13:10:26",
            "upload_time_iso_8601": "2024-09-20T13:10:26.020522Z",
            "url": "https://files.pythonhosted.org/packages/c8/7d/bccb36aa30915123cb58ed1433844df741604fe585f423a80d71abf2dc4a/nicely-0.2439.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9fe266d4461b7e85f5d96934958e278dabe7b2b7b02770ccfb510b7a5a336687",
                "md5": "005545993ab3d105990913e7cfa91529",
                "sha256": "6e957361c75b7fdf36e294ad35a6334c6040848b69b005eb9d7faff0e55fcc67"
            },
            "downloads": -1,
            "filename": "nicely-0.2439.0.tar.gz",
            "has_sig": false,
            "md5_digest": "005545993ab3d105990913e7cfa91529",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10819,
            "upload_time": "2024-09-20T13:10:27",
            "upload_time_iso_8601": "2024-09-20T13:10:27.012254Z",
            "url": "https://files.pythonhosted.org/packages/9f/e2/66d4461b7e85f5d96934958e278dabe7b2b7b02770ccfb510b7a5a336687/nicely-0.2439.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-20 13:10:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "nicely"
}
        
Elapsed time: 0.86044s