{"id":17130962,"url":"https://github.com/alexpeits/presentationlib","last_synced_at":"2025-08-22T10:43:42.061Z","repository":{"id":45727059,"uuid":"76595413","full_name":"alexpeits/presentationlib","owner":"alexpeits","description":"Tool for creating live presentations and evaluating Python code","archived":false,"fork":false,"pushed_at":"2019-09-23T08:46:47.000Z","size":19,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-05T14:12:23.172Z","etag":null,"topics":["presentations","shell"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexpeits.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-15T20:54:59.000Z","updated_at":"2022-07-15T11:55:10.000Z","dependencies_parsed_at":"2022-09-22T21:30:18.135Z","dependency_job_id":null,"html_url":"https://github.com/alexpeits/presentationlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpeits%2Fpresentationlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpeits%2Fpresentationlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpeits%2Fpresentationlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpeits%2Fpresentationlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexpeits","download_url":"https://codeload.github.com/alexpeits/presentationlib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240045016,"owners_count":19739186,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["presentations","shell"],"created_at":"2024-10-14T19:13:39.062Z","updated_at":"2025-02-23T02:30:34.526Z","avatar_url":"https://github.com/alexpeits.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"presentationlib\n===============\n\nTool for live coding presentations\n----------------------------------\n\n**(I will find a better name)**\n\n\n*presentationlib* is a simple tool for doing presentations via the python REPL.\nIt was inspired by `these \u003chttps://www.youtube.com/watch?v=j6VSAsKAj98\u003e`_ `two\n\u003chttps://www.youtube.com/watch?v=Bm96RqNGbGo\u003e`_ talks by David Beazley.\n\nIt can easily present text files, but can also execute python files in the\nglobal scope, the same as if the presenter typed in the code or imported it.\n\nThe usage is simple, import the ``presentation`` function, declare a mapping to\nconfigure the files that are included in the presentation, and run it.\n\nThe mapping can also include a list. Then, multiple uses of it cycle through\nthe options.\n\nUsage\n-----\n\n*File structure*::\n\n    |\n    |- run_presentation.py\n    |- slides/\n        |- fib.py\n        |- lorem.txt\n\n\n\n*run_presentation.py*:\n\n.. code-block:: python\n\n    from presentationlib import presentation\n\n    mapping = {\n        'fib': 'fib.py',\n        'lorem': {'file': 'lorem.txt', 'wrap': True},\n        'test': '~/file.txt',\n        'multiple': [\n            'fib.py',\n            '~/file.txt',\n            {'file': 'lorem.txt', 'wrap': True}\n        ]\n    }\n\n    if __name__ == '__main__':\n        presentation(\n            mapping, location='slides',\n            heading='My Presentation', subheading='waaaaat'\n        )\n\n\n*Presentation*::\n\n\n    $ python run_presentation.py\n\n    --------------------------------------------------\n\n                 My Presentation                  \n\n    --------------------------------------------------\n\n                     waaaaat                      \n\n\n    \u003e\u003e\u003e 'hello'\n    'hello'\n    \u003e\u003e\u003e 'fib'\n    +------------------------------------------------------------------------------+\n    |                                                                              |\n    |  def fibo(lim):                                                              |\n    |      a, b = 0, 1                                                             |\n    |      while a \u003c= lim:                                                         |\n    |          yield a                                                             |\n    |          a, b = b, a+b                                                       |\n    |                                                                              |\n    +------------------------------------------------------------------------------+\n\n    \u003e\u003e\u003e fibo\n    \u003cfunction fibo at 0x7faf003ac500\u003e\n    \u003e\u003e\u003e list(fibo(5))\n    [0, 1, 1, 2, 3, 5]\n    \u003e\u003e\u003e\n    \u003e\u003e\u003e 'lorem'\n    +------------------------------------------------------------------------------+\n    |                                                                              |\n    |  Lorem ipsum dolor sit amet, neque voluptatum pede nulla praesent, arcu      |\n    |  neque amet sit, cum libero quis gravida arcu, pellentesque amet per amet    |\n    |  mi. Justo sapien sit ut, sit arcu lobortis tincidunt, dolor elit lobortis   |\n    |  gravida. At at leo egestas est, alias libero nisl nam id, eleifend          |\n    |  interdum sagittis congue eiusmod. Rutrum ante rutrum mauris, lorem aliquet  |\n    |  placerat sollicitudin alias, tenetur dignissim accusantium elit eros, dui   |\n    |  suscipit lacus ut. Wisi sodales exercitationem nullam, non in nunc eget.    |\n    |  Sapien eu volutpat felis ac, nibh cursus elit varius.                       |\n    |                                                                              |\n    +------------------------------------------------------------------------------+\n\n    \u003e\u003e\u003e 'multiple'\n    +------------------------------------------------------------------------------+\n    |                                                                              |\n    |  def fibo(lim):                                                              |\n    |      a, b = 0, 1                                                             |\n    |      while a \u003c= lim:                                                         |\n    |          yield a                                                             |\n    |          a, b = b, a+b                                                       |\n    |                                                                              |\n    +------------------------------------------------------------------------------+\n\n    \u003e\u003e\u003e 'multiple'\n    +------------------------------------------------------------------------------+\n    |                                                                              |\n    |  This is a file                                                              |\n    |  Yes, this is a file                                                         |\n    |                                                                              |\n    +------------------------------------------------------------------------------+\n\n    \u003e\u003e\u003e 'multiple'\n    +------------------------------------------------------------------------------+\n    |                                                                              |\n    |  Lorem ipsum dolor sit amet, neque voluptatum pede nulla praesent, arcu      |\n    |  neque amet sit, cum libero quis gravida arcu, pellentesque amet per amet    |\n    |  mi. Justo sapien sit ut, sit arcu lobortis tincidunt, dolor elit lobortis   |\n    |  gravida. At at leo egestas est, alias libero nisl nam id, eleifend          |\n    |  interdum sagittis congue eiusmod. Rutrum ante rutrum mauris, lorem aliquet  |\n    |  placerat sollicitudin alias, tenetur dignissim accusantium elit eros, dui   |\n    |  suscipit lacus ut. Wisi sodales exercitationem nullam, non in nunc eget.    |\n    |  Sapien eu volutpat felis ac, nibh cursus elit varius.                       |\n    |                                                                              |\n    +------------------------------------------------------------------------------+\n\n\nConfiguration options\n---------------------\n\n* ``location``: the directory in which all filenames are searched (except for absolute paths)\n* ``exec_py``: whether python files are executed to make functions, classes and variables available in the REPL\n* ``use_box``: whether to put text inside an ascii box \n* ``box_width``: the box width to use, if ``use_box`` is ``True``\n* ``banner``: printed on REPL initialization (a default banner is also provided)\n* ``heading`` and ``subheading``: ``banner`` can be a template, these are the template options\n\n\nHow does it work?\n-----------------\n\nThe printing of file content when the user inputs a simple string works by\npatching ``sys.displayhook``. This is a function that is ran in the interactive\nREPL whenever a user wants to output something (not when using ``print``).\n\nThe execution of the python files is made possible by using frame inspection.\nThe modified displayhook gets the caller's frame, and executes the code inside\nthe REPL's context. Note that any code outside an ``if __name__ == '__main__'``\nguard will be executed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpeits%2Fpresentationlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexpeits%2Fpresentationlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpeits%2Fpresentationlib/lists"}