***********************************************************
Library to improve the display of your code in the console.
***********************************************************
By adding only a few lines of code at strategic places in your program, you will get a nice console display that will let you know what stage your code is at.
fork of **context-printer**:
----------------------------
This project is a fork of the `context_printer <https://pypi.org/project/context-printer/>`_ project. The philosophy of this project is strictly the same as the original project. Nevertheless, this project offers the following improvements:
* Support for the ``with`` keyword (context manager).
* Formatting of exceptions for better debugging.
* Added decorator behavior.
* Possibility to implicitly name a section.
* More formatting possible (adding highlighting and flashing).
* No conflicts between thread and process (clients send text to a single server).
* Integrated timer for display the sections duration.
Basic usage example:
--------------------
.. code:: python
from context_verbose import printer as ctp
with ctp('Main Section', color='blue'):
ctp.print('Text in main section')
for i in range(3):
with ctp(f'Subsection {i}'):
ctp.print('Text in subsection')
ctp.print('Text in subsection')
The above example will print the following:
.. figure:: https://framagit.org/robinechuca/context-verbose/-/raw/main/basic_example.png
Exaustive example of usage:
---------------------------
.. code:: python
from context_verbose import printer as ctp
@ctp
def decorated_func(x):
return x**x**x
def error_func():
with ctp('Section that will fail'):
return 1/0
ctp.print('we will enter the main section')
with ctp('Main Section', color='cyan'):
ctp.print('text in main section')
try:
with ctp('Subsection 1'):
for x in [1, 8]:
decorated_func(x)
error_func()
except ZeroDivisionError:
pass
with ctp('Subsection 2', color='magenta'):
ctp.print('text in bold', bold=True)
ctp.print('underlined text', underline=True)
ctp.print('blinking text', blink=True)
ctp.print('yellow text', color='yellow')
ctp.print('text highlighted in blue', bg='blue')
ctp.print('text in several ', end='')
ctp.print('parts', print_headers=False)
ctp.print('''text in several
lines''')
with ctp(color='green'):
ctp.print('this subsection is automatically named')
ctp.print('we are out of the main section')
The above example will print the following:
.. figure:: https://framagit.org/robinechuca/context-verbose/-/raw/main/exaustive_example.png
Raw data
{
"_id": null,
"home_page": "https://framagit.org/robinechuca/context-verbose/-/blob/main/README.rst",
"name": "context-verbose",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "display,print,verbose,context,printer,block,context-printer,debug",
"author": "Robin RICHARD (robinechuca)",
"author_email": "serveurpython.oz@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e9/ca/bc2a5631673bbc65b730a4085d1e810de446bdabdd94d1a0bc961c4013b6/context-verbose-2.1.5.tar.gz",
"platform": null,
"description": "\n***********************************************************\nLibrary to improve the display of your code in the console.\n***********************************************************\n\nBy adding only a few lines of code at strategic places in your program, you will get a nice console display that will let you know what stage your code is at.\n\nfork of **context-printer**:\n----------------------------\n\nThis project is a fork of the `context_printer <https://pypi.org/project/context-printer/>`_ project. The philosophy of this project is strictly the same as the original project. Nevertheless, this project offers the following improvements:\n\n* Support for the ``with`` keyword (context manager).\n* Formatting of exceptions for better debugging.\n* Added decorator behavior.\n* Possibility to implicitly name a section.\n* More formatting possible (adding highlighting and flashing).\n* No conflicts between thread and process (clients send text to a single server).\n* Integrated timer for display the sections duration.\n\nBasic usage example:\n--------------------\n\n.. code:: python\n\n from context_verbose import printer as ctp\n with ctp('Main Section', color='blue'):\n ctp.print('Text in main section')\n for i in range(3):\n with ctp(f'Subsection {i}'):\n ctp.print('Text in subsection')\n ctp.print('Text in subsection')\n\nThe above example will print the following:\n\n.. figure:: https://framagit.org/robinechuca/context-verbose/-/raw/main/basic_example.png\n\nExaustive example of usage:\n---------------------------\n\n.. code:: python\n\n from context_verbose import printer as ctp\n\n @ctp\n def decorated_func(x):\n return x**x**x\n\n def error_func():\n with ctp('Section that will fail'):\n return 1/0\n\n ctp.print('we will enter the main section')\n with ctp('Main Section', color='cyan'):\n ctp.print('text in main section')\n try:\n with ctp('Subsection 1'):\n for x in [1, 8]:\n decorated_func(x)\n error_func()\n except ZeroDivisionError:\n pass\n with ctp('Subsection 2', color='magenta'):\n ctp.print('text in bold', bold=True)\n ctp.print('underlined text', underline=True)\n ctp.print('blinking text', blink=True)\n ctp.print('yellow text', color='yellow')\n ctp.print('text highlighted in blue', bg='blue')\n ctp.print('text in several ', end='')\n ctp.print('parts', print_headers=False)\n ctp.print('''text in several\n lines''')\n with ctp(color='green'):\n ctp.print('this subsection is automatically named')\n ctp.print('we are out of the main section')\n\nThe above example will print the following:\n\n.. figure:: https://framagit.org/robinechuca/context-verbose/-/raw/main/exaustive_example.png\n",
"bugtrack_url": null,
"license": "",
"summary": "Tool to simply display information about the state of the code during execution.",
"version": "2.1.5",
"project_urls": {
"Homepage": "https://framagit.org/robinechuca/context-verbose/-/blob/main/README.rst",
"Source Repository": "https://framagit.org/robinechuca/context-verbose/"
},
"split_keywords": [
"display",
"print",
"verbose",
"context",
"printer",
"block",
"context-printer",
"debug"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8bd50c6bfa94047bee07fa36be9922bd42ebde096398cac3b8320e2a47433c1c",
"md5": "589044d0d2f6219804d3f8050d023bdd",
"sha256": "1e742cee949fcdeb9d2afc577dc364479010c3fe9616a739588e4f709d84c1d2"
},
"downloads": -1,
"filename": "context_verbose-2.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "589044d0d2f6219804d3f8050d023bdd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 30451,
"upload_time": "2023-08-28T15:38:46",
"upload_time_iso_8601": "2023-08-28T15:38:46.105216Z",
"url": "https://files.pythonhosted.org/packages/8b/d5/0c6bfa94047bee07fa36be9922bd42ebde096398cac3b8320e2a47433c1c/context_verbose-2.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e9cabc2a5631673bbc65b730a4085d1e810de446bdabdd94d1a0bc961c4013b6",
"md5": "73425e70aa6eff9c659854e814c8796c",
"sha256": "3b81d004d6fe955bef53fb212b24a413aec3ee2c52b7d92c64a36c3f4db447bd"
},
"downloads": -1,
"filename": "context-verbose-2.1.5.tar.gz",
"has_sig": false,
"md5_digest": "73425e70aa6eff9c659854e814c8796c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 28646,
"upload_time": "2023-08-28T15:38:48",
"upload_time_iso_8601": "2023-08-28T15:38:48.075054Z",
"url": "https://files.pythonhosted.org/packages/e9/ca/bc2a5631673bbc65b730a4085d1e810de446bdabdd94d1a0bc961c4013b6/context-verbose-2.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-28 15:38:48",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "context-verbose"
}