Name | pyramid-basemodel JSON |
Version |
0.6.3
JSON |
| download |
home_page | None |
Summary | pyramid_basemodel - a thin, low level SQLAlchemy bindings to pyramid |
upload_time | 2024-10-14 10:59:46 |
maintainer | None |
docs_url | None |
author | James Arthur |
requires_python | >=3.9 |
license | This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> |
keywords |
pyramid
sqlalchemy
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
pyramid_basemodel
=================
**pyramid_basemodel** is a thin, low level package that provides an SQLAlchemy
declarative `Base` and a thread local scoped `Session` that can be used by
different packages whilst only needing to be bound to a db engine once.
Usage
-----
You can use these as base classes for declarative model definitions, e.g.:
.. code-block:: python
from pyramid_basemodel import Base, BaseMixin, Session, save
class MyModel(Base, BaseMixin):
"""Example model class."""
@classmethod
def do_foo(cls):
instance = Session.query(cls).first()
save(instance)
You can then bind these to the `sqlalchemy.url` in your paster `.ini` config by
importing your model and this package, e.g.:
.. code-block:: python
# for example in yourapp.__init__.py
import mymodel
def main(global_config, **settings):
config = Configurator(settings=settings)
config.include('pyramid_basemodel')
config.include('pyramid_tm')
return config.make_wsgi_app()
Or if this is all too much voodoo, you can just use the `bind_engine` function::
.. code-block:: python
from pyramid_basemodel import bind_engine
from mypackage import mymodel
# assuming `engine` is a bound SQLAlchemy engine.
bind_engine(engine)
Note that the `Session` is designed to be used in tandem with [pyramid_tm][].
If you don't include `pyramid_tm`, you'll need to take care of committing
transactions yourself.
Tests
-----
To run the tests use:
.. code-block::
py.test -v --cov pyramid_basemodel tests/
[pyramid_basemodel]: http://github.com/fizyk/pyramid_basemodel
[pyramid_simpleauth]: http://github.com/thruflo/pyramid_simpleauth
[pyramid_tm]: http://pyramid_tm.readthedocs.org
Release
=======
Install pipenv and --dev dependencies first, Then run:
.. code-block::
pipenv run tbump [NEW_VERSION]
Raw data
{
"_id": null,
"home_page": null,
"name": "pyramid-basemodel",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Grzegorz \u015aliwi\u0144ski <fizyk+pypi@fizyk.dev>",
"keywords": "pyramid, sqlalchemy",
"author": "James Arthur",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/df/43/64063d9847e0172f44b3bb607e00a24e2f3d14fdb8458ab52398d23fc6e6/pyramid_basemodel-0.6.3.tar.gz",
"platform": null,
"description": "pyramid_basemodel\n=================\n\n**pyramid_basemodel** is a thin, low level package that provides an SQLAlchemy\ndeclarative `Base` and a thread local scoped `Session` that can be used by\ndifferent packages whilst only needing to be bound to a db engine once.\n\nUsage\n-----\n\nYou can use these as base classes for declarative model definitions, e.g.:\n\n.. code-block:: python\n\n from pyramid_basemodel import Base, BaseMixin, Session, save\n\n class MyModel(Base, BaseMixin):\n \"\"\"Example model class.\"\"\"\n\n @classmethod\n def do_foo(cls):\n instance = Session.query(cls).first()\n save(instance)\n\n\nYou can then bind these to the `sqlalchemy.url` in your paster `.ini` config by\nimporting your model and this package, e.g.:\n\n.. code-block:: python\n\n # for example in yourapp.__init__.py\n import mymodel\n \n def main(global_config, **settings):\n config = Configurator(settings=settings)\n config.include('pyramid_basemodel')\n config.include('pyramid_tm')\n return config.make_wsgi_app()\n\nOr if this is all too much voodoo, you can just use the `bind_engine` function::\n\n.. code-block:: python\n\n from pyramid_basemodel import bind_engine\n from mypackage import mymodel\n\n # assuming `engine` is a bound SQLAlchemy engine.\n bind_engine(engine)\n\nNote that the `Session` is designed to be used in tandem with [pyramid_tm][].\nIf you don't include `pyramid_tm`, you'll need to take care of committing\ntransactions yourself.\n\nTests\n-----\n\nTo run the tests use:\n\n.. code-block::\n\n py.test -v --cov pyramid_basemodel tests/\n\n[pyramid_basemodel]: http://github.com/fizyk/pyramid_basemodel\n[pyramid_simpleauth]: http://github.com/thruflo/pyramid_simpleauth\n[pyramid_tm]: http://pyramid_tm.readthedocs.org\n\nRelease\n=======\n\nInstall pipenv and --dev dependencies first, Then run:\n\n.. code-block::\n\n pipenv run tbump [NEW_VERSION]\n",
"bugtrack_url": null,
"license": "This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to <http://unlicense.org/> ",
"summary": "pyramid_basemodel - a thin, low level SQLAlchemy bindings to pyramid",
"version": "0.6.3",
"project_urls": {
"Bug Tracker": "https://github.com/fizyk/pyramid_basemodel/issues",
"Changelog": "https://github.com/fizyk/pyramid_basemodel/blob/v0.6.3/CHANGES.rst",
"Source": "https://github.com/fizyk/pyramid_basemodel/"
},
"split_keywords": [
"pyramid",
" sqlalchemy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b5de9ff4eb74320c5bbbb20f477b83f12be875fd44847388d970c1d76f1f3423",
"md5": "faf0ec5f8e012ac2823390369949894f",
"sha256": "c679bf094e95ab4064975e361b32c30dcfc7f39d8864d5ad8052e821d92479b0"
},
"downloads": -1,
"filename": "pyramid_basemodel-0.6.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "faf0ec5f8e012ac2823390369949894f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 15038,
"upload_time": "2024-10-14T10:59:45",
"upload_time_iso_8601": "2024-10-14T10:59:45.409318Z",
"url": "https://files.pythonhosted.org/packages/b5/de/9ff4eb74320c5bbbb20f477b83f12be875fd44847388d970c1d76f1f3423/pyramid_basemodel-0.6.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "df4364063d9847e0172f44b3bb607e00a24e2f3d14fdb8458ab52398d23fc6e6",
"md5": "fd1134bf27edae7e5a5cf31c76f55b03",
"sha256": "610b4e47aa300b00648c19b7e38d39138e00ac1ff9f92f844feccbe599c2d73a"
},
"downloads": -1,
"filename": "pyramid_basemodel-0.6.3.tar.gz",
"has_sig": false,
"md5_digest": "fd1134bf27edae7e5a5cf31c76f55b03",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 17544,
"upload_time": "2024-10-14T10:59:46",
"upload_time_iso_8601": "2024-10-14T10:59:46.693553Z",
"url": "https://files.pythonhosted.org/packages/df/43/64063d9847e0172f44b3bb607e00a24e2f3d14fdb8458ab52398d23fc6e6/pyramid_basemodel-0.6.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-14 10:59:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fizyk",
"github_project": "pyramid_basemodel",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "pyramid-basemodel"
}