{"id":13815250,"url":"https://github.com/edraobdu/printy","last_synced_at":"2026-04-10T10:02:57.076Z","repository":{"id":53177906,"uuid":"254921562","full_name":"edraobdu/printy","owner":"edraobdu","description":"Printy is a light and cross-platform library that extends the functionalities of the built-in function print()","archived":false,"fork":false,"pushed_at":"2025-12-28T17:15:42.000Z","size":6442,"stargazers_count":98,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-28T20:58:45.219Z","etag":null,"topics":["color-print","inline-format","library","printy","pypi","python","python3"],"latest_commit_sha":null,"homepage":"https://github.com/edraobdu/printy#printy","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edraobdu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-11T17:39:37.000Z","updated_at":"2025-12-28T17:15:37.000Z","dependencies_parsed_at":"2022-09-14T09:52:22.266Z","dependency_job_id":null,"html_url":"https://github.com/edraobdu/printy","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/edraobdu/printy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edraobdu%2Fprinty","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edraobdu%2Fprinty/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edraobdu%2Fprinty/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edraobdu%2Fprinty/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edraobdu","download_url":"https://codeload.github.com/edraobdu/printy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edraobdu%2Fprinty/sbom","scorecard":{"id":367053,"data":{"date":"2025-08-11","repo":{"name":"github.com/edraobdu/printy","commit":"8d5faeb8ac16ac6b4a6199bdfeb0d12d72ec6d99"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/20 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 11 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:03:44.400Z","repository_id":53177906,"created_at":"2025-08-18T12:03:44.400Z","updated_at":"2025-08-18T12:03:44.400Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31637748,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["color-print","inline-format","library","printy","pypi","python","python3"],"created_at":"2024-08-04T04:03:12.848Z","updated_at":"2026-04-10T10:02:57.069Z","avatar_url":"https://github.com/edraobdu.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Printy\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"assets/printy-logo-transparent.png\" alt=\"Printy Logo\" width=\"200\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eSometimes you just want to print stuff with colors\u003c/em\u003e\n\u003c/p\u003e\n\n![Codecov](https://img.shields.io/codecov/c/gh/edraobdu/printy?logo=codecov\u0026style=flat-square)\n![PyPI](https://img.shields.io/pypi/v/printy?style=flat-square)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/printy?style=flat-square)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/printy?logo=python\u0026logoColor=blue\u0026style=flat-square)\n![PyPI - License](https://img.shields.io/pypi/l/printy?style=flat-square)\n\nPrinty is a **light** and **cross-platform** library that extends the functionalities of the\nbuilt-in function ```print()```. Printy stands out for its\nsimplicity and for being an easy to use library, it lets you colorize and apply some standard formats\nto your text with an intuitive and friendly API based on **flags**.\n\n![Printy demo](.github/demo_printy.gif)\n\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [How to use it?](#how-to-use-it)\n    1. [Using global flags](#using-global-flags)\n    2. [Using inline flags](#using-inline-flags)\n    3. [Untrusted sources](#untrusted-sources)\n    4. [Background Colors](#background-colors)\n3. [Curious?](#curious)\n4. [API](#api)\n    1. [printy()](#printy)\n    2. [List 1: flags](#list-1-flags)\n5. [Changelog](#changelog)\n6. [Dependencies](#dependencies)\n7. [Contributing](#contributing)\n\n## Installation\n\nyou can either clone this repository or install it via pip\n```python\npip install printy\n```\n\n## How to use it?\n\nOnce you install printy, you can find a short but concise documentation about the\navailable flags and the syntax by running the following command on your console:\n```python\npython -m printy\n```\n\nThis will print out some instructions right away.\n\n![Printy Help me](.github/printy_helpme.png)\n \n#### Using global flags\n\nFirst of all, import printy:\n```python\nfrom printy import printy\n```\n\nPrinty is still a 'print' statement, so you can use it as it is:\n```python\nprinty(\"text with no format\")\n```\n\n![Printy no format](.github/printy_no_format.png)\n\nYou can use a global set of flags to specify a format you want to apply to the text,\nlet's say we want to colorize a text with a bold blue and also adding an underline:\n```python\nprinty(\"Text with a bold blue color and underlined\", 'bBU')\n```\n![Printy global bold blue](.github/printy_global_bold_blue.png)\n\n#### Using inline flags\nAlthough applying a global format is interesting, it is not as much as applying\nsome specific format to some section of the text only. For that, printy uses a \nintuitive syntax to accomplish that goal. Use the [] to specify the flags to use\nfor formatting the text, right before the text, and the @ to finish the formatting \nsection:\n```python\nprinty(\"Predefined format [rI]This is red and with italic style@ also predefined format\")\n```\n![Printy inline red italic](.github/printy_inline_red_italic.png)\n\nThe text that is not surrounded by the format syntax will remain with the predefined \nformat.\n\nBut you can always override this predefined format for inline format specifying the flags \nin the 'predefined' parameter\n```python\nprinty(\"Now this is blue [rI]Still red italic@ and also blue\", predefined=\"b\")\n```\n![printy changing predefined](.github/printy_changing_predefined.png)\n\nOr, you can override the whole format without changing the inline format with a global flag:\n```python\nprinty(\"Now i am still blue, [rI]and also me@, and me as well \", \"b\")\n```\n![Printy overriding inline with global](.github/printy_override_inline_with_global.png)\n\nYou can combine it with f-strings:\n```python\na = 60\nprinty(f\"The day has [yB]{ 24 * a }@ minutes\")\n```\n![Printy f-strings](.github/printy_f_strings.png)\n\nPrinty also supports reading from a file, just pass the path to your file\nin the file parameter:\n\n```python\n# NOTE: Here, it is necessary to specify the flags (if you want) \n# in the 'flags' parameter\nprinty(file=\"/path/to/your/file/file.extension\", flags=\"cU\")\n```\n![Printy from file](.github/printy_from_file.png)\n\nYou can also pretty print your dictionaries, lists, tuples, sets, and objects:\n\n```python\nmy_dict = {'id': 71, 'zip_codes': ['050001', '050005', '050011', '050015', '050024'], 'code': '05001', 'country': {'code': 'co'}, 'city_translations': [{'language_code': 'es', 'name': 'Medellín'}], 'flag': None}\nprinty(my_dict)\n```\n\n![Printy pretty dict](.github/printy_pretty_dict_four_indentation.png)\n\n```python\nmy_dict = {'id': 71, 'zip_codes': ['050001', '050005', '050011', '050015', '050024'], 'code': '05001', 'country': {'code': 'co'}, 'city_translations': [{'language_code': 'es', 'name': 'Medellín'}], 'flag': None}\nprinty(my_dict, indentation=2)\n```\n\n![Printy pretty dict](.github/printy_pretty_dict_two_indentation.png)\n\n### New in v2.2.0\n\n#### Untrusted sources\n\nWhen dealing with untrusted sources, like, user input, we need to ensure the text is properly escaped\nbefore we pass it to printy. For that, we can use the funtion `escape` integrated with printy.\n\nLet's say we have and `email` variable that it's fill by an untrusted source:\n\n```python\nfrom printy import printy, escape\n\n# Comes from an untrusted source\nemail = 'example@example.com'\n\n# Without escaping it\nprinty(f'This is your email: [nB]{email}@')\n\n# Escaping it\nprinty(f'This is your email: [nB]{escape(email)}@')\n```\n![Printy escape](.github/escape_printy.png)\n\n### New in v2.2.0\n\n#### Background Colors\n\nNow, we can define the background color of the text, either on inline formats or with global flags, we simply pass the color flag between two brackets:\n\n```python\nfrom printy import printy\n\n# Global format\nprinty('Green bold text over a red background', 'nB{r}')\n\n# Inline format\nprinty('Normal Text [nB{r}]Green bold text over a red background@ Also normal')\n```\n\n![Printy background](.github/background_printy.png)\n\n## Integration with Other Libraries\n\nSometimes you need to get the formatted text with ANSI escape sequences without printing it directly. This is useful when integrating printy with other libraries or when you need to pass formatted strings to other functions. For this, printy provides the `raw()` function (also available as `raw_format()` for backward compatibility).\n\n### Getting Formatted Text\n\nThe `raw()` function returns the text with all ANSI escape codes applied:\n\n```python\nfrom printy import raw\n\n# Get formatted text as a string\nformatted = raw(\"Some [rB]formatted@ [yIU]text@\")\nprint(repr(formatted))  # Shows the ANSI escape codes\nprint(formatted)        # Displays the formatted text\n```\n\n![Printy raw format](.github/printy_raw_format.png)\n\n### Integration Example: Using with Tabulate\n\nHere's an example of how you can use `raw()` to integrate printy with other libraries. In this case, we'll use `tabulate` to create tables with colorful, formatted headers:\n\n```python\nfrom printy import raw\n\n# This example shows how to integrate printy with other tools\n# You can use this same pattern with any library that accepts strings\n# If you want to try this specific example: pip install tabulate\ntry:\n    from tabulate import tabulate\n\n    data = [\n        [\"Alice\", 25, \"Engineering\"],\n        [\"Bob\", 30, \"Marketing\"],\n        [\"Charlie\", 35, \"Sales\"]\n    ]\n\n    # Use raw() to create formatted strings for headers\n    headers = [\n        raw(\"[cB]Name@\"),           # Cyan bold\n        raw(\"[yB]Age@\"),            # Yellow bold\n        raw(\"[nB]Department@\")      # Green bold\n    ]\n\n    print(tabulate(data, headers=headers, tablefmt=\"grid\"))\nexcept ImportError:\n    print(\"Install tabulate to try this example: pip install tabulate\")\n```\n\nThis creates a table with colorful, bold headers. You can use the same pattern to integrate printy's formatting with any other library that accepts string inputs.\n\n![Printy Tabulate Example](.github/printy_tabulate_example.png)\n\n### Available Colors and Formats\n\nFor convenience, all color and format flags are available as constants:\n\n```python\nfrom printy import COLORS, FORMATS\nprint(COLORS)    # List of all available color flags\nprint(FORMATS)   # List of all available format flags\n```\n\n![Printy COLORS FORMATS](.github/printy_COLORS_FORMATS.png)\n\n**Note:** `raw_format()` is still available as an alias for `raw()` to maintain backward compatibility with existing code.\n\n## API\n\n### printy()\n\n| Parameters | type |  | Description |\n| --- | --- | --- | --- |\n| value | str | required | Value to be formatted |\n| flags | str | optional | Global flags to be applied, they can be passed in the 'value' with the following syntax: [flags]value@ (check [List 1](#list-1-flags) for more info)|\n| predefined | str | optional | A set of flags to apply to the value as its predefined value |\n| file | str | optional | A path to a file where we want to read the value from | \n| end | str | optional | A value to be appended to the value, default is '\\n' |\n| pretty | bool | optional | True if we want to pretty print objects, False if we do not (default True) |\n| indentation | int | optional | Indentation when pretty printing dictionaries or any iterable (default 4) |\n\n### List 1 'flags'\n\n**COLORS**\n- k - Applies a black color to the text\n- g - Applies a grey color to the text\n- w - Applies a white color to the text\n- \u003cr - Applies a darkred color to the text\n- r - Applies a red color to the text\n- r\u003e - Applies a lightred color to the text\n- \u003cn - Applies a darkgreen color to the text\n- n - Applies a green color to the text\n- n\u003e - Applies a lightgreen color to the text\n- \u003cy - Applies a darkyellow color to the text\n- y - Applies a yellow color to the text\n- y\u003e - Applies a lightyellow color to the text\n- \u003cb - Applies a darkblue color to the text\n- b - Applies a blue color to the text\n- b\u003e - Applies a lightblue color to the text\n- \u003cm - Applies a darkmagenta color to the text\n- m - Applies a magenta color to the text\n- m\u003e - Applies a lightmagenta color to the text\n- \u003cc - Applies a darkcyan color to the text\n- c - Applies a cyan color to the text\n- c\u003e - Applies a lightcyan color to the text\n- \u003co - Applies a darkorange color to the text\n- o - Applies a orange color to the text\n- o\u003e - Applies a lightorange color to the text\n- \\\u003cp - Applies a darkpurple color to the text\n- p - Applies a purple color to the text\n- p\u003e - Applies a lightpurple color to the text\n\n**FORMATS**\n- B - Applies a bold font weight to the text\n- U - Applies an underline to the text\n- I - Applies an italic font type to the text\n- H - Highlights the text\n- S - Crosses out the text, aka Strike\n- D - Dim effect\n\n## Changelog\n\n[Changelog.md](CHANGELOG.md)\n\n## Dependencies\n\nPrinty currently supports Python 3.10 and up. Printy is a cross-platform library.\n\n## Contributing\n\nPlease feel free to contact me if you want to be part of the project and contribute.\nFork or clone, push to your fork, make a pull request, let's make this a better app\nevery day!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedraobdu%2Fprinty","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedraobdu%2Fprinty","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedraobdu%2Fprinty/lists"}