{ "info": { "author": "David Link", "author_email": "dvlink@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python :: 2.7", "Topic :: Database", "Topic :: Software Development :: Libraries" ], "description": "Python Application Development - Core Library Classes\n\nDeveloped over a period of time to address reoccurring requirements for most all applications. It provides the following modules:\n\nSee Pydocs: http://crowfly.net/pydocs/vlib\n\n## Modules\n\n * Configuration File Support\n\n * Database Support\n\n * DataTable Support (an ORM Lite)\n\n * Logging Support (with email Support)\n\n * Object-like (dot) syntax for Dictionaries\n\n * Utilities\n\n## Details\n\n### Configuration Module\n\n\nThe configuration module reads yaml files and provides a dot syntax for expressing nested data trees. ie. self.conf.database.hostname.\n \n Usage:\n \n # To create a singleton instance of configuration data\n # found in a yaml file pointed to by an environment\n # variable called VCONF\n #\n # eq.:\n # $ export VCONF=$HOME/proj/conf/dev.yml\n\n from vlib import conf\n myconf = conf.getInstance()\n\n # Print configuration data, from a Yaml file that looks\n # like this:\n #\n # crew:\n # captian: Kirk\n # science_officer: Spock\n\n print myconf.crew.captian\n\n # Real world example with Objects\n \n from vlib import conf\n class Foo(object):\n def __init__(self):\n self.conf = conf.getInstance()\n self.webserver = self.conf.webserver\n self.dbname = self.conf.db.name\n ...\n### Database Module\n\nThe database modules provides a simple set of methods for talking to your database, like query(), startTransaction(), commit(), etc.\n\n Usage:\n\n # To setup the Db instance, you need to define the following\n # in your config file pointed to by the VCONF environement var.\n # The db module uses the conf module to read this information\n #\n # database:\n # engine: mysql\n # host: localhost\n # db: vlibtests\n # user: vlibtests\n # passwd: bogangles\n \n from vlib import db\n mydb = db.getInstance()\n \n for row in mydb.query('select * from product_types'):\n print row['product_type_id']\n print row['name']\n \n # Without using config\n # --------------------\n \n from vlib import Db\n mydb = Db({'engine':'mysql', \n 'host':'db1', \n 'db':'books', \n 'user':'bookmgr', \n 'passwd':'mepassword', \n 'dictcursor':True })\n \n \n # Real world example with Objects\n # -------------------------------\n \n from vlib import db\n\n class Books(object):\n\n def __init__(self):\n self.db = db.getInstance()\n\n def getBook(self, book_id):\n sql = 'select * from books where book_id = %s' % book_id\n results = self.db.query(sql)\n if results:\n return results[0]\n return []\n \n \n # Connecting to multiple databases\n # --------------------------------\n\n # Define additional database connections in the config\n # ro_database:\n # engine: mysql\n # host: localhost\n # db: vlibtests\n # user: vlibtests_ro\n # passwd: bogangles\n \n # __ ro/db.py __\n from vlib import conf\n from vlib.db import singletonFactory\n \n def getInstance():\n conf_ = conf.getInstance()\n return singletonFactory.create(**conf_.ro_database)\n \n # __ myprog.py __\n import ro.db as rodb\n my_rodb = rodb.getInstance()\n print my_rodb.query('select * from customers')\n\n### DataTable Module\n\nThe DataTable module provides a simple abstraction for creating and executing SQL Statements. It relies on the Database Module for connection.\n\n Usage:\n\n from vlib import db\n from vlib.datatable import DataTable\n\n mydb = db.getInstance()\n\n books = DataTable(mydb, 'books')\n books.setColumns(['book_id as book_id', 'title'])\n books.setFilters(\"created > '2015-05-01'\");\n for book in books.getTable():\n print book\n\n Usage as a base class:\n\n from vlib import db\n from vlib.datatable import DataTable\n\n class Books(DataTable):\n\n def __init__(self):\n sellf.db = db.getInstance()\n DataTable.__init__(self, self.db, 'books')\n\n def report(self):\n self.setColumns(['created',\n 'count(*) as books'])\n self.setFilters('created > \"2000-01-01\"')\n self.setGroupBy(1)\n return self.getTable()\n\n See, Also:\n [DataTable Pydocs](http://crowfly.net/pydocs/vlib/datatable.html)\n\n### Logging Module\n\nThe logging module uses log4r to produce consistent log entries that include date, hostname, and class name.\n\n Usage:\n\n # To setup a Logging instance, you define the following in your\n # config file. The logging module uses the conf module to read it.\n #\n # logging:\n # filename: /var/log/myapp/myapp.log\n # level: DEBUG\n \n # If you want the logger to email you on 'critical' you need \n # define email server\n #\n # email: \n # server : smtp.gmail.com:587 \n # username: mailerbot@mycompany.com \n # password: secret \n # fromaddr: Myapp Admin mailerbot@mycompany.com \n \n from vlib import logger\n \n class MyClass:\n \n def __init__(self):\n self.logger = logger.getLogger(self.__class__.__name__)\n \n def do_something(self):\n self.logger.debug('Started doing something')\n self.logger.info('Did Something')\n self.logger.warn('Warning')\n self.logger.error('Did not do something')\n \n # The following we send email: \n # self.logger.critical('Something bad happened') \n \n MyClass().do_something()\n\nThe above outputs to the log:\n\n 2014-02-24 14:41:30\tdev1.localdomain\tDEBUG\tMyClass\tStarted MyClass.do_something()\n 2014-02-24 14:41:30\tdev1.localdomain\tINFO\tMyClass\tDid Something\n 2014-02-24 14:41:30\tdev1.localdomain\tWARNING\tMyClass\tWarning\n 2014-02-24 14:41:30\tdev1.localdomain\tERROR\tMyClass\tDid not do something\n\n\n### Object Dictionary\n\nThe **odict** class is syntactic sugar for dealing with dictionaries and nested dictionaries. It privides dot (.) sytax, as well as flower brace ({}) and squre braces ([]) syntax\n\n attr['color'] = 'blue' # normal dict\n\n attr.color = 'blue' # odict\n\nExample 1: This code using dicts \u2026\n\n picture = {'name' : 'The Card Players',\n 'filename': 'cezanne2.jpg',\n 'year' : 1895}\n print img(src=picture['filename'])\n\nCan be written like this:\n\n from vlib.odict import odict\n picture = odict(name = 'The Card Players',\n filename = 'cezanne2.jpg',\n year = 1895)\n print img(src=picture.filename)\n\n\nNested Odicts Example:\n\n from vlib.odict import odict\n workflow = odict(processes=odict(max_processes=5, debug=False))\n for p in workflow.processes.max_processes:\n startHandler(workflow.processes.debug)\n\n### Utilities\n\n pretty(X):\n Return X formated nicely for the console\n\n str2datetime(s, format=\"%Y-%m-%d %H:%M:%S\"):\n Convert str in the form of \"2010-11-11 17:39:52\" or\n \"2010-11-11\" to a\n datetime.datetime Object\n\n str2date(s):\n Convert str in the form of \"2010-11-11\" to a\n datetime.date Object\n\n format_datetime(d, with_seconds=False, format=None):\n Given a datetime object\n Return formated String as follows:\n\n Format: None : 11/22/2013 01:46[:00] am\n ISO8601: 2013-11-21T01:46:00-05:00 (EST)\n\n format_date(d):\n Given a datetime object\n Return a string in the form of \"mm/dd/yyyy\"\n\n table2csv(data):\n Give a LIST or TUPLE\n Return: A CSV table as STRING or the input data if not LIST or TUPLE\n\n list2csv(data):\n Given a Table of data as a LIST of LISTs\n Return in CSV format as a STR\n\n formatdict(d, width=console_width(), indent=0, keylen=0, color=False):\n Recursively format contents of dictionaries in sorted tabular order.\n Optionally a certain width, indented, and/or a specific key length.\n\n >>> utils.formatdict(batch_item)\n active: 1\n batch_id: 3250\n on_press: None\n order_id: 2007372\n page_list: None\n qty: 2\n removed_date: None\n\n uniqueId(with_millisec=False):\n Return system time to the millisec as set of numbers\n\n shift(alist):\n shift the firt element off of an array and return it\n\n valid_email(email):\n Given an email address\n Return whether it is in valid format as BOOLEAN\n\n\n\n## Installation\n\n__Ubuntu__\n\nUpdate apt-get to the latest libraries:\n\n apt-get update\n\nInstall pip, if you haven't done so already:\n\n apt-get install python-pip\n pip install -U pip\n\nInstall Mysql DB Connectorm, if you haven't done so already:\n\n apt-get install python-dev libmysqlclient-dev\n pip install MySQL-python\n\nInstall vweb:\n\n pip install vlib\n\n__Red Hat__\n\n yum install MySQL-python", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dlink/vlib", "keywords": "database,logging,config,orm,odict", "license": "GNU General Public License (GPL)", "maintainer": "", "maintainer_email": "", "name": "vlib", "package_url": "https://pypi.org/project/vlib/", "platform": "", "project_url": "https://pypi.org/project/vlib/", "project_urls": { "Homepage": "https://github.com/dlink/vlib" }, "release_url": "https://pypi.org/project/vlib/1.3.2/", "requires_dist": null, "requires_python": "", "summary": "vlib core libraries", "version": "1.3.2" }, "last_serial": 3243438, "releases": { "0.10": [ { "comment_text": "", "digests": { "md5": "53cacb74c141e0e5b9034ed02d54117b", "sha256": "2b04da591e2ce6e9d3a8a366ac90e10290cb5202d8dc9c90beff01814bb5bbfe" }, "downloads": -1, "filename": "vlib-0.10.tar.gz", "has_sig": false, "md5_digest": "53cacb74c141e0e5b9034ed02d54117b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20910, "upload_time": "2014-12-18T15:04:53", "url": "https://files.pythonhosted.org/packages/c6/70/ccadc622747af3023f7d2fa5d7fcfbfec37869a4872c639a7f948c58984a/vlib-0.10.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "83be898be15f3f937a585b0f98fd1cc3", "sha256": "f936293bf847d93dd289a0f29b52f620bfd8ac8d500dd866f85e979b4851ede1" }, "downloads": -1, "filename": "vlib-0.11.tar.gz", "has_sig": false, "md5_digest": "83be898be15f3f937a585b0f98fd1cc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22624, "upload_time": "2015-05-31T23:23:21", "url": "https://files.pythonhosted.org/packages/83/f2/6350f9d6d3c590545619970551c861b2ea28e8eb26c84d4930e562e695b7/vlib-0.11.tar.gz" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "48d7ffa130013a4d01c8ae4813351ac4", "sha256": "c073965e73de3202af18d06cf3cb60fe60d28c09e9c857bca7bd6857b05763ab" }, "downloads": -1, "filename": "vlib-0.12.tar.gz", "has_sig": false, "md5_digest": "48d7ffa130013a4d01c8ae4813351ac4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22621, "upload_time": "2015-06-20T02:06:54", "url": "https://files.pythonhosted.org/packages/48/74/88458a731a86c6767f73ede22f7efc14c1dc31db60672d947149a8a8963b/vlib-0.12.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "45a6f57460006ddff1942aa5adc95d74", "sha256": "ddcf0c0370eca02fabd20dc1ae1a8d942c658bb970960974a4467b7ab233ef40" }, "downloads": -1, "filename": "vlib-0.4.tar.gz", "has_sig": false, "md5_digest": "45a6f57460006ddff1942aa5adc95d74", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16741, "upload_time": "2014-09-17T20:56:59", "url": "https://files.pythonhosted.org/packages/38/1a/a9ce7b689b839fe91dc1da354edb2eaa16830b717f58e0d41cc2a2265d2b/vlib-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "47f6cd9ef247540890cbdaf01656d5cf", "sha256": "f69f461136c999c253ec3ac38646a7105a8da80bf4bdaa2426f2ab588ef1e006" }, "downloads": -1, "filename": "vlib-0.5.tar.gz", "has_sig": false, "md5_digest": "47f6cd9ef247540890cbdaf01656d5cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17778, "upload_time": "2014-10-11T02:36:57", "url": "https://files.pythonhosted.org/packages/9e/13/66d1f1a9805389dfa2a7c1fb08a52c86a48e8ef3ab7e1bbe2a9dce7e4716/vlib-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "4e24c2c9c42f3f1e610062fd72b6778e", "sha256": "632e6fe1cd37cd3f0d676c3f4b602073f90401416e59eeb143394028ee32a095" }, "downloads": -1, "filename": "vlib-0.6.tar.gz", "has_sig": false, "md5_digest": "4e24c2c9c42f3f1e610062fd72b6778e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17844, "upload_time": "2014-10-11T14:57:15", "url": "https://files.pythonhosted.org/packages/04/de/8047a5bdded55d55dfc425582b2cfa8841ac2aba9c2456f816ea36075824/vlib-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "e17ff8d04447448df1461c3c9368b477", "sha256": "83fcded3ef8ac370513c08286613460106a6406f1a9716bb06bac4a739294e66" }, "downloads": -1, "filename": "vlib-0.7.tar.gz", "has_sig": false, "md5_digest": "e17ff8d04447448df1461c3c9368b477", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17838, "upload_time": "2014-10-11T16:23:01", "url": "https://files.pythonhosted.org/packages/cf/c0/5443cf86a2d4092590e86fa88017ee99575b9d6c46e615cc4f18bb035074/vlib-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "02b91cfc61b6cefb9c2456dfde598a0d", "sha256": "6273559b7958c5413c0baf3a35ddbfce6557a63a934a7f83186a6d841a055d44" }, "downloads": -1, "filename": "vlib-0.8.tar.gz", "has_sig": false, "md5_digest": "02b91cfc61b6cefb9c2456dfde598a0d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20743, "upload_time": "2014-11-03T20:09:27", "url": "https://files.pythonhosted.org/packages/2a/ff/8cafe667eb152a74b7f1d2b6fc69191af64b5c62d6e65eb94e976f73f877/vlib-0.8.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "1a1a2c001b04f7d2dd43dbc33dad3d55", "sha256": "128faf94ee68046ae5cf1bd6c343a77919d8c4498e40eceb26973041945d7a54" }, "downloads": -1, "filename": "vlib-0.9.tar.gz", "has_sig": false, "md5_digest": "1a1a2c001b04f7d2dd43dbc33dad3d55", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20850, "upload_time": "2014-11-05T16:38:55", "url": "https://files.pythonhosted.org/packages/0e/a1/389010c4b40f9ae175ea2bbb57bf33b69fc4e0bde6fd662ce4f19ba8d424/vlib-0.9.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "1620e1680d25339c26ef57d07adf39a5", "sha256": "fb02d35e387044d905a3465e31467df5b67273db0c890fab11e94f69a87f43d9" }, "downloads": -1, "filename": "vlib-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1620e1680d25339c26ef57d07adf39a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23422, "upload_time": "2015-08-07T20:38:43", "url": "https://files.pythonhosted.org/packages/d4/23/03b64abb66d18ca2238d63612e2590d1b26c5afa8117df00be24a8dabc6a/vlib-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2690a19b79cc4621852474760ee137c2", "sha256": "6845b109fdfe08403b92e23c96fd9dcffe1a8f689b705afa94802e3670218313" }, "downloads": -1, "filename": "vlib-1.1.0.tar.gz", "has_sig": false, "md5_digest": "2690a19b79cc4621852474760ee137c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23961, "upload_time": "2015-09-15T20:25:25", "url": "https://files.pythonhosted.org/packages/a3/59/b69e715372572ffa32dbae5625e81c45224ebf2fb233051282e4647becb3/vlib-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "aff0b4b68c153c1edc29a3c7bba5e43f", "sha256": "9a923ef6a8ccc2ef2d3d91f491cd7b90be8f44768743e088c9ef36a970751ced" }, "downloads": -1, "filename": "vlib-1.2.0.tar.gz", "has_sig": false, "md5_digest": "aff0b4b68c153c1edc29a3c7bba5e43f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25914, "upload_time": "2015-11-15T19:10:45", "url": "https://files.pythonhosted.org/packages/f2/d3/a9d42df34dd822ee402f8d4d2c7e1b924f729996bea0f08c7004e4c02c0e/vlib-1.2.0.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "41acb9a07ea96b9aaab377285370110b", "sha256": "d8fc0ef2d92ef71ed83eccc078fd696db8a1d2be5002a99850529cd70aff7925" }, "downloads": -1, "filename": "vlib-1.2.2.tar.gz", "has_sig": false, "md5_digest": "41acb9a07ea96b9aaab377285370110b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25969, "upload_time": "2016-01-19T18:34:11", "url": "https://files.pythonhosted.org/packages/ae/f8/ca2134929183f11f10748c5298c27aa81248c7a9d0f3deb848b49b1ef292/vlib-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "c46b98b506f7a810e76016b46f80a6d2", "sha256": "19e66dbc35554ce26c7adb4f016291ac3c5417f47dde3adb859b626afe6d18ee" }, "downloads": -1, "filename": "vlib-1.2.3.tar.gz", "has_sig": false, "md5_digest": "c46b98b506f7a810e76016b46f80a6d2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 26011, "upload_time": "2016-05-02T19:24:23", "url": "https://files.pythonhosted.org/packages/f6/75/83824019a14f60df359869879d5d0a472d743c8e325e371db6e5ce0054f4/vlib-1.2.3.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "d9c1cbffac17b4c539351b0f45bbc953", "sha256": "26908a2f40baa60e3c1b9a48abf1b5bca3a81a2579ccfaa14cd0f3b11bb595df" }, "downloads": -1, "filename": "vlib-1.3.2.tar.gz", "has_sig": false, "md5_digest": "d9c1cbffac17b4c539351b0f45bbc953", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29395, "upload_time": "2017-10-11T21:42:53", "url": "https://files.pythonhosted.org/packages/20/81/f8ced9f2c96350b8b6a79d23ad7c11c18d6bd91b2f24b86ea610489599b9/vlib-1.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9c1cbffac17b4c539351b0f45bbc953", "sha256": "26908a2f40baa60e3c1b9a48abf1b5bca3a81a2579ccfaa14cd0f3b11bb595df" }, "downloads": -1, "filename": "vlib-1.3.2.tar.gz", "has_sig": false, "md5_digest": "d9c1cbffac17b4c539351b0f45bbc953", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29395, "upload_time": "2017-10-11T21:42:53", "url": "https://files.pythonhosted.org/packages/20/81/f8ced9f2c96350b8b6a79d23ad7c11c18d6bd91b2f24b86ea610489599b9/vlib-1.3.2.tar.gz" } ] }