{ "info": { "author": "Utkarsh Upadhyay", "author_email": "mail@musicallyut.in", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Utilities" ], "description": "========\nOverview\n========\n\n\n\nFunction decorator to make argument passing saner.\n\nI often have to write a function which runs a simulation/learning task which I\nneed to run for several different parameters. This initially is manageable, but\nthen slowly configuration creep starts to happen: I keep adding more and more\nparameters to the functions which run the simulations and keep making my old\ncode more and more fragile.\n\nI wrote ``decorated_options`` to decouple the arguments for different set of experiments.\n\nIn brief, ``decorated_options`` converts this:\n\n::\n\n def run(max_num_followers, num_segments, is_hawkes):\n # ...\n # ...\n\n # tmp = run_multiple_followers(max_num_followers=10, num_segments=10, is_hawkes=True)\n # tmp = run_multiple_followers(max_num_followers=100, num_segments=10, is_hawkes=False)\n # tmp = run_multiple_followers(max_num_followers=10, num_segments=50, is_hawkes=True)\n tmp = run_multiple_followers(max_num_followers=1000, num_segments=100, is_hawkes=False)\n\n\nto:\n\n::\n\n from decorated_options import Options, optioned\n\n @optioned('opts')\n def run(max_num_followers, num_segments, is_hawkes):\n # ...\n # ...\n\n\n opts = Options(max_num_followers=10, num_segments=10, is_hawkes=True)\n # tmp = run_multiple_followers(opts=opts)\n # tmp = run_multiple_followers(max_num_followers=100, is_hawkes=False, opts=opts)\n # tmp = run_multiple_followers(num_segments=50, is_hawkes=False, opts=opts)\n tmp = run_multiple_followers(max_num_followers=1000, num_segments=100, is_hawkes=False)\n\n\n\n* Benefits over ``**kwargs`` in receiving function:\n\n 1. Early reporting of errors at call-time.\n 2. No need to unpack the values.\n 3. Default values do not have to be hard-coded.\n 4. Allows progressive improvement, no need to change old code which uses positional arguments.\n\n* Benefits over ``**dict`` while calling:\n\n 1. Easier updating/overriding of values\n 2. Positional arguments also work\n 3. Guaranteed immutability (throws Exceptions on attempted violations.)\n\n* Benefits over default values in receiving function:\n\n 1. ``Options`` objects can save defaults for multiple settings.\n 2. De-couples default values from the functions themselves.\n\n\n\nInstallation\n============\n\n::\n\n pip install git+https://github.com/musically-ut/decorated_options.git@master#egg=decorated_options\n\nDevelopment\n===========\n\nTo run the all tests run::\n\n tox\n\nNote, to combine the coverage data from all the tox environments run:\n\n.. list-table::\n :widths: 10 90\n :stub-columns: 1\n\n - - Windows\n - ::\n\n set PYTEST_ADDOPTS=--cov-append\n tox\n\n - - Other\n - ::\n\n PYTEST_ADDOPTS=--cov-append tox\n\n\nChangelog\n=========\n\n0.1.0 (2016-07-24)\n-----------------------------------------\n\n* First release on PyPI.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/musically-ut/decorated_options", "keywords": "decorators,data-science,configuration,arguments", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "decorated_options", "package_url": "https://pypi.org/project/decorated_options/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/decorated_options/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/musically-ut/decorated_options" }, "release_url": "https://pypi.org/project/decorated_options/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Function decorator to make argument passing saner.", "version": "0.1.0" }, "last_serial": 2599286, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "7f011ca7cb0ccda4421fdcd29dedf628", "sha256": "d85586ac70e6e3f6aa82c2c89fcbd794595d3d88cd6acdaebedc29498d1b1d22" }, "downloads": -1, "filename": "decorated_options-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7f011ca7cb0ccda4421fdcd29dedf628", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11548, "upload_time": "2017-01-26T08:47:09", "url": "https://files.pythonhosted.org/packages/ca/3a/b0be237ef9980bde57d1bc26050c746a56ed434375a76d45954c59e6c133/decorated_options-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f011ca7cb0ccda4421fdcd29dedf628", "sha256": "d85586ac70e6e3f6aa82c2c89fcbd794595d3d88cd6acdaebedc29498d1b1d22" }, "downloads": -1, "filename": "decorated_options-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7f011ca7cb0ccda4421fdcd29dedf628", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11548, "upload_time": "2017-01-26T08:47:09", "url": "https://files.pythonhosted.org/packages/ca/3a/b0be237ef9980bde57d1bc26050c746a56ed434375a76d45954c59e6c133/decorated_options-0.1.0.tar.gz" } ] }