{ "info": { "author": "Samuel Herrero Bartolom\u00e9", "author_email": "sherrero@buguroo.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "peewee2click: Easy command-line interfaces for Peewee models\n============================================================\n\n.. image:: https://img.shields.io/pypi/v/peewee2click.svg\n :target: https://pypi.python.org/pypi/peewee2click\n\n.. image:: https://img.shields.io/pypi/pyversions/peewee2click.svg\n :target: https://pypi.python.org/pypi/peewee2click\n\n.. image:: https://travis-ci.org/buguroo/peewee2click.svg?branch=master\n :target: https://travis-ci.org/buguroo/peewee2click\n\npeewee2click is an easy to use Click_ helper to create command-line CRUDL interfaces\nfor your peewee_ models.\n\nWhat are command-line CRUDL interfaces?\n---------------------------------------\n\nInterfaces that let you **Create**, **Read**, **Update**, **Delete** or\n**List** your models via command-line.\n\nInstallation\n------------\n\nJust run ``pip install peewee2click``.\n\nExample of use\n--------------\n\nLet supose you have the following *peewee* class:\n\n.. code-block:: python\n\n import peewee\n\n class MyClass(peewee.Model):\n my_char_field = peewee.CharField(\n max_length=8, help_text=\"Field to store char.\")\n my_int_field = peewee.IntegerField(\n default=5, help_text=\"Field to store int.\")\n\nTo create a very basic command-line CRUDL you only need the following code:\n\n.. code-block:: python\n\n from peewee2click import CRUDL\n import click\n\n @click.command(help=\"Creates a new myclass\")\n @CRUDL.click_options_from_model_fields(MyClass)\n def create(**fields):\n CRUDL.create(MyClass, **fields)\n\n @click.command(help=\"Shows myclass information\")\n @click.argument(\"primary_key\", type=int)\n def show(primary_key):\n CRUDL.show(MyClass, primary_key)\n\n @click.command(help=\"Updates myclass information\")\n @click.argument(\"primary_key\") \n @CRUDL.click_options_from_model_fields(MyClass)\n def update(primary_key, **changed_fields):\n CRUDL.update(MyClass, primary_key, **changed_fields)\n\n @click.command(help=\"Deletes an existing myclass\")\n @click.argument(\"primary_key\")\n def delete(primary_key):\n CRUDL.delete(MyClass, primary_key)\n\n @click.command(\"list\", help=\"Enumerate myclasses\")\n @click.option(\"fields\", \"--add-field\", multiple=True,\n help=\"Shows a custom field in the result\")\n def list_(fields):\n base_fields = ('id', 'my_char_field', 'my_int_field')\n\n CRUDL.list(MyClass, base_fields, extra_fields=fields)\n\nAs you can see, ``CRUDL.click_options_from_model_fields`` gathers all the\nModel fields for you, creating automatically the parameters options\n\"``--my-char-field=``\" and \"``-my-int-field=``\" for the\n`create` and `update` commands.\n\n\nOther commands\n--------------\n\nBesides the ``CRUDL`` methods seen in the example above, `peewee2click` also\nprovides two helper functions: ``one_and_only_one`` and ``max_one``. Both\nprovide a way of checking that arguments are passed in a proper way.\n\nCheck the docstrings of the functions for further information.\n\nRunning the tests\n-----------------\n\nInstall the develop dependencies: ``pip install -e requirements/develop.txt``. Then run ``tox``.\n\nYou will need `sqlite` support in your Python client to run the tests.\n\n\n.. _peewee: http://docs.peewee-orm.com/en/latest/\n.. _Click: http://click.pocoo.org/5/\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/buguroo/peewee2click", "keywords": "peewee click arguments conversor", "license": "LGPLv3", "maintainer": "", "maintainer_email": "", "name": "peewee2click", "package_url": "https://pypi.org/project/peewee2click/", "platform": "", "project_url": "https://pypi.org/project/peewee2click/", "project_urls": { "Homepage": "https://github.com/buguroo/peewee2click" }, "release_url": "https://pypi.org/project/peewee2click/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.0.4" }, "last_serial": 3036858, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "fd39b32ba1e611dec07385faea290584", "sha256": "04b13fcee699f808b7fb202b9e53e5ef2821e00e0cfb1c9b60175ccfb7667e0f" }, "downloads": -1, "filename": "peewee2click-0.0.1.tar.gz", "has_sig": false, "md5_digest": "fd39b32ba1e611dec07385faea290584", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4879, "upload_time": "2017-07-18T09:14:03", "url": "https://files.pythonhosted.org/packages/d3/2d/7132152064f7903f91e141d9287862557bf1f966bd655f9b88ab0a2c602f/peewee2click-0.0.1.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4877678569ae5350bb25b31a1adee4ec", "sha256": "86f6cf1a9d222f4cd5978803fcc67d134e1b8b86e2da729c75e5f669c639f49f" }, "downloads": -1, "filename": "peewee2click-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4877678569ae5350bb25b31a1adee4ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4995, "upload_time": "2017-07-20T09:03:18", "url": "https://files.pythonhosted.org/packages/f7/97/3a1748ab6e99562a8c9b18624300855e486a747317135d494c0bc12bf4b9/peewee2click-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3208721c3bb72ec4f4db7a9eca1f2b87", "sha256": "7f5b5beb426ac1aea41d5fa3852a104bc45f70e2ab1fcf65191b243b248b82ff" }, "downloads": -1, "filename": "peewee2click-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3208721c3bb72ec4f4db7a9eca1f2b87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5191, "upload_time": "2017-07-20T13:28:23", "url": "https://files.pythonhosted.org/packages/e3/e4/8147b6c0d94a40ce93e4e1cbf71b1352b3251a49d8bfc73c9cac27d12d4d/peewee2click-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3208721c3bb72ec4f4db7a9eca1f2b87", "sha256": "7f5b5beb426ac1aea41d5fa3852a104bc45f70e2ab1fcf65191b243b248b82ff" }, "downloads": -1, "filename": "peewee2click-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3208721c3bb72ec4f4db7a9eca1f2b87", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5191, "upload_time": "2017-07-20T13:28:23", "url": "https://files.pythonhosted.org/packages/e3/e4/8147b6c0d94a40ce93e4e1cbf71b1352b3251a49d8bfc73c9cac27d12d4d/peewee2click-0.0.4.tar.gz" } ] }