{ "info": { "author": "vb YAZILIM", "author_email": "hello@vbyazilim.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "![Python](https://img.shields.io/badge/python-3.7.3-green.svg)\n[![PyPI version](https://badge.fury.io/py/django-vb-console.svg)](https://badge.fury.io/py/django-vb-console)\n\n# vb-console\n\nA custom Python object inspector with style.\n\n## Installation and Usage\n\n```bash\n$ pip install vb-console\n```\n\nBy default, console output is disabled. You can enable output via setting\nthe `ENABLE_CONSOLE` environment variable. Launch Python reply:\n\n```bash\n$ ENABLE_CONSOLE=1 python\n```\n\nthen;\n\n```python\nPython 3.7.3 (default, Jul 6 2019, 07:47:04) \n[Clang 11.0.0 (clang-1100.0.20.17)] on darwin\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n>>> \n>>> from console import console\n>>> console = console(source=__name__) \n>>> console('Hello World')\n[__main__]*****************************************************************************\n('Hello World',)\n***************************************************************************************\n\n>>> console.dir([1,2,3])\n[__main__ : instance of list | ]*****************************************\n{ 'internal_methods': [ '__add__', '__class__', '__contains__', '__delattr__', \n '__delitem__', '__dir__', '__doc__', '__eq__', '__format__',\n '__ge__', '__getattribute__', '__getitem__', '__gt__', \n '__hash__', '__iadd__', '__imul__', '__init__', \n '__init_subclass__', '__iter__', '__le__', '__len__', \n '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', \n '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', \n '__setattr__', '__setitem__', '__sizeof__', '__str__', \n '__subclasshook__'],\n 'public_attributes': [ 'append', 'clear', 'copy', 'count', 'extend', 'index', \n 'insert', 'pop', 'remove', 'reverse', 'sort']}\n***************************************************************************************\n```\n\nYou have few options for console output:\n\n- `console(object)`\n- `console(object, object, object, ...)`\n- `console.dir(object)`\n\nYou can custom `console` instance;\n\n```python\nfrom console import console\n\n# default/basic\nconsole = console(source=__name__)\n\n# set screen width and indentation\nconsole = console(\n source=__name__,\n indent=8,\n width=64,\n)\n\n# set color mode\nconsole = console(\n source=__name__,\n color='yellow',\n)\n\n# inline color\nconsole('hello', 'world', [1, 2, 3], color='red')\n```\n\nValid colors are:\n\n- `black`\n- `red`\n- `green`\n- `yellow`\n- `blue`\n- `magenta`\n- `cyan`\n- `white`\n- `default`\n\nDefaults are;\n\n- `width` is `79`\n- `indent` is `4`\n- `seperator_char` is `*`\n- `color` is `yellow`\n\nExample of complex object inspection:\n\n```python\nclass MyClass:\n klass_var1 = 1\n klass_var2 = 2\n\n def __init__(self):\n self.name = 'Name'\n\n def start(self):\n return 'method'\n\n @property\n def admin(self):\n return True\n\n @staticmethod\n def statik():\n return 'Static'\n\n @classmethod\n def klass_method(cls):\n return 'kls'\n\nmc = MyClass()\n\nconsole.dir(MyClass)\n```\n\nOutput:\n\n```bash\n[__main__ : MyClass | ]*******************************************\n{ 'class_methods': ['klass_method'],\n 'internal_methods': [ '__class__', '__delattr__', '__dict__', '__dir__',\n '__doc__', '__eq__', '__format__', '__ge__',\n '__getattribute__', '__gt__', '__hash__',\n '__init_subclass__', '__le__', '__lt__',\n '__module__', '__ne__', '__new__', '__reduce__',\n '__reduce_ex__', '__repr__', '__setattr__',\n '__sizeof__', '__str__', '__subclasshook__',\n '__weakref__'],\n 'property_list': ['admin'],\n 'public_attributes': ['klass_var1', 'klass_var2'],\n 'public_methods': ['__init__', 'start'],\n 'static_methods': ['statik']}\n*******************************************************************************\n```\n\nMore;\n\n```python\nconsole.dir(mc)\n```\n\nOutput:\n\n```bash\nIn [6]: console.dir(mc) \n[__main__ : instance of MyClass | ]*******************\n{ 'instance_attributes': ['name'],\n 'internal_methods': [ '__class__', '__delattr__', '__dict__', '__dir__',\n '__doc__', '__eq__', '__format__', '__ge__',\n '__getattribute__', '__gt__', '__hash__',\n '__init__', '__init_subclass__', '__le__', '__lt__',\n '__module__', '__ne__', '__new__', '__reduce__',\n '__reduce_ex__', '__repr__', '__setattr__',\n '__sizeof__', '__str__', '__subclasshook__',\n '__weakref__'],\n 'public_attributes': [ 'admin', 'klass_method', 'klass_var1',\n 'klass_var2', 'start', 'statik']}\n********************************************************************************\n```\n\nStandard objects:\n\n```python\nconsole.dir(dict)\n```\n\nOutput:\n\n```bash\n[__main__ : dict | ]**********************************************\n{ 'internal_methods': [ '__class__', '__contains__', '__delattr__',\n '__delitem__', '__dir__', '__doc__', '__eq__',\n '__format__', '__ge__', '__getattribute__',\n '__getitem__', '__gt__', '__hash__', '__init__',\n '__init_subclass__', '__iter__', '__le__',\n '__len__', '__lt__', '__ne__', '__new__',\n '__reduce__', '__reduce_ex__', '__repr__',\n '__setattr__', '__setitem__', '__sizeof__',\n '__str__', '__subclasshook__'],\n 'public_attributes': [ 'clear', 'copy', 'fromkeys', 'get', 'items',\n 'keys', 'pop', 'popitem', 'setdefault', 'update',\n 'values']}\n********************************************************************************\n```\n\n### Using with Django\n\n`console` also checks for Django\u2019s `DEBUG` settings value: `settings.DEBUG`.\nExample usage for Django project;\n\n```python\nfrom django.views.generic.base import TemplateView\n\nfrom console import console\n\nconsole = console(source=__name__)\n\n\nclass IndexView(TemplateView):\n template_name = 'index.html'\n\n def get_context_data(self, **kwargs):\n kwargs = super().get_context_data(**kwargs)\n console('kwargs', kwargs)\n console.log(kwargs)\n return kwargs\n```\n\n---\n\n## License\n\nThis project is licensed under MIT\n\n---\n\n## Contributer(s)\n\n* [U\u011fur \"vigo\" \u00d6zy\u0131lmazel](https://github.com/vigo) - Creator, maintainer\n\n---\n\n## Contribute\n\nAll PR\u2019s are welcome!\n\n1. `fork` (https://github.com/vbyazilim/django-vb-console/fork)\n1. Create your `branch` (`git checkout -b my-features`)\n1. `commit` yours (`git commit -am 'added killer options'`)\n1. `push` your `branch` (`git push origin my-features`)\n1. Than create a new **Pull Request**!\n\n---\n\n## Change Log\n\n**2019-10-03**\n\n- Fix some of the code\n- Add `ENABLE_CONSOLE` environment variable\n- Update README\n\n**2019-09-29**\n\n- Init repo!\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/vbyazilim/vb-console", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "vb-console", "package_url": "https://pypi.org/project/vb-console/", "platform": "", "project_url": "https://pypi.org/project/vb-console/", "project_urls": { "Homepage": "https://github.com/vbyazilim/vb-console" }, "release_url": "https://pypi.org/project/vb-console/0.1.1/", "requires_dist": null, "requires_python": ">=3.0", "summary": "Logger and object inspector for Python", "version": "0.1.1" }, "last_serial": 5925344, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "c764ad68837f0e3708fc70b5093b0369", "sha256": "0d65108826fedf87cf02715a18670426fd859a03049f74e2a62bebdec0e52bf6" }, "downloads": -1, "filename": "vb_console-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c764ad68837f0e3708fc70b5093b0369", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 6223, "upload_time": "2019-10-03T20:30:35", "url": "https://files.pythonhosted.org/packages/62/5c/c1318d6fd48e3c7748ca741fff6764cb52e9a39375dcf0f3e47b48968f9a/vb_console-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "574bae63e15961de6a3abe996de614d0", "sha256": "be97959fbb8b77f547793fac61a143027d9b1f42ab4567e67f52cd8da496e259" }, "downloads": -1, "filename": "vb-console-0.1.1.tar.gz", "has_sig": false, "md5_digest": "574bae63e15961de6a3abe996de614d0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 5650, "upload_time": "2019-10-03T20:30:38", "url": "https://files.pythonhosted.org/packages/fc/dd/2b60ab47f7181452ba9a9fd774ba434a3823cf69f0a57d2479405ddf8405/vb-console-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c764ad68837f0e3708fc70b5093b0369", "sha256": "0d65108826fedf87cf02715a18670426fd859a03049f74e2a62bebdec0e52bf6" }, "downloads": -1, "filename": "vb_console-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c764ad68837f0e3708fc70b5093b0369", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.0", "size": 6223, "upload_time": "2019-10-03T20:30:35", "url": "https://files.pythonhosted.org/packages/62/5c/c1318d6fd48e3c7748ca741fff6764cb52e9a39375dcf0f3e47b48968f9a/vb_console-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "574bae63e15961de6a3abe996de614d0", "sha256": "be97959fbb8b77f547793fac61a143027d9b1f42ab4567e67f52cd8da496e259" }, "downloads": -1, "filename": "vb-console-0.1.1.tar.gz", "has_sig": false, "md5_digest": "574bae63e15961de6a3abe996de614d0", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.0", "size": 5650, "upload_time": "2019-10-03T20:30:38", "url": "https://files.pythonhosted.org/packages/fc/dd/2b60ab47f7181452ba9a9fd774ba434a3823cf69f0a57d2479405ddf8405/vb-console-0.1.1.tar.gz" } ] }