{ "info": { "author": "Tom Elliott", "author_email": "tom.elliott@nyu.edu", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "airtight\n========\n\nIf you're going to ``import antigravity``\\ , you'd better make sure the hatch is closed.\n\nThe **airtight** package is written for Python 3.6+. It provides idiosyncratic code that somewhat simplifies the creation and debugging of command-line python scripts.\n\nsimpler than a template\n-----------------------\n\nInstead of copying some 50-line template for your python script and then writing a bunch of calls to `argparse `_ and `logging `_ just build some lists describing the arguments and logging level you want and invoke ``artight.cli.configure_commandline()``\\ :\n\n.. code-block:: python\n\n #!/usr/bin/env python3\n # -*- coding: utf-8 -*-\n \"\"\"\n Example script template using the airtight module\n \"\"\"\n\n from airtight.cli import configure_commandline\n import logging\n\n DEFAULT_LOG_LEVEL = logging.WARNING\n OPTIONAL_ARGUMENTS = [\n # each argument is a list: short option, long option, default value, \n # help string, required?\n ['-l', '--loglevel', 'NOTSET',\n 'desired logging level (' +\n 'case-insensitive string: DEBUG, INFO, WARNING, or ERROR',\n False],\n ['-v', '--verbose', False, 'verbose output (logging level == INFO)',\n False],\n ['-w', '--veryverbose', False,\n 'very verbose output (logging level == DEBUG)', False],\n ['-x', '--custom', 7, 'your custom argument', False]\n ]\n POSITIONAL_ARGUMENTS = [\n # each argument is a list with 3 elements: name, type, help\n ['foovar', str, 'some input value that you want']\n ]\n\n\n def main(**kwargs):\n \"\"\"Main function of your script.\n\n kwargs -- keyword arguments as parsed from the command line\n \"\"\"\n # your additional code here\n\n\n if __name__ == \"__main__\":\n main(**configure_commandline(\n OPTIONAL_ARGUMENTS, POSITIONAL_ARGUMENTS, DEFAULT_LOG_LEVEL))\n\nmake debug logging just a wee bit easier\n----------------------------------------\n\nThe ``airtight.logging`` module provides two methods: ``configure_logging()``\\ , which is used by ``airtight.cli.configure_commandline()``\\ , and ``flog()``\\ , which reduces typing when you want to log a variable's name and value.\n\nSo, you can write:\n\n.. code-block:: python\n\n > from airtight.logging import flog\n > fish = 'salmon'\n > flog(fish)\n DEBUG:foo_script: fish: 'salmon'\n\n``flog()`` logs to DEBUG by default, but an optional keyword argument ``level`` may be used to specify another standard level, e.g.:\n\n.. code-block:: python\n\n > from airtight.logging import flog\n > import logging\n > fish = 'salmon'\n > flog(fish, level=logging.WARNING)\n WARNING:foo_script: fish: 'salmon'\n\nAnother optional keyword argument (\\ ``comment``\\ ) may be specified. A string value supplied via this argument will be postfixed to the logged variable name and value, thus:\n\n.. code-block:: python\n\n > from airtight.logging import flog\n > fish = 'salmon'\n > flog(fish, comment='I like this fish!')\n DEBUG:foo_script: fish: 'salmon' I like this fish!\n\netc.\n----\n\nBug reports and feature requests are welcome, but really I'd prefer pull requests. \n\ntodo\n----\n\n\n* docstrings", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/paregorios/airtight", "keywords": "scripting", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "airtight", "package_url": "https://pypi.org/project/airtight/", "platform": "", "project_url": "https://pypi.org/project/airtight/", "project_urls": { "Homepage": "https://github.com/paregorios/airtight" }, "release_url": "https://pypi.org/project/airtight/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Components for scripts in python 3.6+", "version": "0.2.0" }, "last_serial": 3234975, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "c3e17505adecf2f17e11a9016d1e9389", "sha256": "624fc7f60682caf74ef052833b861cdf148b896e213e6745491c2c18301f5e90" }, "downloads": -1, "filename": "airtight-0.1.tar.gz", "has_sig": false, "md5_digest": "c3e17505adecf2f17e11a9016d1e9389", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16569, "upload_time": "2017-10-08T19:42:12", "url": "https://files.pythonhosted.org/packages/1e/30/a50514200f6e84c80883f9e13b1b1c0517bcdcb972dd04f19f572c33fb7a/airtight-0.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9b753f3d14a759ae33af17a30d4acd6c", "sha256": "dcfbd8833dd529d6c2ea5601afebf03dc7f624d94fa735cfaa8c6928d120c057" }, "downloads": -1, "filename": "airtight-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9b753f3d14a759ae33af17a30d4acd6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16903, "upload_time": "2017-10-08T22:43:12", "url": "https://files.pythonhosted.org/packages/63/0a/235cdd7fa46383883916e803c71c8f0bb71abd8eed0ba760a9580511de3d/airtight-0.2.0.tar.gz" } ], "0.2.0a1": [ { "comment_text": "", "digests": { "md5": "181462327905e9bb375861722a84afc7", "sha256": "70729d2eae2b71aadf8903ec591e6961049a433ae5f619fa66e671a91c199278" }, "downloads": -1, "filename": "airtight-0.2.0a1.tar.gz", "has_sig": false, "md5_digest": "181462327905e9bb375861722a84afc7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16782, "upload_time": "2017-10-08T21:53:44", "url": "https://files.pythonhosted.org/packages/d9/62/e64aa22d86823fd0eeb72cc9d56a0210b7da117ce1755eddd1e1de7a3607/airtight-0.2.0a1.tar.gz" } ], "0.2.0a2": [ { "comment_text": "", "digests": { "md5": "06cd2baadcc3fef1e24afc78ba7899ed", "sha256": "0c9950594743a92f43e5cceb1d49ad196959ff007cae55dec98f4f288379224e" }, "downloads": -1, "filename": "airtight-0.2.0a2.tar.gz", "has_sig": false, "md5_digest": "06cd2baadcc3fef1e24afc78ba7899ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16800, "upload_time": "2017-10-08T22:00:24", "url": "https://files.pythonhosted.org/packages/ba/1a/b809bae288cc01905fc47cb80c478ddda055cdb9dcff1d7761f6bbda89ad/airtight-0.2.0a2.tar.gz" } ], "0.2.0a3": [ { "comment_text": "", "digests": { "md5": "a3fa2ce73d7327c9d061844795c0024c", "sha256": "77ff065fb3c00aa3e269218340a0d4719156a4aa7ef52029d4f976197393e6ff" }, "downloads": -1, "filename": "airtight-0.2.0a3.tar.gz", "has_sig": false, "md5_digest": "a3fa2ce73d7327c9d061844795c0024c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16910, "upload_time": "2017-10-08T22:35:02", "url": "https://files.pythonhosted.org/packages/84/d8/728a772ee74304db91a6c018ed1f5fcee40f2bce8c259b79f1f16db1a2c2/airtight-0.2.0a3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9b753f3d14a759ae33af17a30d4acd6c", "sha256": "dcfbd8833dd529d6c2ea5601afebf03dc7f624d94fa735cfaa8c6928d120c057" }, "downloads": -1, "filename": "airtight-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9b753f3d14a759ae33af17a30d4acd6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16903, "upload_time": "2017-10-08T22:43:12", "url": "https://files.pythonhosted.org/packages/63/0a/235cdd7fa46383883916e803c71c8f0bb71abd8eed0ba760a9580511de3d/airtight-0.2.0.tar.gz" } ] }