{ "info": { "author": "Dustin Spicuzza", "author_email": "dustin@virtualroadside.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2.7", "Topic :: Software Development" ], "description": "pydsltool\n=========\n\nThis is a library to aid developers in creating neat little embedded DSLs when\nusing python, without having to do any complex parsing or anything like that.\nThe resulting DSLs look a bit more like english than python does.\n\nThe idea for this was inspired by some ruby stuff that I've been using lately.\nI've been using ruby quite a bit lately, and while I am still not a huge fan\nof the language, I do like the idea of easy to code up DSLs. Since I wanted\na DSL for a python project I was working on, I played with a few ideas and\nended up with this. \n\nUsage\n=====\n\nFirst, create some very basic python objects, and call the parse_dsl function\nor parse_dsl_file function with the file to process, and an object that the\nDSL is executed with. Here's a sample recipe DSL for baking::\n\n\tauthor = 'Mom'\n\tlevel = 'Easy'\n\t\n\twith Instructions('Yummy cookies'):\n\t\n\t preheat_oven = '375F'\n\t \t\n\t with Ingredients:\n\t add += '2 1/4 cups', 'flour'\n\t add += '1 tsp', 'baking soda'\n\t add += '1 tsp', 'salt'\n\t add += '1 cup', 'butter'\n\t add += '3/4 cup', 'sugar'\n\t add += '3/4 cup', 'brown sugar'\n\t add += '1 tsp', 'vanilla extract'\n\t add += '2', 'eggs'\n\t add += '2 cups', 'chocolate chips'\n\t add += '1 cup', 'nuts'\n\t \nAnd the implementation to parse that dsl is super simple::\n\n\timport dsltool\n\t\n\tclass Ingredients(object):\n \n\t def __init__(self):\n\t self.add = dsltool.ItemList()\n\t\n\t\n\tclass Instructions(object):\n\t preheat_oven = None\n\t \n\t ingredients = Ingredients\n\t steps = Steps\n\t \n\t def __init__(self, name):\n\t self.name = name\n\t\n\t\n\tclass Recipe(object):\n\t\n\t author = None\n\t level = None\n\t \n\t def __init__(self):\n\t self.instructions = Instructions\n\t \n\tif __name__ == '__main__':\n\t obj = dsltool.parse_dsl_file('cookies.pydsl', Recipe)\n\n\nThere is a working example in the 'examples' directory. Check it out.\n\nPerformance\n===========\n\nNo idea. I'm sure it's not that bad. I imagine typical usage of a DSL\nisn't going to be in a performance-dependent part of your application\nanyways.\n\nGotchas\n=======\n\nIf the user writes the DSL incorrectly, there are lots of possible gotchas. \nIf enough people use this thing and file bug reports, together we can\nremove many of them. I'll try to list them as I find them.\n\nDo not expect 0.1.x releases to have a stable API. I'm still exploring the\npossibilities of this, so as better ways to do things emerge newer releases\nwill have those instead. \n\nTesting\n=======\n\nUses py.test for testing. Still need better tests, but it catches a lot \nof common mistakes I've made so far. ;)\n\nContributing\n============\n\nIt's all on github, so file your bug reports there. If you have a patch, \nthe best way to do it is just create a fork and send me a pull request. \nIf you don't include a test case for your patch (these are really easy to\ncreate!), then it probably won't be accepted. \n\nhttps://github.com/virtuald/pydsltool\n\n\nAuthor\n======\n\nAuthor:: Dustin Spicuzza (dustin@virtualroadside.com)", "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/virtuald/pydsltool", "keywords": null, "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "pydsltool", "package_url": "https://pypi.org/project/pydsltool/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pydsltool/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/virtuald/pydsltool" }, "release_url": "https://pypi.org/project/pydsltool/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "A library to enable making simple domain specific languages", "version": "0.2.0" }, "last_serial": 1040805, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2ac4f2175dd389a27721aa610118eccc", "sha256": "4cad510dad6517bfdd0b36781b7d457a00e342694aced005a42d803fb9f4fec9" }, "downloads": -1, "filename": "pydsltool-0.1.0.tar.gz", "has_sig": false, "md5_digest": "2ac4f2175dd389a27721aa610118eccc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7628, "upload_time": "2013-11-17T20:14:26", "url": "https://files.pythonhosted.org/packages/44/bd/cf3d052318a2db69621260cb5aa39916aaacb4b024b5dfdce6c28d3aac2a/pydsltool-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f7383fb287a382557b54b4e5f02fa2e6", "sha256": "ca03a07db1c6c0218cd6ec939d7f5cd1357d8f441a61fd77e344800c621acdb3" }, "downloads": -1, "filename": "pydsltool-0.1.1.tar.gz", "has_sig": false, "md5_digest": "f7383fb287a382557b54b4e5f02fa2e6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7814, "upload_time": "2013-11-20T06:14:10", "url": "https://files.pythonhosted.org/packages/51/db/7d614227ef36288f5e1290346f66b6cbabf6661a3383f31ba914cb344641/pydsltool-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "1aa2d60ff34ef4edba0237c5904593e5", "sha256": "e75dc33ffbed55433a1a6d597f9cad1ca7b90d831504f51ce596e40947fac332" }, "downloads": -1, "filename": "pydsltool-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1aa2d60ff34ef4edba0237c5904593e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8361, "upload_time": "2014-03-25T16:35:37", "url": "https://files.pythonhosted.org/packages/6d/61/e70029366b7dd239f8dad63bbe13aebe85cbe400819a655a1a0f03a42af8/pydsltool-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1aa2d60ff34ef4edba0237c5904593e5", "sha256": "e75dc33ffbed55433a1a6d597f9cad1ca7b90d831504f51ce596e40947fac332" }, "downloads": -1, "filename": "pydsltool-0.2.0.tar.gz", "has_sig": false, "md5_digest": "1aa2d60ff34ef4edba0237c5904593e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8361, "upload_time": "2014-03-25T16:35:37", "url": "https://files.pythonhosted.org/packages/6d/61/e70029366b7dd239f8dad63bbe13aebe85cbe400819a655a1a0f03a42af8/pydsltool-0.2.0.tar.gz" } ] }