{ "info": { "author": "David Eyk", "author_email": "david@eykd.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "Intended Audience :: Information Technology", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "PrestoPlot\n==========\n\nBoom! Instant plot!\n\nPrestoPlot is a tool for idea generation, name generation, and other tomfoolery\nwhen you should otherwise be writing.\n\nGoes best with the oracles from the `PrestoPlot Oracles repository`_.\n\n.. _PrestoPlot Oracles repository: https://github.com/eykd/prestoplot-oracles/\n\nInstall\n-------\n\nPrestoPlot is available from PyPI::\n\n pip install prestoplot\n\nUsage\n-----\n\nPrestoPlot may be invoked with the ``presto`` CLI script::\n\n presto --help\n\nThe \"oracle\" consulted directly must include a ``Begin:`` stanza::\n\n $ cat names.yaml\n Begin:\n - \"{Name}\"\n\n Name:\n - George\n - Martha\n\n $ presto run names.yaml\n George\n\n\nGenerative Grammars\n-------------------\n\nThe main feature right now is a generative grammar that uses a simple YAML-based\nlanguage and `Python f-string syntax`_ to create `\"oracles\"`_ for idea generation.\n\n.. _\"oracles\": https://github.com/eykd/prestoplot-oracles/\n.. _Python f-string syntax: https://realpython.com/python-f-strings/\n\nThe best way to learn the grammar is to look at examples. We'll consider the\n`YAML for generating a Pirate story`_, which begins like this::\n\n include:\n - setup\n\n Begin:\n - \"{PiratesOracle}\"\n\n.. _YAML for generating a Pirate story: https://github.com/eykd/prestoplot-oracles/blob/master/oracles/pirates.yaml\n\nThere is the ``Begin:`` stanza that we require to directly consult an oracle.\nThis contains a list of strings that may be chosen from by the random generator.\nIn this case, we have an f-string template that invokes ``PiratesOracle``. We\nfind that below::\n\n PiratesOracle:\n - |\n {Setup}\n - {Letters.One}\n - {Letters.Two}\n - {Letters.Three}\n - {Letters.Four}\n - |\n {Setup}\n - {CutlassDagger.One}\n - {CutlassDagger.Two}\n - {CutlassDagger.Three}\n - {CutlassDagger.Four}\n\nWe see another list of strings. ``|`` followed by an indented new line means to\ntreat what follows at that indentation level as a literal string, instead of\nYAML::\n\n {Setup}\n - {Letters.One}\n - {Letters.Two}\n - {Letters.Three}\n - {Letters.Four}\n\nSo this is a string with a Markdown-style list, instead of a YAML list, all\nbecause of the ``|``.\n\nSo here we see ``Setup`` invoked, and then ``Letters`` invoked four times.\n``Letters`` is defined below::\n\n Letters:\n - mode: pick\n - \"Betrayal and treachery!\"\n - \"Captured {Nationality} charts, carefully copied, and used by the Royal Navy.\"\n - \"Dolphins, seen frolicking in the bow-wake of a ship, perhaps leading it toward its goal.\"\n - \"Flotsam and jetsam, washed ashore after a sea-battle.\"\n - \"Fo\u2019c\u2019sle gossip blaming the ship\u2019s misfortunes on a crewman who killed an albatross.\"\n - \"Forged documents, implying that their bearer speaks for the Crown.\"\n - \"Hidden reefs, which at low tide endanger any ship that passes over them.\"\n\nWe have another list, containing piratical thematic elements. ``mode: pick``\ntells the generator to randomly pick from among them, then remove that option\nfrom consideration for future picks. The normal mode is ``reuse`` which allows\nlist items to be re-used by the generator. Another mode, ``markov``, tells the\ngenerator to build a Markov chain from the list, as with `these name lists`_.\n\n.. _these name lists: https://github.com/eykd/prestoplot-oracles/blob/master/oracles/names-markov.yaml\n\nGoing back to ``PiratesOracle``, we see that ``Letters`` is invoked four times,\neach time with a new *key*. The values of the keys are important only to the\nreader. Each new key acts as a fresh seed for the random generator when working\ninside that stanza. For instance, if ``{Letters.One}`` picked the element\n``\"Captured {Nationality} charts, carefully copied, and used by the Royal\nNavy.\"``, the value ``One`` provides the seed for picking a ``Nationality``,\nsay, ``English``. Later, if ``{Letters.Two}`` encounters another element\ncontaining ``{Nationality}``, the key ``Two`` will provide a different seed for\npicking a nationality the second time.\n\nThe plot thickens when we examine the ``include`` stanza, which includes the\n``setup.yaml`` file `next door`_. This file includes more files. We will next examine `characters.yaml`_.\n\n.. _next door: https://github.com/eykd/prestoplot-oracles/blob/master/oracles/setup.yaml\n.. _characters.yaml: https://github.com/eykd/prestoplot-oracles/blob/master/oracles/characters.yaml\n\nInside of ``characters.yaml`` we find this fascinating set of stanzas::\n\n Sex:\n - male\n - female\n\n He:\n - >\n {'She' if Sex[key] == 'female' else 'He'}\n his:\n - >\n {'her' if Sex[key] == 'female' else 'his'}\n His:\n - >\n {'Her' if Sex[key] == 'female' else 'His'}\n hero:\n - \"{'heroine' if Sex[key] == 'female' else 'hero'}\"\n\n\nWith this set of tools, we could write the following string::\n\n That {hero.protag}! {He.protag} sure loves {his.protag} mom.\n\nThe long and short of it is that, depending on the sex of the protagonist, this\nwill render either::\n\n That heroine! She sure loves her mom.\n\nor::\n\n That hero! He sure loves his mom.\n\nSo here we see that inside of f-string syntax, we can use pythonic expressions,\nand the variable ``key`` contains the key from the outer scope: ``{He.protag}``\nassigns the value ``\"protag\"`` to ``key``. ``{Sex[key]}`` will reliably produce\nthe same result for the same key (assuming the same initial seed).\n\nEverything else is just YAML syntax and Python f-string expressions.\n\n\nAbout\n-----\n\nI wrote PrestoPlot to support idea generation and name generation for my\npulp-inspired science fiction space opera series, `Salvage of Empire`_:\n\n When his brother-in-law threatens to reveal his terrible secret, Director Kolteo\n Ais must sacrifice everything he has worked for to save the Galactic Empire\u2014and\n his marriage\u2014from utter ruin.\n\n.. _Salvage of Empire: https://eykd.net/salvage/\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "prestoplot", "package_url": "https://pypi.org/project/prestoplot/", "platform": "", "project_url": "https://pypi.org/project/prestoplot/", "project_urls": null, "release_url": "https://pypi.org/project/prestoplot/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Generative grammars for idea generation.", "version": "0.2.0" }, "last_serial": 5972790, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "fc07a1cdba1ec590057bed0e58a20522", "sha256": "5984d846c2d8bc8813cd7f29f738b15e13e36af40b12dda3789076dec26e2a0e" }, "downloads": -1, "filename": "prestoplot-0.1.0.tar.gz", "has_sig": false, "md5_digest": "fc07a1cdba1ec590057bed0e58a20522", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7694, "upload_time": "2019-02-08T05:11:25", "url": "https://files.pythonhosted.org/packages/28/72/bb6b07d14c43434312e2d08b6fe8e30b8a1da31f69e419115a25422c3738/prestoplot-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "2a7e7626ddd77cde8f96a947be8c42fe", "sha256": "47481fd844a5bb57e974bf31d2c7e3a6ecfc7588dd8189463dd5cacb82382d61" }, "downloads": -1, "filename": "prestoplot-0.1.1.tar.gz", "has_sig": false, "md5_digest": "2a7e7626ddd77cde8f96a947be8c42fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8283, "upload_time": "2019-02-08T14:49:38", "url": "https://files.pythonhosted.org/packages/2f/87/8cf467a75df67b183ef69e74dfed30e16f97a5fc5defd6cb7a5050ad3d80/prestoplot-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0be2c6df905e7ffafec51cf42783e872", "sha256": "cbba4bd456f351bc75bac97edf241ad666c0281d20e7c16630aefc53190fe1ab" }, "downloads": -1, "filename": "prestoplot-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0be2c6df905e7ffafec51cf42783e872", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8567, "upload_time": "2019-02-08T14:54:16", "url": "https://files.pythonhosted.org/packages/e7/3b/890006d0eda3ca4fc1ecadf1477f59e7cace9753326a1e26d829950b96f8/prestoplot-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "9d6bf653f31684d86bedf505fdb68818", "sha256": "44fb37e9ed16e8293324a6b712db313827bd919d0330a512de701cc1e4939a54" }, "downloads": -1, "filename": "prestoplot-0.1.3.tar.gz", "has_sig": false, "md5_digest": "9d6bf653f31684d86bedf505fdb68818", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12481, "upload_time": "2019-02-08T15:35:42", "url": "https://files.pythonhosted.org/packages/23/c8/1faf91b0a8b6ce9e41ea45bd230e19fb841ca68363b9114a0d795caa1f39/prestoplot-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "03c0c6c470534d293f9e6e833866dd01", "sha256": "ff73d811546bb86c583289f52a3467b696c402154b5814dddd88cdcb906ef94a" }, "downloads": -1, "filename": "prestoplot-0.2.0.tar.gz", "has_sig": false, "md5_digest": "03c0c6c470534d293f9e6e833866dd01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14511, "upload_time": "2019-10-14T18:38:30", "url": "https://files.pythonhosted.org/packages/c4/38/9931379bb4a80133fa7959c0595ad8dcce2c139f6923911ff1f890876f00/prestoplot-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "03c0c6c470534d293f9e6e833866dd01", "sha256": "ff73d811546bb86c583289f52a3467b696c402154b5814dddd88cdcb906ef94a" }, "downloads": -1, "filename": "prestoplot-0.2.0.tar.gz", "has_sig": false, "md5_digest": "03c0c6c470534d293f9e6e833866dd01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14511, "upload_time": "2019-10-14T18:38:30", "url": "https://files.pythonhosted.org/packages/c4/38/9931379bb4a80133fa7959c0595ad8dcce2c139f6923911ff1f890876f00/prestoplot-0.2.0.tar.gz" } ] }