{ "info": { "author": "XOE Corp. SAS", "author_email": "info@xoe.solutions", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Odoo", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "dodoo\n=====\n\n.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg\n :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html\n :alt: License: LGPL-3\n.. image:: https://badge.fury.io/py/dodoo.svg\n :target: http://badge.fury.io/py/dodoo\n.. image:: https://travis-ci.org/xoe-labs/dodoo.svg?branch=master\n :target: https://travis-ci.org/xoe-labs/dodoo\n.. image:: https://codecov.io/gh/xoe-labs/dodoo/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/xoe-labs/dodoo\n\n``dodoo`` is a beautiful, robust and extensible Odoo server API extension suite\nfor DevOps. It is based on the excellent Click_ library.\n\n.. contents::\n\nQuick start\n~~~~~~~~~~~\n\nInstall it in an environment where Odoo is installed,\n\n pip install dodoo\n\n\nCustom scripts\n~~~~~~~~~~~~~~\n\nAssuming the following script named ``list-users.py``.\n\n.. code:: python\n\n from __future__ import print_function\n\n for u in env['res.users'].search([]):\n print(u.login, u.name)\n\nIt can be run with::\n\n dodoo run -d dbname --log-level=error list-users.py\n\nThe second technique to create scripts looks like this. Assuming\nthe following script named ``list-users2.py``.\n\n.. code:: python\n\n #!/usr/bin/env python\n from __future__ import print_function\n import click\n\n import dodoo\n\n CTX_SETTINGS = dict(\n default_map={'log_level': 'error'}\n )\n\n @click.command(cls=dodoo.CommandWithOdooEnv, context_settings=CTX_SETTINGS)\n @click.option('--say-hello', is_flag=True)\n def main(env, say_hello):\n if say_hello:\n click.echo(\"Hello!\")\n for u in env['res.users'].search([]):\n print(u.login, u.name)\n\n\n if __name__ == '__main__':\n main()\n\nIt can be run like this::\n\n $ ./list-users2.py --help\n Usage: list-users2.py [OPTIONS]\n\n Options:\n -c, --config PATH Specify the Odoo configuration file. Other ways to\n provide it are with the ODOO_RC or OPENERP_SERVER\n environment variables, or ~/.odoorc (Odoo >= 10) or\n ~/.openerp_serverrc.\n -d, --database TEXT Specify the database name. If present, this\n parameter takes precedence over the database\n provided in the Odoo configuration file.\n --log-level TEXT Specify the logging level. Accepted values depend on\n the Odoo version, and include debug, info, warn, error.\n [default: error]\n --logfile PATH Specify the log file.\n --rollback Rollback the transaction even if the script\n does not raise an exception. Note that if\n the script itself commits, this option has no\n effect, this is why it is not named dry run.\n This option is implied when an interactive\n console is started.\n --say-hello\n --help Show this message and exit.\n\n $ ./list-users2.py --say-hello -d dbname\n Hello!\n admin Administrator\n ...\n\ndodoo Plugins\n~~~~~~~~~~~~~\n\nFor extending tha comfort of the dodoo API itself, you can write a plugin.\nIt's recommended to clone the plugin scaffolding_ repository to get started.\n\nThe plugin registration is done in ``setup.py`` like this:\n\n.. code:: python\n\n from setuptools import setup\n\n setup(\n name='yourplugin',\n version='0.1',\n py_modules=['yourplugin'],\n install_requires=[\n 'dodoo',\n ],\n entry_points='''\n [core_package.cli_plugins]\n cool_subcommand=yourscript.cli:cool_subcommand\n another_subcommand=yourscript.cli:another_subcommand\n ''',\n )\n\nAside from accessing dodoo options through ``ctx.obj`` implicitly, you can be\nexplicite by reusing dodoo options in the following way:\n\n.. code:: python\n\n import click\n from dodoo import options, main\n\n\n @main.command()\n # Set the addons path options and make it mandatory, see options.py\n @options.addons_path_opt(True)\n def subcommand(addons_path):\n \"\"\"I do something domain specific.\"\"\"\n\n\nSupported Odoo versions\n~~~~~~~~~~~~~~~~~~~~~~~\n\nOdoo version 8, 9, 10, 11 and 12 are supported.\n\nAn important design goal is to provide a consistent behaviour\nacross Odoo versions.\n\n.. note::\n\n ``dodoo`` does not mandate any particular method of installing odoo.\n The only prerequisiste is that ``import odoo`` (>= 10) or ``import openerp``\n (< 10) must work.\n\nDatabase transactions\n~~~~~~~~~~~~~~~~~~~~~\n\nBy default ``dodoo`` commits the transaction for you, unless your script\nraises an exception. This is so that you don't need to put explicit commits\nin your scripts, which are therefore easier to compose in larger transactions\n(provided they pass around the same env).\n\nThere is a ``--rollback`` option to force a rollback.\n\nA rollback is always performed after an interactive session. If you need to\ncommit changes made before or during an interactive session, use ``env.cr.commit()``.\n\nLogging\n~~~~~~~\n\nIn version 8, Odoo logs to stdout by default. On other versions\nit is stderr. ``dodoo`` attempts to use stderr for Odoo 8 too.\n\nLogging is controlled by the usual Odoo logging options (``--log-level``,\n``--logfile``) or the Odoo configuration file.\n\nCommand line interface (dodoo)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code::\n\n Usage: dodoo [OPTIONS] [SCRIPT] [SCRIPT_ARGS]...\n\n Execute a python script in an initialized Odoo environment. The script has\n access to a 'env' global variable which is an odoo.api.Environment\n initialized for the given database. If no script is provided, the script\n is read from stdin or an interactive console is started if stdin appears\n to be a terminal.\n\n Options:\n -c, --config FILE Specify the Odoo configuration file. Other\n ways to provide it are with the ODOO_RC or\n OPENERP_SERVER environment variables, or\n ~/.odoorc (Odoo >= 10) or\n ~/.openerp_serverrc.\n --addons-path TEXT Specify the addons path. If present, this\n parameter takes precedence over the addons\n path provided in the Odoo configuration\n file.\n -d, --database TEXT Specify the database name. If present, this\n parameter takes precedence over the database\n provided in the Odoo configuration file.\n --log-level TEXT Specify the logging level. Accepted values\n depend on the Odoo version, and include\n debug, info, warn, error. [default: info]\n --logfile FILE Specify the log file.\n --rollback Rollback the transaction even if the script\n does not raise an exception. Note that if\n the script itself commits, this option has\n no effect. This is why it is not named dry\n run. This option is implied when an\n interactive console is started.\n -i, --interactive / --no-interactive\n Inspect interactively after running the\n script.\n --shell-interface TEXT Preferred shell interface for interactive\n mode. Accepted values are ipython, ptpython,\n bpython, python. If not provided they are\n tried in this order.\n --help Show this message and exit.\n\nMost options above are the same as ``odoo`` options and behave identically.\nAdditional Odoo options can be set in the the configuration file.\nNote however that most server-related options (workers, http interface etc)\nare ignored because no server is actually started when running a script.\n\nAn important feature of ``dodoo`` compared to, say, ``odoo shell`` is\nthe capability to pass arguments to scripts.\n\nIn order to avoid confusion between ``dodoo`` options and your script\noptions and arguments, it is recommended to separate them with ``--``::\n\n dodoo -d dbname -- list-users.py -d a b\n ./list-users.py -d dbname -- -d a b\n\nIn both examples above, ``sys.argv[1:]`` will contain ``['-d', 'a', 'b']``\nin the script.\n\nAPI\n~~~\n\n``env_options``\n---------------\n\nCustomize the behaviour of ``dodoo.CommandWithOdooEnv`` through\n``click.Command(env_options={})``.\n\n``dodoo.CommandWithOdooEnv`` prepares an odoo ``Environment`` and passes\nit as a ``env`` parameter.\n\nIt is configurable with the following keyword arguments in ``env_options``:\n\ndatabase_must_exist\n If this flag is False and the selected database does not exist\n do not fail and pass env=None instead (default: True).\n\nenvironment_manager\n **experimental feature** A context manager that yields an intialized\n ``odoo.api.Environment``.\n It is invoked after Odoo configuration parsing and initialization.\n It must have the following signature (identical to ``OdooEnvironment``\n below, plus ``**kwargs``)\n\n .. code-block:: python\n\n environment_manager(database, rollback, **kwargs)\n\n\ndodoo.odoo namespace\n--------------------\n\nAs a convenience ``dodoo`` exports the ``odoo`` namespace, so\n``from dodoo import odoo`` is an alias for ``import odoo`` (>9)\nor ``import openerp as odoo`` (<=9).\n\nOdooEnvironment context manager (experimental)\n----------------------------------------------\n\nThis package also provides an experimental ``OdooEnvironment`` context manager.\nIt is meant to be used in after properly intializing Odoo (ie parsing the\nconfiguration file etc).\n\n.. warning::\n\n This API is considered experimental, contrarily to the scripting mechanism\n (ie passing ``env`` to scripts) and ``env_options`` decorator which are\n stable features. Should you have a specific usage for this API and would\n like it to become stable, get it touch to discuss your requirements.\n\nExample:\n\n.. code:: python\n\n from dodoo import OdooEnvironment\n\n\n with OdooEnvironment(database='dbname') as env:\n env['res.users'].search([])\n\nDevelopement\n~~~~~~~~~~~~\n\nTo run tests, type ``tox``. Tests are made using pytest. To run tests matching\na specific keyword for, say, Odoo 12 and python 3.6, use\n``tox -e py36-12.0 -- -k keyword``.\n\nThis project uses `black `_\nas code formatting convention, as well as isort and flake8.\nTo make sure local coding convention are respected before\nyou commit, install\n`pre-commit `_ and\nrun ``pre-commit install`` after cloning the repository.\n\nUseful links\n~~~~~~~~~~~~\n\n- pypi page: https://pypi.org/project/dodoo\n- code repository: https://github.com/xoe-labs/dodoo\n- report issues at: https://github.com/xoe-labs/dodoo/issues\n\n.. _Click: http://click.pocoo.org\n.. _scaffolding: https://github.com/coe-labs/dodoo-plugin-scaffold\n\nCredits\n~~~~~~~\n\nOriginal Author:\n\n- St\u00e9phane Bidoul (`ACSONE `_)\n\nContributor:\n\n- David Arnold (`XOE `_)\n\nMaintainer:\n\n- David Arnold (`XOE `_)\n\nInspiration has been drawn from:\n\n- `click-odoo by Acsone `_\n- `anybox.recipe.odoo `_\n- `anthem by Camptocamp `_\n- odoo's own shell command\n\nMaintainer\n~~~~~~~~~~\n\n.. image:: https://erp.xoe.solutions/logo.png\n :alt: XOE Corp. SAS\n :target: https://xoe.solutions\n\nThis project is maintained by XOE Corp. SAS.\n\nChanges\n~~~~~~~\n\n.. Future (?)\n.. ----------\n.. - ...\n\n2.0.0 (2019-01-22)\n------------------\n- refactor to click native facilities, where possible\n- replace ``@env_options()`` named parameters with ``context_settings``\n on ``click.Command()``\n- replace ``@env_options`` wrapper with custom Command class\n- add ``default_overrides`` command key to manage script-scoped parameter\n defaults (eg. adjust default for ``log_level`` or ``rollback``)\n- Rename to dodoo\n- Add plugin facilities\n\n1.1.1 (2018-11-01)\n------------------\n- add ``with_addons_path`` option to ``@dodoo.env_options``\n to control the presence of the ``--addons-path`` option. Defaults to False.\n Enabled for the CLI.\n\n1.1.0 (2018-10-31)\n------------------\n- add ``environment_manager`` to ``@dodoo.env_options``, providing\n a hook on ``odoo.api.Environment`` creation.\n- add ``--addons-path`` option to the CLI.\n- add ``database_must_exist`` env option to ``@dodoo.env_options``\n so scripts can behave how they please in case the database is absent.\n\n1.0.4 (2018-10-07)\n------------------\n- silence deprecation warning\n- adapt tests for Odoo 12\n\n1.0.3 (2018-06-05)\n------------------\n- clarify the behaviour of ``@env_option`` ``with_database`` and ``database_required``\n parameters; in particular, when ``with_database`` and ``database_required``\n are both set (the default), the ``--database`` option can be omitted\n as long as a database is declared in the Odoo configuration file.\n\n1.0.2 (2018-06-01)\n------------------\n- refactor the OdooEnvironment class: it is much cleaner when\n it leaves the global Odoo config alone, so we completely move\n responsibility to initialize the Odoo config to the CLI part.\n\n1.0.1 (2018-05-27)\n------------------\n- better error logging and handling: all exceptions occuring\n in scripts under dodoo.env_options are logged and converted\n to ClickException so we are sure they are both in the log file\n and on the console (handled by click) for the user to see.\n The OdooEnvironment context manager does not do additional logging,\n leaving that responsibility to the caller.\n\n1.0.0 (2018-05-20)\n------------------\n- close db connections when releasing OdooEnvironment\n- expose dodoo.odoo_bin (odoo or openerp-server depending on Odoo series).\n not documented yet, because it should ideally be a full path corresponding\n to the installed dodoo.odoo, and I'm not sure how best to detect it yet.\n\n1.0.0b4 (2018-05-17)\n--------------------\n- minor documentation improvements\n- add the possibility to run script without ``--database`` (ie without env,\n but with a properly initialized Odoo library such as addons path)\n- be more resilient in case we can't obtain a context for the user\n\n1.0.0b3 (2018-03-22)\n--------------------\n- dodoo now exports the odoo namespace: ``from dodoo import odoo``\n is an alias for ``import odoo`` (>9) or ``import openerp as odoo`` (<=9)\n- add a ``with_rollback`` option to the ``env_options`` decorator, to control\n the presence of the rollback option\n- document the ``env_options`` decorator\n\n1.0.0b2 (2018-03-21)\n--------------------\n- commit in case of success, so users do not need to commit in their\n scripts, therefore making scripts easier to compose in larger transactions\n- add a --rollback option\n- interactive mode forces --rollback\n\n1.0.0b1 (2018-03-20)\n--------------------\n- clear cache when starting environment (mostly useful for tests)\n- simplify and test transaction and exception handling\n- when leaving the env, log the exception to be sure it is visible\n when using ``--logfile``\n\n1.0.0a2 (2018-03-19)\n--------------------\n- improve transaction management: avoid some rare deadlock\n- avoid masking original exception in case of error during rollback\n- make sure launched scripts have ``__name__ == '__main__'``\n- add ``--logfile option``\n\n1.0.0a1 (2018-03-19)\n--------------------\n- first alpha\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/xoe-labs/dodoo", "keywords": "", "license": "LGPLv3+", "maintainer": "", "maintainer_email": "", "name": "dodoo", "package_url": "https://pypi.org/project/dodoo/", "platform": "", "project_url": "https://pypi.org/project/dodoo/", "project_urls": { "Homepage": "http://github.com/xoe-labs/dodoo" }, "release_url": "https://pypi.org/project/dodoo/2.0.0rc8/", "requires_dist": [ "click", "click-plugins" ], "requires_python": "", "summary": "Beautiful, robust and extensible Odoo server API extension suite for DevOps.", "version": "2.0.0rc8" }, "last_serial": 5174967, "releases": { "2.0.0rc5": [ { "comment_text": "", "digests": { "md5": "e3da7c789aa1a028130d9f59dc03101f", "sha256": "6b31b9e3fcce6396517853e9a57cab56c7bbf5703070dbb4bc5ec02282fa24cb" }, "downloads": -1, "filename": "dodoo-2.0.0rc5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e3da7c789aa1a028130d9f59dc03101f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15405, "upload_time": "2019-01-22T18:29:01", "url": "https://files.pythonhosted.org/packages/06/9b/cad2a9f0fb7baf8f56d5104190500dedf3c04ec3ed94b110dc8d15154e8a/dodoo-2.0.0rc5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8740999f9cd4adcf08c32ff460884052", "sha256": "536dbd2dccf511ac522a9f68980f6abec2aa6d69d319059c4d7ce7beb192ec8d" }, "downloads": -1, "filename": "dodoo-2.0.0rc5.tar.gz", "has_sig": false, "md5_digest": "8740999f9cd4adcf08c32ff460884052", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25270, "upload_time": "2019-01-22T18:29:04", "url": "https://files.pythonhosted.org/packages/c6/43/255d829e52d608a942a5f78478891ab0b7d58ed0982eb32800e84cb2e3c7/dodoo-2.0.0rc5.tar.gz" } ], "2.0.0rc6": [ { "comment_text": "", "digests": { "md5": "4cbe41387066567db40ce6e397615923", "sha256": "b0a4ad10a3bb68dd8f3f9a4fa01635a4c9f1b1a7a7aef527924c74a2913c79ed" }, "downloads": -1, "filename": "dodoo-2.0.0rc6-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4cbe41387066567db40ce6e397615923", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15478, "upload_time": "2019-01-24T00:19:02", "url": "https://files.pythonhosted.org/packages/b4/68/1c9dc63f834ca419a66231e61b652d0e70afbda23f44d7b1eb81a5d738aa/dodoo-2.0.0rc6-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4d8d3b6afad201f47582c575353184ba", "sha256": "a7c0af4a7f94c37cd5b249f48dd90aa044f9376b3200fd574aff12a4d3469882" }, "downloads": -1, "filename": "dodoo-2.0.0rc6.tar.gz", "has_sig": false, "md5_digest": "4d8d3b6afad201f47582c575353184ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25382, "upload_time": "2019-01-24T00:19:03", "url": "https://files.pythonhosted.org/packages/bb/c0/6f8f752764a56ac39899a1b3cbe02316e6c7b617bd157fc35776c0c3f63b/dodoo-2.0.0rc6.tar.gz" } ], "2.0.0rc7": [ { "comment_text": "", "digests": { "md5": "411603632af67e5a4ca2a224b246e1af", "sha256": "b54406b1754104bdb84dd5bc6ae12c6a421be1ec1c4b28dd1350c3156c8efbae" }, "downloads": -1, "filename": "dodoo-2.0.0rc7-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "411603632af67e5a4ca2a224b246e1af", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15684, "upload_time": "2019-01-24T16:07:42", "url": "https://files.pythonhosted.org/packages/c6/fd/e899b3495b3cba1f48e7e13c3b88be8b887fcfc19e4631a0b1ae043b8155/dodoo-2.0.0rc7-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f18d8b8fcf51a7ca18396a162731a8ec", "sha256": "aaad320c357f0941f364443a468ef82803ddabd535962583e9238161fcae92e1" }, "downloads": -1, "filename": "dodoo-2.0.0rc7.tar.gz", "has_sig": false, "md5_digest": "f18d8b8fcf51a7ca18396a162731a8ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25584, "upload_time": "2019-01-24T16:07:44", "url": "https://files.pythonhosted.org/packages/7d/78/53b39fd450540b4e73ae1f7a47a349c435246dea2c1fcd039e7a2b4ede65/dodoo-2.0.0rc7.tar.gz" } ], "2.0.0rc8": [ { "comment_text": "", "digests": { "md5": "09cd4f9e70b61ae38f36867e25a14d7e", "sha256": "e3e2677cd5144fdac0eefe9bc3a74fd631dc58f6fe1eda37a6bf377ba2702f7f" }, "downloads": -1, "filename": "dodoo-2.0.0rc8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "09cd4f9e70b61ae38f36867e25a14d7e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15877, "upload_time": "2019-04-22T23:18:58", "url": "https://files.pythonhosted.org/packages/13/94/3cc05ae88b17550be61c76f3a95dcfb314f86ee2867142df3e7e4852f379/dodoo-2.0.0rc8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7887bb1d8ab5b0cd628d663f67dd82b4", "sha256": "35133f32b0e9d7cfb759a608132603f8ff6333508f0d33222098580a1b275170" }, "downloads": -1, "filename": "dodoo-2.0.0rc8.tar.gz", "has_sig": false, "md5_digest": "7887bb1d8ab5b0cd628d663f67dd82b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25815, "upload_time": "2019-04-22T23:18:59", "url": "https://files.pythonhosted.org/packages/10/0f/0a2403945358443d948c0f02f49bd6274cf2923b9239e5c68267c63ee46a/dodoo-2.0.0rc8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "09cd4f9e70b61ae38f36867e25a14d7e", "sha256": "e3e2677cd5144fdac0eefe9bc3a74fd631dc58f6fe1eda37a6bf377ba2702f7f" }, "downloads": -1, "filename": "dodoo-2.0.0rc8-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "09cd4f9e70b61ae38f36867e25a14d7e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15877, "upload_time": "2019-04-22T23:18:58", "url": "https://files.pythonhosted.org/packages/13/94/3cc05ae88b17550be61c76f3a95dcfb314f86ee2867142df3e7e4852f379/dodoo-2.0.0rc8-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7887bb1d8ab5b0cd628d663f67dd82b4", "sha256": "35133f32b0e9d7cfb759a608132603f8ff6333508f0d33222098580a1b275170" }, "downloads": -1, "filename": "dodoo-2.0.0rc8.tar.gz", "has_sig": false, "md5_digest": "7887bb1d8ab5b0cd628d663f67dd82b4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25815, "upload_time": "2019-04-22T23:18:59", "url": "https://files.pythonhosted.org/packages/10/0f/0a2403945358443d948c0f02f49bd6274cf2923b9239e5c68267c63ee46a/dodoo-2.0.0rc8.tar.gz" } ] }