{ "info": { "author": "Magnus Hallin", "author_email": "mhallin@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "********\nHestiate\n********\n\n.. image:: https://travis-ci.org/mhallin/hesitate-py.svg?branch=master\n :target: https://travis-ci.org/mhallin/hesitate-py\n\nLike ``assert``, but less... assertive.\n\n----\n\nAre you skipping on writing your ``assert`` statements because of performance reasons? Skip no more!\nHesitate will, through probabilistic means, make your Design by Contract-assertions faster!\n\n\nHow?\n====\n\nBy not executing them.\n\n...\n\nYeah.\n\nHesitate will measure the execution time on every assert statement you write, and execute the slow\nones less frequently than the fast ones. You decide on what you think is a reasonable amount of time\nper assertion on average, and Hesitate will control how often your assertions run in order to match\nthat.\n\nIt looks like this:\n\n.. code-block:: python\n\n # worker.py\n\n def do_work(data):\n assert data_is_valid(data) # Super slow!\n\n return work_work(data)\n\n\n # main.py\n\n import hesitate\n hesitate.attach_hook(\n target_timing=0.002, # 2 milliseconds per assert on average\n )\n\n import worker\n worker.do_work(invalid_data) # Might not raise AssertionError! Who knows?\n\nHesitate works with an AST rewriter influenced to py.test_. It hooks on to Python's module loader\nwhere it intercepts and rewrites code on the fly as it is loaded. Hesitate stores assertion timings\nin a plain dictionary, so everything is forgotten when the application quits. This makes it most\nuseful for long-living processes, such as application servers.\n\n\nInstallation\n============\n\n.. code-block:: sh\n\n pip install hesitate\n\nCall ``hesitate.attach_hook()`` as soon as possible when your application starts. It must be done\nbefore any modules you want Hesitate to plug in to are loaded. ``attach_hook`` takes three optional arguments:\n\n* ``initial_probability`` - the probability an assert is initially run, before its timing is known.\n The default is 1.0, which causes all asserts to trigger on their first run. Lower this value to\n avoid flooding the system with potentially slow assertions each time the application starts.\n* ``target_timing`` - the expected duration each assert should converge on, in seconds. The default\n is 0.1.\n* ``convergence_factor`` - the speed with which the measurements of an assert converges. The timing\n of an assert is low pass filtered, this controls how fast the filter follows. 1.0 means that it\n always uses the new value. 0.0 means that it will never change from its initial value. The default\n is 0.7.\n\n\nPython Support\n--------------\n\nHesitate is tested with Python 2.7, 3.2, 3.3, 3.4, and PyPy 2.4.\n\n\nDjango Integration\n------------------\n\nHesitate comes pre-packaged with a Django application that integrates with your settings, and\nsupports Django 1.6 and 1.7.\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n # Hesitate should be loaded first of all apps!\n 'hesitate.wrappers.django',\n\n # The rest of your apps here\n )\n\n HESITATE_ENABLED = True # Optional, defaults to the inverse of DEBUG\n\n # These parameters reflect the attach_hook parameters and are all optional:\n HESITATE_INITIAL_PROBABILITY = 1.0\n HESITATE_TARGET_TIMING = 0.1\n HESITATE_CONVERGENCE_FACTOR = 0.7\n\n\n.. _py.test: http://pytest.org\n", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mhallin/hesitate-py", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "hesitate", "package_url": "https://pypi.org/project/hesitate/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hesitate/", "project_urls": { "Homepage": "https://github.com/mhallin/hesitate-py" }, "release_url": "https://pypi.org/project/hesitate/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "A stochastic Design by Contract utility", "version": "0.0.2" }, "last_serial": 1413996, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "78ad4788bb3edb68b471d338e499e00c", "sha256": "a159dece4cea655c51f6aabf0ff1649ed2f16a54f616ef62bdd6d744b66fd441" }, "downloads": -1, "filename": "hesitate-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "78ad4788bb3edb68b471d338e499e00c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4167, "upload_time": "2015-02-07T11:37:11", "url": "https://files.pythonhosted.org/packages/24/a1/3cf7cb3ed7931ff52078fbbb97bc87b39270779f905617e64918c0f2c2d0/hesitate-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ea2b0f6e81b51997c8b0a26446c04bcf", "sha256": "62a90b179627a59692e6fbd15bfc832be5d43fd982d15690cb0cfff70ba90777" }, "downloads": -1, "filename": "hesitate-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ea2b0f6e81b51997c8b0a26446c04bcf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3978, "upload_time": "2015-02-07T11:37:14", "url": "https://files.pythonhosted.org/packages/ba/36/0693d91f6b7f5cfb2df162e0f5768d4b157ae99ea0b056808608c983899a/hesitate-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "073a0eef5c42729a21504ee16860b4d6", "sha256": "8e03af55f723819656809f726cfae29853df2fd8f112e69adb01a3782ae7861f" }, "downloads": -1, "filename": "hesitate-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "073a0eef5c42729a21504ee16860b4d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5285, "upload_time": "2015-02-07T19:00:08", "url": "https://files.pythonhosted.org/packages/92/8c/a648ac346f500f235b79a27ffd1eab6f0f90a8665c1ecf92623b7deed1a6/hesitate-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "651bcb24d93b64716cb55071ea6e5f0e", "sha256": "d2ad1735b96a61e0c4939a59df95e6a92d182bc0e1268e38414921d8b01c8290" }, "downloads": -1, "filename": "hesitate-0.0.2.tar.gz", "has_sig": false, "md5_digest": "651bcb24d93b64716cb55071ea6e5f0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7604, "upload_time": "2015-02-07T19:00:11", "url": "https://files.pythonhosted.org/packages/21/91/abd39bd7dbeeaa401ccfcf26b3b83ea6fe3164fe37cd9c9e4cca31cd8a3e/hesitate-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "073a0eef5c42729a21504ee16860b4d6", "sha256": "8e03af55f723819656809f726cfae29853df2fd8f112e69adb01a3782ae7861f" }, "downloads": -1, "filename": "hesitate-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "073a0eef5c42729a21504ee16860b4d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5285, "upload_time": "2015-02-07T19:00:08", "url": "https://files.pythonhosted.org/packages/92/8c/a648ac346f500f235b79a27ffd1eab6f0f90a8665c1ecf92623b7deed1a6/hesitate-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "651bcb24d93b64716cb55071ea6e5f0e", "sha256": "d2ad1735b96a61e0c4939a59df95e6a92d182bc0e1268e38414921d8b01c8290" }, "downloads": -1, "filename": "hesitate-0.0.2.tar.gz", "has_sig": false, "md5_digest": "651bcb24d93b64716cb55071ea6e5f0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7604, "upload_time": "2015-02-07T19:00:11", "url": "https://files.pythonhosted.org/packages/21/91/abd39bd7dbeeaa401ccfcf26b3b83ea6fe3164fe37cd9c9e4cca31cd8a3e/hesitate-0.0.2.tar.gz" } ] }