{ "info": { "author": "Alice Bevan-McGregor", "author_email": "alice@gothcandy.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "======\nweb.db\n======\n\n \u00a9 2009-2019 Alice Bevan-McGregor and contributors.\n\n..\n\n https://github.com/marrow/web.db\n\n..\n\n |latestversion| |ghtag| |masterstatus| |mastercover| |masterreq| |ghwatch| |ghstar|\n\n\n\nIntroduction\n============\n\nDatabase access is often central to any web application or service. To offer the maximum flexibility, the `WebCore web\nframework `__ uses a light-weight yet highly modular and fully dependency graphed\nextension system. The database connection layer passes through the full capability of this extension system down to an\norganized and named collection of database interfaces.\n\nThis extension is available with the name ``db`` in the ``web.ext`` plugin namespace.\n\nThis extension adds a ``db`` server and request **context attribute**.\n\nThis extension provides the ``sqlalchemy``, ``mongoengine``, ``dbapi``, and ``sqlite3`` plugins in the ``web.db``\nplugin namespace.\n\n\nInstallation\n============\n\nInstalling ``web.db`` is easy, just execute the following in a terminal::\n\n pip install web.db\n\n**Note:** We *strongly* recommend always using a container, virtualization, or sandboxing environment of some kind when\ndeveloping using Python; installing things system-wide is yucky (for a variety of reasons) nine times out of ten. We\nprefer light-weight `virtualenv `__, others prefer solutions as\nrobust as `Vagrant `__.\n\nIf you add ``web.db`` to the ``install_requires`` argument of the call to ``setup()`` in your\napplication's ``setup.py`` file, this extension will be automatically installed and made available when your own\napplication or library is installed. We recommend using \"less than\" version numbers to ensure there are no\nunintentional side-effects when updating. Use ``web.db<2.1` to get all bugfixes for the current release,\nand ``web.db<3.0`` to get bugfixes and feature updates while ensuring that large breaking changes are not\ninstalled.\n\nThere are a few \"extras\" you can require (by adding a comma separated list of these tags within square brackets after\nthe dependency name, e.g.: ``web.db[foo,bar]``\n\n* **development** - installs all testing requirements and optional components\n* **sql** - installs `SQLAlchemy `__\n* **mongoengine** - installs `MongoEngine `__ (**Note:** this engine is not yet production quality.)\n\n\nDevelopment Version\n-------------------\n\n |developstatus| |developcover| |ghsince| |issuecount| |ghfork|\n\nDevelopment takes place on `GitHub `__ in the \n`web.db `__ project. Issue tracking, documentation, and\ndownloads are provided there.\n\nInstalling the current development version requires `Git `__, a distributed source code management\nsystem. If you have Git you can run the following to download and *link* the development version into your Python\nruntime::\n\n git clone https://github.com/marrow/web.db.git\n pip install -e 'web.db[development]'\n\nYou can then upgrade to the latest version at any time::\n\n (cd web.db; git pull; pip install -U -e '.[development]')\n\nIf you would like to make changes and contribute them back to the project, fork the GitHub project, make your changes,\nand submit a pull request. This process is beyond the scope of this documentation; for more information see\n`GitHub's documentation `__.\n\n\nUsage\n=====\n\nThe ``web.db`` extension (providing the ``db`` feature flag for extension dependency graphing and plugin with that\nname in the ``web.ext`` namespace) is utilized in a few different contexts.\n\n\nConfiguration\n-------------\n\nThis happens before the web application has \"started\" and is ready to service requests. You enable the extension by\nincluding an instance of it in the ``extensions`` argument to the instantiation of a ``web.core:Application`` object::\n\n from web.ext.db import DatabaseExtension\n\n app = Application(\"Hi.\", extensions=[\n DatabaseExtension(),\n ])\n\nThe initializer for the database extension uses the arguments provided to declare named database interfaces, which you\ninstantiate and pass in by name. Additionally, the name ``default`` has special meaning, and may be passed as the\nfirst (and only) positional parameter.\n\n\nApplication\n-----------\n\nAt the application context, that is, in extension callbacks where the ``context`` is an ApplicationContext object,\noutside of the request cycle, a ``db`` attribute is added to contain any contributions made by database adapters.\n\nPlease refer to the documentation for individual adapters as to what values they assign for themselves and when.\n\n\nAdapters\n========\n\nThere is a limited set of adapters provided built-in.\n\n\nNative DB API 2.0\n-----------------\n\nMany SQL or SQL-like database adapters in Python are available which expose a `PEP 249 DB API\n2.0 `__-compliant interface. These can be utilized directly once a few\nproperties of the adapter are known.\n\nFirst, you need to know the location of the adapter's ``connect`` function. Pass this as the first positional\nargument to the ``DBAPIConnection`` constructor as a string in dot-colon notation. The second positional argument\nis the URI to pass through as the target to connect the engine to. Behaviour may vary from adapter to adapter.\n\nAs an example, Python often ships with an adapter for SQLite. You might utilize it by initializing your application\nwith this extension arrangement::\n\n from web.ext.db import DatabaseExtension\n from web.db.dbapi import DBAPIConnection\n\n app = Application(\"Hi.\", extensions=[\n DatabaseExtension(DBAPIConnection(\n 'sqlite3:connect', # A dot-colon path, module:name.\n ':memory:', # Use the in-memory temporary store.\n ))\n ])\n\nBecause this engine is built-in and common, a shortcut is provided by way of the ``SQLite3Connection`` subclass::\n\n from web.ext.db import DatabaseExtension\n from web.db.dbapi import SQLite3Connection\n\n app = Application(\"Hi.\", extensions=[\n DatabaseExtension(SQLite3Connection(':memory:'))\n ])\n\nEither way, additional keyword arguments are passed along through to the underlying ``connect`` function. For the\ngeneric adapter, two additional arguments have a significant impact on when the interface performs actions.\n\nIf ``safe`` is truthy (the default) then the adapter is treated as thread safe. It is \"connected\" on application start\nand \"disconnected\" on application shutdown. Otherwise the interface is \"connected\" at the beginning of a request and\n\"disconnected\" at the end of the request, after all content has been returned to the user.\n\n\nMongoDB\n-------\n\nAn adapter is provided for plain MongoDB connections, as provided by the\n`pymongo `__ package. Extended capabilities are provided beyond a typical\n``MongoClient`` connection, and the database with its collection attributes are exposed via the ``context.db``\nattribute.\n\nTo get started, you need a URL to connect to, and need to construct a ``MongoDBConnection`` instance to pass to\nthe ``DatabaseExtension`` during application configuration::\n\n from web.ext.db import DatabaseExtesion\n from web.db.mongo import MongoDBConnection\n\n app = Application(\"Hi.\", extensions=[\n DatabaseExtension(MongoDBConnection('mongodb://localhost/test'))\n ])\n\nWith a confguration like this, attributes of ``context.db`` will represent pymongo ``Collection`` instances.\n\n\n\n\n\nSQLAlchemy\n----------\n\nDuring startup, you can utilize the SQLAlchemy engine object contained within the context to perform global-level\noperations such as DDL manipulation. One such example with an SQLAlchemy adapter configured as the defualt interface\nwould be::\n\n class ApplicationExtension:\n needs = {'db'}\n\n def start(self, context):\n SomeDeclarativeBase.metadata.create_all(context.db.default)\n\nWithin the context of a request, the interface exposed via the context is a request-local scoped session. You can use\nthis to prepare and commit transactions, issue queries, etc.\n\nCurrently no transactional behaviour, auto-commit, etc. are supported.\n\n\nExtending\n=========\n\nWriting new adapters is nearly identical to writing WebCore extensions. All of the same rules apply: must be a class,\noffers callback registration through the use of named methods, can register ``needs`` and ``uses`` and ``provides``,\netc. Please see the `WebCore `__ documentation and examples.\n\nThe only major difference is that the database interface is expected to populate an attribute or mapping item with a\nname defined by an ``alias`` attribute. Several examples are provided in the source, and are documented so as to\nprovide examples.\n\n\nVersion History\n===============\n\nVersion 3.0\n-----------\n\n* **Updated minimum Python version.** Marrow Package now requires Python 3.6 or later.\n\n* **Removed Python 2 support and version specific code.** The project has been updated to modern Python packaging standards, including modern namespace use. Modern namespaces are wholly incompatible with the previous namespacing mechanism; this project can not be simultaneously installed with any Marrow project that is Python 2 compatible.\n\n\nVersion 2.0.1\n-------------\n\n* Updated the ``README`` and metaproject layout to current Marrow standards.\n* Removed extraneous imports and slots where unhelpful or causing issues, such as in the SQLAlchemy adapter. (Thanks\n bmillham!)\n* Migrated ``MongoDBConnection`` from `marrow.mongo `__.\n\nVersion 2.0\n-----------\n\n* Extract of the database mechanism from WebCore.\n\nVersion 1.x\n-----------\n\n* Process fully integrated in the WebCore web framework.\n\n\nLicense\n=======\n\nweb.db has been released under the MIT Open Source license.\n\nThe MIT License\n---------------\n\nCopyright \u00a9 2009-2019 Alice Bevan-McGregor and contributors.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated\ndocumentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit\npersons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the\nSoftware.\n\nTHE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\nWARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\nOTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n.. |ghwatch| image:: https://img.shields.io/github/watchers/marrow/web.db.svg?style=social&label=Watch\n :target: https://github.com/marrow/web.db/subscription\n :alt: Subscribe to project activity on Github.\n\n.. |ghstar| image:: https://img.shields.io/github/stars/marrow/web.db.svg?style=social&label=Star\n :target: https://github.com/marrow/web.db/subscription\n :alt: Star this project on Github.\n\n.. |ghfork| image:: https://img.shields.io/github/forks/marrow/web.db.svg?style=social&label=Fork\n :target: https://github.com/marrow/web.db/fork\n :alt: Fork this project on Github.\n\n.. |masterstatus| image:: http://img.shields.io/travis/marrow/web.db/master.svg?style=flat\n :target: https://travis-ci.org/marrow/web.db/branches\n :alt: Release build status.\n\n.. |mastercover| image:: http://img.shields.io/codecov/c/github/marrow/web.db/master.svg?style=flat\n :target: https://codecov.io/github/marrow/web.db?branch=master\n :alt: Release test coverage.\n\n.. |masterreq| image:: https://img.shields.io/requires/github/marrow/web.db.svg\n :target: https://requires.io/github/marrow/web.db/requirements/?branch=master\n :alt: Status of release dependencies.\n\n.. |developstatus| image:: http://img.shields.io/travis/marrow/web.db/develop.svg?style=flat\n :target: https://travis-ci.org/marrow/web.db/branches\n :alt: Development build status.\n\n.. |developcover| image:: http://img.shields.io/codecov/c/github/marrow/web.db/develop.svg?style=flat\n :target: https://codecov.io/github/marrow/web.db?branch=develop\n :alt: Development test coverage.\n\n.. |developreq| image:: https://img.shields.io/requires/github/marrow/web.db.svg\n :target: https://requires.io/github/marrow/web.db/requirements/?branch=develop\n :alt: Status of development dependencies.\n\n.. |issuecount| image:: http://img.shields.io/github/issues-raw/marrow/web.db.svg?style=flat\n :target: https://github.com/marrow/web.db/issues\n :alt: Github Issues\n\n.. |ghsince| image:: https://img.shields.io/github/commits-since/marrow/web.db/2.0.1.svg\n :target: https://github.com/marrow/web.db/commits/develop\n :alt: Changes since last release.\n\n.. |ghtag| image:: https://img.shields.io/github/tag/marrow/web.db.svg\n :target: https://github.com/marrow/web.db/tree/2.0.1\n :alt: Latest Github tagged release.\n\n.. |latestversion| image:: http://img.shields.io/pypi/v/web.db.svg?style=flat\n :target: https://pypi.python.org/pypi/web.db\n :alt: Latest released version.\n\n.. |downloads| image:: http://img.shields.io/pypi/dw/web.db.svg?style=flat\n :target: https://pypi.python.org/pypi/web.db\n :alt: Downloads per week.\n\n.. |cake| image:: http://img.shields.io/badge/cake-lie-1b87fb.svg?style=flat\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/marrow/web.db/releases", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marrow/web.db", "keywords": "marrow,web.ext,web.db,WebCore,database connector", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "web.db", "package_url": "https://pypi.org/project/web.db/", "platform": "", "project_url": "https://pypi.org/project/web.db/", "project_urls": { "Documentation": "https://github.com/marrow/web.db/#readme", "Download": "https://github.com/marrow/web.db/releases", "Funding": "https://www.patreon.com/GothAlice", "Homepage": "https://github.com/marrow/web.db", "Issue Tracker": "https://github.com/marrow/web.db/issues", "Repository": "https://github.com/marrow/web.db/" }, "release_url": "https://pypi.org/project/web.db/3.0.0/", "requires_dist": [ "marrow.package (~=2.0.0)", "WebCore (~=3.0.0)", "pytest ; extra == 'development'", "pytest-cov ; extra == 'development'", "pytest-flakes ; extra == 'development'", "pymongo ; extra == 'development'", "mongoengine ; extra == 'development'", "sqlalchemy ; extra == 'development'", "pre-commit ; extra == 'development'" ], "requires_python": "", "summary": "General database adapter layer for common configuration and operation.", "version": "3.0.0" }, "last_serial": 5382649, "releases": { "2.0.0": [ { "comment_text": "", "digests": { "md5": "ee93131434416362bf924a7bb2f6eadc", "sha256": "59e5b403af68c071edcaaae647cd66d2e999a13213b9a7bcdb05ce37da0e1423" }, "downloads": -1, "filename": "web.db-2.0.0-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "ee93131434416362bf924a7bb2f6eadc", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 25843, "upload_time": "2016-09-29T02:59:47", "url": "https://files.pythonhosted.org/packages/4b/f9/1232d94a163a63a1125805801dd026a23af65fc02104445ce48fe679e5f3/web.db-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ccf3f671f6200eeb9bba1a48d8f060a6", "sha256": "6ce950e0da4f1f9bbd450445aab90d8b54e8ad7183979f2ef8db34193ccd688c" }, "downloads": -1, "filename": "web.db-2.0.0.tar.gz", "has_sig": true, "md5_digest": "ccf3f671f6200eeb9bba1a48d8f060a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17265, "upload_time": "2016-09-29T02:59:44", "url": "https://files.pythonhosted.org/packages/7a/5a/1ce1ef6011d5a168819cad1cba299bfe500b49b9d97d06b1590b6d19e5cc/web.db-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "0a1388c8f0ef4b4352d7fa1f3e11ec8f", "sha256": "38d71373b51b323867ee955e0ff9dff6b7b43263cc78415a17386a52e3f35d1c" }, "downloads": -1, "filename": "web.db-2.0.1-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "0a1388c8f0ef4b4352d7fa1f3e11ec8f", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 31260, "upload_time": "2016-11-04T03:22:20", "url": "https://files.pythonhosted.org/packages/20/e0/28fcdb40ca1f0341f9cd393ef8ab87b38598b7e1c3038c43f02aa273c075/web.db-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "73608fa36075a1037c733cee37161120", "sha256": "e98a77bfa654ccfaa271d74b5e00dffbc0adde2094d8327dd1a3d4df7646959f" }, "downloads": -1, "filename": "web.db-2.0.1.tar.gz", "has_sig": true, "md5_digest": "73608fa36075a1037c733cee37161120", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20966, "upload_time": "2016-11-04T03:22:16", "url": "https://files.pythonhosted.org/packages/e0/1a/c3213d7f99d4ffa42afd93179573b9ea4eedc3fb743bec6c3bd8737eba75/web.db-2.0.1.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "9501a7783fbd398bda66d386214e8981", "sha256": "520b78dc15986f6ef8d59ddf366e7b9b2c6b773ec9995c00646eb12a6e4d1267" }, "downloads": -1, "filename": "web.db-3.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9501a7783fbd398bda66d386214e8981", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20469, "upload_time": "2019-06-10T17:16:47", "url": "https://files.pythonhosted.org/packages/45/56/836a3d105e63aa8bf34d5990d5dda739773a62ec3caeb742a28caf7560b1/web.db-3.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cebdbfd5f6ba8e4d40f5a0966fd5ec60", "sha256": "63d6bab4668c0f3b36227d0b30db70c04b12a3cda59e329e57632f483e47f98d" }, "downloads": -1, "filename": "web.db-3.0.0.tar.gz", "has_sig": false, "md5_digest": "cebdbfd5f6ba8e4d40f5a0966fd5ec60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18356, "upload_time": "2019-06-10T17:17:10", "url": "https://files.pythonhosted.org/packages/52/a3/5be53287fa90ca4076f88adedcc243f4000256a312386026aa4b17b3b4c3/web.db-3.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9501a7783fbd398bda66d386214e8981", "sha256": "520b78dc15986f6ef8d59ddf366e7b9b2c6b773ec9995c00646eb12a6e4d1267" }, "downloads": -1, "filename": "web.db-3.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9501a7783fbd398bda66d386214e8981", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 20469, "upload_time": "2019-06-10T17:16:47", "url": "https://files.pythonhosted.org/packages/45/56/836a3d105e63aa8bf34d5990d5dda739773a62ec3caeb742a28caf7560b1/web.db-3.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cebdbfd5f6ba8e4d40f5a0966fd5ec60", "sha256": "63d6bab4668c0f3b36227d0b30db70c04b12a3cda59e329e57632f483e47f98d" }, "downloads": -1, "filename": "web.db-3.0.0.tar.gz", "has_sig": false, "md5_digest": "cebdbfd5f6ba8e4d40f5a0966fd5ec60", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18356, "upload_time": "2019-06-10T17:17:10", "url": "https://files.pythonhosted.org/packages/52/a3/5be53287fa90ca4076f88adedcc243f4000256a312386026aa4b17b3b4c3/web.db-3.0.0.tar.gz" } ] }