{ "info": { "author": "Will Pittman", "author_email": "willjpittman@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: BSD License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX :: BSD", "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "supercli\n========\n\n``supercli`` is a tiny Toolkit to quickly create readable, user-friendly \nCLI interfaces *(+autocomplete)*. \n\n(built on top of builtin argparse/logging modules)\n\n|\n|\n\nThis project has been built around tasks that I find myself repeating\nevery time that I create a CLI interface. Aside from autocompletion-script \ngeneration, this project is less about providing features that are unavailable elsewhere\nthan gluing together several existing options to quickly get you up and running.\n\n\n**__warning__** : this is still very much in alpha, and some arguments **will** change.\n\n\n\n|\n|\n\n.. image:: images/coloured_argparse.png\n :align: center\n\n\n\n.. image:: images/coloured_logging.png\n :align: center\n\n\n\n______________________________________________________________________________\n\n|\n|\n\n.. contents:: Table Of Contents\n\n|\n|\n\n______________________________________________________________________________\n\n\n\nFeatures\n--------\n\nargparse tweaks\n................\n* Automatically generate ZSH autocompletion scripts (supports subarsers)\n* ReStructuredText syntax-highlighting within helplines\n* newlines, and ANSI colours can be used in helplines (on windows too)\n* enables logging (streamhandler) by default (reused if already exists)\n* builtin arguments (``--help(-h), --verbose(-v), --very-verbose(-vv), --fullhelp``)\n* builtin hidden arguments (``--pdb,--devlog,--gen-autocomp,--default-parser``)\n* extended set of logging-options can be enabled if needed (``--logfile,--log-longfmt,--silent``)\n* 1x metavar when multiple flags available for one command \n (``-f, --file [METAVAR]`` **instead of** ``-f [METAVAR] --file [METAVAR]``)\n* argument flags are coloured `white` to standout from their descriptions.\n\nlogging tweaks\n...............\n\n* colour-coded logging (on windows too) (borrowed from `unutbu` and `sorin` on stackoverflow)\n* some useful logfilters (borrowed from `unutbu` and `sorin` on stackoverflow)\n* reuse existing loghandlers if already built in interactive python shells.\n* short string-based argument to quickly modify log-verbosity/logformat\n\n\n\nUsage\n------\n\nQuickStart\n..............\n\nThis is all you need to do to create a CLI interface that matches\nthe format above:\n\n.. code-block:: python\n\n import supercli.argparse\n\n parser = supercli.argparse.ArgumentParser(\n autocomp_cmd = 'myprogram', ## name of command autocompletions are generated for\n description = 'This descriptions can have `ReStructuredText` in it.',\n )\n\n\n.. code-block:: bash\n\n myprogram --gen-autocomp ## create ZSH autocompletion script in current dir\n\n\n\nargparse\n........\n\nThis is just a collection of subclasses of the real `argparse` module,\nand the usage is mostly the same.\n\n\n.. code-block:: python\n\n import supercli.argparse\n from pygments.lexers import HtmlLexer\n from pygments.formatters import Terminal256Formatter\n\n parser = supercli.argparse.ArgumentParser(\n autocomp_cmd = 'myprogram', ## name of command autocompletions are generated for\n description = 'This descriptions can have `ReStructuredText` in it.',\n\n helpline_lexer = HtmlLexer, ## use a different lexer or formatter\n helpline_formatter = Terminal256Formatter, # if you'd like\n\n extended_logopts = True, ## enable flags for log options related to \n # logging to files\n\n developer_opts = True, ## make `invisible` dev commands visible in \n # help menu for users\n\n loghandlers = None, ## if logformat or loghandlers don't suit your needs\n # you can manage and pass your own formatted \n # loghandlers.\n # (-v|-vv) flags will stil work\n )\n\n\n\nlogging\n.......\n\nIf you'd like, you can also use the logging module independently of\nthe argparse module. Once again, nothing really new or mindblowing here, \nthis is purely convenience.\n\n\nloglevel/logformat\n``````````````````\nThe first argument, ``str_arg`` is a shorthand way of changing the loglevel\nand logformat.\n\n.. code-block:: python\n\n import supercli.logging\n import logging\n\n logger = logging.getLogger(__name__)\n\n ## loglevel\n supercli.logging.SetLog('') ## log to stderr (using loglevel==logging.INFO by default)\n # each logrecord is prefixed by the datetime\n supercli.logging.SetLog('i') ## loglevel==logging.INFO\n supercli.logging.SetLog('w') ## loglevel==logging.WARNING\n supercli.logging.SetLog('v') ## loglevel==logging.DEBUG\n supercli.logging.SetLog('vv') ## loglevel==logging.DEBUG and disable all logfilters\n\n ## the long way\n supercli.logging.SetLog( lv='INFO' )\n\n\n ## logformat\n supercli.logging.SetLog('d') ## (developer) instead of datetime, display __name__ and line-number\n supercli.logging.SetLog('l') ## each log-entry takes 2x lines (full import-path & func, time, lineno, etc)\n\n ## these can be combined\n supercli.logging.SetLog('dv') ## (developer) and (verbose) flags are both active\n\n\nlogfile\n```````\n99.9% of the time when I want to log to a file, I want to use a ``RotatingLogHandler``.\nI'm guessing this is the case for most people, so it is the default behaviour.\n\n\n.. code-block:: python\n\n import supercli.logging\n import logging\n\n logger = logging.getLogger(__name__)\n\n supercli.logging.SetLog( \n lv = 'INFO',\n logfile = '/path/to/myfile.log',\n logstream = False , ## optionally, disable logging to STDERR\n logfile_size = 1000000, ## =~8mb\n debug_mode = False, ## this module is peppered with print() statements\n # to assist in debugging. This displays them.\n )\n\n\nlogfilters\n``````````\n\nLogFilters let you filter out logrecords based on some information.\nThere are two logfilters in ``supercli.logging``, but any ``logging.Filter``\nsubclass will work.\n\nBy default ``SetLog()`` is set up to use ``supercli.logging.BlackList`` as it's filter.\nEach record is matched against the calling function's **import-path + function-name**.\n\nex:\n\n.. code-block:: python\n\n fnmatch.fnmatch( filter_value, '*{import_path}.{function_name}*' )\n\n\n.. code-block:: python\n\n from supercli.logging import SetLog, Blacklist\n import logging\n\n logger = logging.getLogger(__name__)\n\n SetLog(\n lv = 'INFO' ,\n logfile = '/path/to/myfile.log',\n logstream = True ,\n filter_matches = ['sqliface.','chatty.module.func'], ## filters records matching \n # '*sqliface.*', \n # '*chatty.module.func*' \n\n filter_type = Blacklist, ## BlackList is the default\n )\n\n\n\n\n\n\nTodo\n----\n\n* tests\n* bash autocompletion scripts\n* (zsh) completion types (_file,_netwkiface,...)\n* needs more flexible handling of ackward environments like maya.\n (I'm assuming all autodesk products have their own loghandlers for\n script-editors and the like)\n* make logging.WhiteList work like Blacklist works.\n* WhiteList and BlackList need to be able to be used together\n* Show a more generic use of command in picture.. \n\n\nThanks\n-------\n\n* `colorama` authors for filling cmd.exe with colourful text, instead of the room with colourful language.\n* stackoverflow users `unutbu` and `sorin` for windows-colour/logfilter solutions.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/willjp/supercli", "keywords": "supercli cli color colour argparse logging interface", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "supercli", "package_url": "https://pypi.org/project/supercli/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/supercli/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/willjp/supercli" }, "release_url": "https://pypi.org/project/supercli/0.0a5/", "requires_dist": null, "requires_python": null, "summary": "Toolkit to quickly create readable, user-friendly CLI interfaces with automatic shell-autocompletion", "version": "0.0a5" }, "last_serial": 2683705, "releases": { "0.0a1": [ { "comment_text": "", "digests": { "md5": "b10a0cd00e5d73821eedb0776b3f2eb6", "sha256": "35f9cda339584a199d933bc078d56af35a4f102780a0670eff1fbe65cb16ee17" }, "downloads": -1, "filename": "supercli-0.0a1.tar.gz", "has_sig": false, "md5_digest": "b10a0cd00e5d73821eedb0776b3f2eb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23648, "upload_time": "2016-09-06T00:44:25", "url": "https://files.pythonhosted.org/packages/07/3d/82c478395a4ea08703e0f42a40dfb7e8eda197f0752c9bb51393fcdec8ca/supercli-0.0a1.tar.gz" } ], "0.0a2": [ { "comment_text": "", "digests": { "md5": "8a27c18c2751548573fc13e925b10580", "sha256": "91a494cfc813695992582b1c28aa894eab8f691ee2078c8899d1eeaf03a78459" }, "downloads": -1, "filename": "supercli-0.0a2.tar.gz", "has_sig": false, "md5_digest": "8a27c18c2751548573fc13e925b10580", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20551, "upload_time": "2016-09-11T12:43:09", "url": "https://files.pythonhosted.org/packages/fd/42/a3672d578be5484e0fd6a90fdfeff661d4980c84706b59a45036ea10e253/supercli-0.0a2.tar.gz" } ], "0.0a3": [ { "comment_text": "", "digests": { "md5": "2a64657a14293a18894d7843ba7dd4ad", "sha256": "081293f8b921c4f46e844ba77dc4f486701b93c180b034df900bc14ee1a8d3c6" }, "downloads": -1, "filename": "supercli-0.0a3.tar.gz", "has_sig": false, "md5_digest": "2a64657a14293a18894d7843ba7dd4ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25251, "upload_time": "2016-12-10T18:15:47", "url": "https://files.pythonhosted.org/packages/07/f8/3e7942c30e76e3e763c75f1975fea241125ceda1324a16f4d50f47c0b485/supercli-0.0a3.tar.gz" } ], "0.0a4": [ { "comment_text": "", "digests": { "md5": "2dba103f51ee0a74d9a90dc99f0c6c11", "sha256": "5008066d758afb1f7f91a7ebd6ce0244a39cc7d994d6fd9186ab6d6ca03ccdeb" }, "downloads": -1, "filename": "supercli-0.0a4.tar.gz", "has_sig": false, "md5_digest": "2dba103f51ee0a74d9a90dc99f0c6c11", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24311, "upload_time": "2017-01-21T12:50:10", "url": "https://files.pythonhosted.org/packages/60/71/cabcc6f06e6a49ecc36103ed218dcb7e8217d5261901439f7b91b9bcd5b2/supercli-0.0a4.tar.gz" } ], "0.0a5": [ { "comment_text": "", "digests": { "md5": "0fd997e2a4456a4079452ea784286753", "sha256": "9549f3d1ebe863b4a77a8873c59dddad69a728e9e768bccc392179cd52e2cffc" }, "downloads": -1, "filename": "supercli-0.0a5.tar.gz", "has_sig": false, "md5_digest": "0fd997e2a4456a4079452ea784286753", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 266975, "upload_time": "2017-03-05T12:06:53", "url": "https://files.pythonhosted.org/packages/e2/7c/5cec0355dc16b3b05808577fd3a09c95dfd6689b9cd9ce3f4ca2cf9cca21/supercli-0.0a5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0fd997e2a4456a4079452ea784286753", "sha256": "9549f3d1ebe863b4a77a8873c59dddad69a728e9e768bccc392179cd52e2cffc" }, "downloads": -1, "filename": "supercli-0.0a5.tar.gz", "has_sig": false, "md5_digest": "0fd997e2a4456a4079452ea784286753", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 266975, "upload_time": "2017-03-05T12:06:53", "url": "https://files.pythonhosted.org/packages/e2/7c/5cec0355dc16b3b05808577fd3a09c95dfd6689b9cd9ce3f4ca2cf9cca21/supercli-0.0a5.tar.gz" } ] }