{ "info": { "author": "Dan Sackett", "author_email": "danesackett@gmail.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "ASKpy - Collect Input from your Users\n=====================================\n\nASKpy is a module which makes collecting Raw Input for your Python\nprogram more robust. It supports creating prompts, conditional\nquestions, validation, and transforming responses.\n\nInstallation\n------------\n\nInstalling ASKpy is as simple as:\n\n::\n\n pip install askpy\n\nUsage\n-----\n\nASKpy at its core is a way to build up questions and create a prompt for\nusers in your terminal applications.\n\n::\n\n from askpy import Prompt\n\n prompt = Prompt()\n\n my_question = prompt.make_question('name', 'What is your name?')\n\n prompt.add(my_question)\n\n prompt.collect()\n\n name = prompt.get_response('name')\n\nWhile the above may hide raw input, it does not give you much more power\nthan you could already use in the standard library. ASKpy allows you to\nvalidate and transform your responses easily:\n\n::\n\n from askpy import Prompt, Validator\n\n prompt = Prompt()\n\n question = prompt.make_question('age', 'How old are you?') \\\n .must(Validator.num_gt(20)) \\\n .transform(int)\n\n prompt.add(question)\n\n prompt.collect()\n\n question = prompt.get_response('question')\n\nThe above example will ensure the user enters an age greater 20\notherwise it will reprompt them. Once it has a valid age it will cast it\nto an integer for you to use later.\n\nThere\u2019s more too.\n\nSometimes questions depend on others and in order to handle these cases\nyou would usually rely on conditional statements and parsing. With ASKpy\nyou can do this by chaining questions.\n\n::\n\n from askpy import Prompt, ValidationError, Validator\n\n prompt = Prompt()\n\n\n def validate_even(num):\n Validator.num(num)\n if int(num) % 2 != 0:\n raise ValidationError('Please choose an even number')\n\n\n def validate_odd(num):\n Validator.num(num)\n if int(num) % 2 == 0:\n raise ValidationError('Please choose an odd number')\n\n\n even_or_odd = prompt.make_question('even_or_odd', 'Do you prefer even or odd numbers?') \\\n .must(Validator.one_of(['even', 'odd']))\n\n even_question = prompt.make_question('even', 'What is your favorite even number?') \\\n .must(validate_even) \\\n .transform(int)\n\n odd_question = prompt.make_question('odd', 'What is your favorite odd number?') \\\n .must(validate_odd) \\\n .transform(int)\n\n prompt.add(even_or_odd) \\\n .then(lambda resp: resp == 'even', even_question, odd_question)\n\n prompt.collect()\n\nAs you can see, you get explicit prompts with the ability to keep your\ncode sane.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dansackett/askpy", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "askpy", "package_url": "https://pypi.org/project/askpy/", "platform": "", "project_url": "https://pypi.org/project/askpy/", "project_urls": { "Homepage": "https://github.com/dansackett/askpy" }, "release_url": "https://pypi.org/project/askpy/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "Python user input prompt toolkit", "version": "0.0.4" }, "last_serial": 2731738, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "679615c58e0023b1da4427ec90bade8c", "sha256": "bd381230eaa37099a3bce2a72ab0f2368e222aa10108d861f138097767a630f5" }, "downloads": -1, "filename": "askpy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "679615c58e0023b1da4427ec90bade8c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1533, "upload_time": "2017-03-26T14:46:33", "url": "https://files.pythonhosted.org/packages/33/e9/3ea56de7ae137f0ceea87d8b6b3d51993c059b6fafb11ac7aa62f10b15ba/askpy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "26471f969c644fcf35872151abba1af8", "sha256": "9b5a55ac784259daa463c0b6f0d3d0325922df48e28c71c5aa3461e16bf4f50d" }, "downloads": -1, "filename": "askpy-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "26471f969c644fcf35872151abba1af8", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 6167, "upload_time": "2017-03-26T14:50:35", "url": "https://files.pythonhosted.org/packages/41/e7/3e1fc31f147f6ed1f6f4f510b0f93ae2c2e2a0227c7e3361348815e01c85/askpy-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "38b41ebce7415bf5d6b39b45b8125d64", "sha256": "cc0982b24a0792a9ee5bfe6072eea37a6f80ca26e7297562f7d27f36d82029ea" }, "downloads": -1, "filename": "askpy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "38b41ebce7415bf5d6b39b45b8125d64", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4539, "upload_time": "2017-03-26T14:50:33", "url": "https://files.pythonhosted.org/packages/bd/af/61b130a2db21438603f8e1b06966e89ba62d311496929771d52eed6b01c4/askpy-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "f5d34d0a91d68dbcc1cb722bed1fbc7c", "sha256": "b55ab32376e7e3c579afa8df6ff27c310319f351369dca61c5d6c83b3f648f8c" }, "downloads": -1, "filename": "askpy-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "f5d34d0a91d68dbcc1cb722bed1fbc7c", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 6166, "upload_time": "2017-03-26T14:52:31", "url": "https://files.pythonhosted.org/packages/14/94/d19d0c97a9e29fa92c54e4908305789751ec4c4df5b4d3f5b468611ce593/askpy-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fe82f62c9dc03cfaac5359edabfcf807", "sha256": "c226de289592cd2edc73dc44b1b1131266a51f28f8a4a920d46ed85074a00e53" }, "downloads": -1, "filename": "askpy-0.0.3.tar.gz", "has_sig": false, "md5_digest": "fe82f62c9dc03cfaac5359edabfcf807", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4546, "upload_time": "2017-03-26T14:52:29", "url": "https://files.pythonhosted.org/packages/61/58/f15fd15e93a714d1407a3eb233c89695390941f2e22d192cf16bcad35561/askpy-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "2b4907e88929ce2ad74ff769e632dcf8", "sha256": "989e6e9688ec7fac7dd3de2fb086b7eea4c3d26b4df3ef48d546203eb2e69772" }, "downloads": -1, "filename": "askpy-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "2b4907e88929ce2ad74ff769e632dcf8", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 8106, "upload_time": "2017-03-26T15:04:24", "url": "https://files.pythonhosted.org/packages/ec/fe/30e009d83544cfc246d2bdc9f9781a0423663c80a27eac73c834d3768ead/askpy-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edf37ec0967ab57d5240f158c943de4d", "sha256": "413e29642c7a637f40650fe08412e1f97dbcbb3d7138a93842720a34046ddc4e" }, "downloads": -1, "filename": "askpy-0.0.4.tar.gz", "has_sig": false, "md5_digest": "edf37ec0967ab57d5240f158c943de4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6439, "upload_time": "2017-03-26T15:04:23", "url": "https://files.pythonhosted.org/packages/58/bc/5e600cb7bc346b35044417e62b294075a1e1083cfa20843d41ca133999f3/askpy-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2b4907e88929ce2ad74ff769e632dcf8", "sha256": "989e6e9688ec7fac7dd3de2fb086b7eea4c3d26b4df3ef48d546203eb2e69772" }, "downloads": -1, "filename": "askpy-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "2b4907e88929ce2ad74ff769e632dcf8", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 8106, "upload_time": "2017-03-26T15:04:24", "url": "https://files.pythonhosted.org/packages/ec/fe/30e009d83544cfc246d2bdc9f9781a0423663c80a27eac73c834d3768ead/askpy-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "edf37ec0967ab57d5240f158c943de4d", "sha256": "413e29642c7a637f40650fe08412e1f97dbcbb3d7138a93842720a34046ddc4e" }, "downloads": -1, "filename": "askpy-0.0.4.tar.gz", "has_sig": false, "md5_digest": "edf37ec0967ab57d5240f158c943de4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6439, "upload_time": "2017-03-26T15:04:23", "url": "https://files.pythonhosted.org/packages/58/bc/5e600cb7bc346b35044417e62b294075a1e1083cfa20843d41ca133999f3/askpy-0.0.4.tar.gz" } ] }