{ "info": { "author": "Mathieu Virbel", "author_email": "mat@kivy.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: zlib/libpng License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Topic :: Software Development :: Code Generators", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Pre-processors" ], "description": "Condiment\n=========\n\nConditionally include or remove code portion, according to the environment. It\nsupport offline and on-thy-fly preprocessing.\n\nConditional features\n--------------------\n\nLet's say you want to release a version of your code with or without a feature,\nlike unlimited life in a game. It can be useful during development, but you\ndon't want the code to be available in production.\n\nCondiment recognize the environment variables that starts with the prefix\n\"WITH_\" all uppercase. We could name our feature: `WITH_GODMODE`.\nIn python, you need to include condiment, and install it. You can put it in\nexclude block, in order to be removed during the offline preprocessing.\n\n```python\n#exclude\nimport condiment; condiment.install()\n#endexclude\n\nclass Player:\n\n\tdef die(self):\n\t\tif not WITH_GODMODE:\n\t\t\tself.life -= 1\n\t\treturn self.life\n```\n\nYou can run it without the godmode:\n\n```\n$ python main.py\n```\n\nOr by activating the godmode at runtime:\n\n```\n$ WITH_GODMODE=1 python main.py\n```\n\nYou can generate the final version for production too:\n\n```\n$ WITH_GODMODE=1 condiment main.py > prod_main.py\n$ cat prod_main.py\n\nclass Player:\n\n\tdef die(self):\n\t\tself.life -= 1\n\t\treturn self.life\n```\n\nReplacing variables\n-------------------\n\nIf you want to set an initial value, all the token founds in the environment\nwill be replaced during the generation. For example, a `WITH_LIFE` token could\nhave the initial number of life.\n\n```python\n#exclude\nimport condiment; condiment.install()\n#endexclude\n\nclass Player:\n\n\tdef __init__(self):\n\t\tPlayer.__init__(self)\n\t\tself.life = 10\n\t\tif WITH_LIFE:\n\t\t\tself.life = WITH_LIFE\n\n\tdef die(self):\n\t\tif not WITH_GODMODE:\n\t\t\tself.life -= 1\n\t\treturn self.life\n```\n\n\nWhy using condiment ?\n---------------------\n\nCompared to others existing preprocessor:\n\n- condiment doesn't rewrite the module on import, it will just inject the\n detected variables in the globals() of the module. This is avoiding double\n import of your module.\n- condiment use python expression for condition (only on if)\n- condiment doesn't need you to declare the variable prior the usage of them.\n Using environment variables allow you to declare them before launching the\n app, and change the behavior of your app easilly.\n- condiment will replace all the variables in offline version.\n\nRelated projects\n----------------\n\n- pypreprocessor\n- preprocess", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/tito/condiment", "keywords": "python,preprocessor,meta,condiment,conditional", "license": "zlib", "maintainer": null, "maintainer_email": null, "name": "condiment", "package_url": "https://pypi.org/project/condiment/", "platform": "all", "project_url": "https://pypi.org/project/condiment/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/tito/condiment" }, "release_url": "https://pypi.org/project/condiment/0.6/", "requires_dist": null, "requires_python": null, "summary": "Conditionally include code according to environment variables", "version": "0.6" }, "last_serial": 2127492, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "860d353a61c4f6e6d177145e41934504", "sha256": "cb01f1855cfbf8bdc69f4e4d4ead28c9fb705730e53fb4ebe93536fa27ec1370" }, "downloads": -1, "filename": "condiment-0.2.tar.gz", "has_sig": false, "md5_digest": "860d353a61c4f6e6d177145e41934504", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2729, "upload_time": "2013-05-06T21:45:49", "url": "https://files.pythonhosted.org/packages/68/de/9482be369db249d40976d3519e35a8ddb0529dd29cc3e1e8db14729631b0/condiment-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "7e312ed9da28a23056fd4a36774f9deb", "sha256": "39c473f6583371342c10c153f12e2b1315345a5fabfaa66cc28d159587969e37" }, "downloads": -1, "filename": "condiment-0.3.tar.gz", "has_sig": false, "md5_digest": "7e312ed9da28a23056fd4a36774f9deb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2725, "upload_time": "2013-05-06T21:50:57", "url": "https://files.pythonhosted.org/packages/54/d0/816f12034bfb1ebef0dbcebb3a2568bb814006e69ef851110cd42fe21b89/condiment-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "cfe149df7fcbf2cc30b24798ea046b58", "sha256": "276ea1d2663ed9ab8cd877261242b1b523aec8e73d8ca63769254b14336eb9cf" }, "downloads": -1, "filename": "condiment-0.4.tar.gz", "has_sig": false, "md5_digest": "cfe149df7fcbf2cc30b24798ea046b58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2806, "upload_time": "2013-05-08T10:13:16", "url": "https://files.pythonhosted.org/packages/03/e2/5dc0422edece8ccf76fbf5db92961b15e5e0f11d0c55b8e09f3ddc714b78/condiment-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "5da4e955e296cb17e8eca253600243e2", "sha256": "d58214352aa5d438f84cfb4091e9a79f9219f1cb2cebdabe2085ba7534d8dc90" }, "downloads": -1, "filename": "condiment-0.5.tar.gz", "has_sig": false, "md5_digest": "5da4e955e296cb17e8eca253600243e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2886, "upload_time": "2013-05-08T16:39:20", "url": "https://files.pythonhosted.org/packages/24/28/dddc8dc6eca5d73bbfd6dde6c25c26e98f1576b066240c04817f8eb8acfe/condiment-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "6982ec80775fbd2975ea3574815d86a9", "sha256": "463e1ecd71900dab80a03187b6c01d662651db25a30ac21aaaf1285dd5ecd7cb" }, "downloads": -1, "filename": "condiment-0.5.1.tar.gz", "has_sig": false, "md5_digest": "6982ec80775fbd2975ea3574815d86a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3832, "upload_time": "2013-05-09T05:47:00", "url": "https://files.pythonhosted.org/packages/45/d2/96494701e64b0ad9e021fdbba8b7595a1552ae7a468edc06b1425781e7d7/condiment-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "400101c672a0c987c6f9712df5ff1ddf", "sha256": "b624f266303bde8710eb2f4a304e8c468c26d0df5b7013ef218d5939fcc38714" }, "downloads": -1, "filename": "condiment-0.5.2.tar.gz", "has_sig": false, "md5_digest": "400101c672a0c987c6f9712df5ff1ddf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4580, "upload_time": "2013-05-09T05:47:30", "url": "https://files.pythonhosted.org/packages/1a/5f/9f4cc6848763165a93bd2ef6b55e99db5a6b862901dd7d82235aabb63dca/condiment-0.5.2.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "024bac4a26a41908632f41ea5cf4e388", "sha256": "f0e4f95bfd8d516c1c8b96b602f4b16454e971a4a4435643abc8c004f32fe646" }, "downloads": -1, "filename": "condiment-0.6.tar.gz", "has_sig": false, "md5_digest": "024bac4a26a41908632f41ea5cf4e388", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4625, "upload_time": "2016-05-22T10:56:19", "url": "https://files.pythonhosted.org/packages/ea/ad/6e499998cf9371587fb1af5985957d59dd43dd6e1c3d870791164b8eae1b/condiment-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "024bac4a26a41908632f41ea5cf4e388", "sha256": "f0e4f95bfd8d516c1c8b96b602f4b16454e971a4a4435643abc8c004f32fe646" }, "downloads": -1, "filename": "condiment-0.6.tar.gz", "has_sig": false, "md5_digest": "024bac4a26a41908632f41ea5cf4e388", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4625, "upload_time": "2016-05-22T10:56:19", "url": "https://files.pythonhosted.org/packages/ea/ad/6e499998cf9371587fb1af5985957d59dd43dd6e1c3d870791164b8eae1b/condiment-0.6.tar.gz" } ] }