{"id":16285574,"url":"https://github.com/tonyfast/literacy","last_synced_at":"2025-09-17T09:31:58.388Z","repository":{"id":75804369,"uuid":"93963695","full_name":"tonyfast/literacy","owner":"tonyfast","description":"Interactive literate programming in the Jupyter notebooks","archived":false,"fork":false,"pushed_at":"2017-11-30T22:54:11.000Z","size":217,"stargazers_count":7,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T09:41:28.726Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tonyfast.png","metadata":{"files":{"readme":"readme.ipynb","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-10T20:29:26.000Z","updated_at":"2021-01-25T00:22:23.000Z","dependencies_parsed_at":"2023-03-14T15:45:17.116Z","dependency_job_id":null,"html_url":"https://github.com/tonyfast/literacy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tonyfast/literacy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyfast%2Fliteracy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyfast%2Fliteracy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyfast%2Fliteracy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyfast%2Fliteracy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonyfast","download_url":"https://codeload.github.com/tonyfast/literacy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonyfast%2Fliteracy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275568771,"owners_count":25488548,"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","status":"online","status_checked_at":"2025-09-17T02:00:09.119Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-10T19:25:14.932Z","updated_at":"2025-09-17T09:31:58.110Z","avatar_url":"https://github.com/tonyfast.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# __literacy__ - interactive literate programming in markdown\\n\",\n    \"\\n\",\n    \"\u003e [`...`](http://roxygen.org/knuth-literate-programming.pdf) considering programs to be works of literature. `...`  surely nobody wants to admit writing an _illiterate_ program.\\n\",\n    \"\u003e - _Donald Knuth_ - **Literate Programming** \"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Installation\\n\",\n    \"\\n\",\n    \"```bash\\n\",\n    \"pip install git+https://github.com/tonyfast/literacy\\n\",\n    \"```\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Literacy Programming Mode\\n\",\n    \"    \"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {\n    \"collapsed\": true\n   },\n   \"outputs\": [],\n   \"source\": [\n    \"%reload_ext literacy\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"```\\n\",\n       \"    %reload_ext literacy\\n\",\n       \"```\\n\",\n       \"\\n\",\n       \"---\\n\",\n       \"    \\n\",\n       \"`import literacy` accepts Markdown as source; the __inline__, __fenced__, __indented__ code objects are concatenated into a single block of __python__ \\n\",\n       \"source code.  _All code in this block is executed._\\n\",\n       \"\\n\",\n       \"    bar = 42\\n\",\n       \"    print(bar)\\n\",\n       \"    assert literacy\\n\",\n       \"    \\n\",\n       \"---\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"42\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"```\\n\",\n    \"    %reload_ext literacy\\n\",\n    \"```\\n\",\n    \"\\n\",\n    \"---\\n\",\n    \"    \\n\",\n    \"`import literacy` accepts Markdown as source; the __inline__, __fenced__, __indented__ code objects are concatenated into a single block of __python__ \\n\",\n    \"source code.  _All code in this block is executed._\\n\",\n    \"\\n\",\n    \"    bar = 42\\n\",\n    \"    print(bar)\\n\",\n    \"    assert literacy\\n\",\n    \"    \\n\",\n    \"---\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# Templating Mode\\n\",\n       \"\\n\",\n       \"    %reload_ext literacy.template\\n\",\n       \"\\n\",\n       \"Template mode applies `__import__('jinja2');` to weave variables in scope into the markdown source.\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"# Templating Mode\\n\",\n    \"\\n\",\n    \"    %reload_ext literacy.template\\n\",\n    \"\\n\",\n    \"Template mode applies `__import__('jinja2');` to weave variables in scope into the markdown source.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"## More readable\\n\",\n       \"\\n\",\n       \"Use the templating system to explicitly write source, rather than implicit \u003ccode\u003efor\u003c/code\u003e loops.\\n\",\n       \"\\n\",\n       \"    print(0); print(1); print(2); print(3); \"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"0\\n\",\n      \"1\\n\",\n      \"2\\n\",\n      \"3\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"## More readable\\n\",\n    \"\\n\",\n    \"Use the templating system to explicitly write source, rather than implicit \u003ccode\u003efor\u003c/code\u003e loops.\\n\",\n    \"\\n\",\n    \"    {% for i in range(4) %}print({{i}}); {% endfor %}\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# Macros\\n\",\n       \"\\n\",\n       \"## yaml\\n\",\n       \"\\n\",\n       \"Begin a code block with \u003ccode\u003e---\u003c/code\u003e to invoke yaml syntax as valid data input.  _This is great for taking notes._\\n\",\n       \"\\n\",\n       \"    ---\\n\",\n       \"    refs:\\n\",\n       \"    - roxygen.org/knuth-literate-programming.pdf\\n\",\n       \"    - https://en.wikipedia.org/wiki/Literate_programming\\n\",\n       \"        \\n\",\n       \"\u003e _The yaml source must contain named objects at the top level._\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"# Macros\\n\",\n    \"\\n\",\n    \"## yaml\\n\",\n    \"\\n\",\n    \"Begin a code block with \u003ccode\u003e---\u003c/code\u003e to invoke yaml syntax as valid data input.  _This is great for taking notes._\\n\",\n    \"\\n\",\n    \"    ---\\n\",\n    \"    refs:\\n\",\n    \"    - roxygen.org/knuth-literate-programming.pdf\\n\",\n    \"    - https://en.wikipedia.org/wiki/Literate_programming\\n\",\n    \"        \\n\",\n    \"\u003e _The yaml source must contain named objects at the top level._\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"---\\n\",\n       \"    \\n\",\n       \"    if __name__ == '__main__':\\n\",\n       \"        \\n\",\n       \"# Importable Literate Notebooks\\n\",\n       \"\\n\",\n       \"    \\n\",\n       \"        import readme\\n\",\n       \"        \\n\",\n       \"with the following tests \\n\",\n       \"\\n\",\n       \"        assert readme.__file__ == 'readme.ipynb'\\n\",\n       \"        assert readme.bar is bar\\n\",\n       \"        bar = 3.14\\n\",\n       \"        assert readme.bar is not bar\\n\",\n       \"        \\n\",\n       \"\\n\",\n       \"---\\n\",\n       \"\\n\",\n       \"_`literacy;` makes it possible to import any notebook._\\n\",\n       \"\\n\",\n       \"---\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"42\\n\",\n      \"0\\n\",\n      \"1\\n\",\n      \"2\\n\",\n      \"3\\n\"\n     ]\n    },\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"[NbConvertApp] Converting notebook readme.ipynb to markdown\\n\",\n      \"[NbConvertApp] Writing 2381 bytes to readme.md\\n\"\n     ]\n    },\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# This is literate source\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"---\\n\",\n    \"    \\n\",\n    \"    if __name__ == '__main__':\\n\",\n    \"        \\n\",\n    \"# Importable Literate Notebooks\\n\",\n    \"\\n\",\n    \"    \\n\",\n    \"        import readme\\n\",\n    \"        \\n\",\n    \"with the following tests \\n\",\n    \"\\n\",\n    \"        assert readme.__file__ == 'readme.ipynb'\\n\",\n    \"        assert readme.bar is bar\\n\",\n    \"        bar = 3.14\\n\",\n    \"        assert readme.bar is not bar\\n\",\n    \"        \\n\",\n    \"\\n\",\n    \"---\\n\",\n    \"\\n\",\n    \"_`literacy;` makes it possible to import any notebook._\\n\",\n    \"\\n\",\n    \"---\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"## Marking up functions\\n\",\n       \"\\n\",\n       \"It is possible to `def \\\\`ine a function named `foo\\\\` with a body composed below,\\n\",\n       \"\\n\",\n       \"Our function __foo__ has parameters __x__ and __y__\\n\",\n       \"\\n\",\n       \"    (x=42, y=10):\\n\",\n       \"        \\\"\\\"\\\"Make sure to have a docstring\\\"\\\"\\\"\\n\",\n       \"with the ability to interpose markdown into the code, and\\n\",\n       \"        \\n\",\n       \"        return x*y\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"## Marking up functions\\n\",\n    \"\\n\",\n    \"It is possible to `def \\\\`ine a function named `foo\\\\` with a body composed below,\\n\",\n    \"\\n\",\n    \"Our function __foo__ has parameters __x__ and __y__\\n\",\n    \"\\n\",\n    \"    (x=42, y=10):\\n\",\n    \"        \\\"\\\"\\\"Make sure to have a docstring\\\"\\\"\\\"\\n\",\n    \"with the ability to interpose markdown into the code, and\\n\",\n    \"        \\n\",\n    \"        return x*y\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 8,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# Inspect Source\\n\",\n       \"        \\n\",\n       \"In the interactive mode `__name__ == '__main__' and 'In' in globals() and \\\\` exists to store the prior code executed.\\n\",\n       \"\\n\",\n       \"    print(\\\"\\\"\\\"The source code for the previous cell is:\\\\n\\\\n\\\"\\\"\\\", In[-2])\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"The source code for the previous cell is:\\n\",\n      \"\\n\",\n      \" def foo(x=42, y=10):\\n\",\n      \"    \\\"\\\"\\\"Make sure to have a docstring\\\"\\\"\\\"\\n\",\n      \"\\n\",\n      \"    return x*y\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"# Inspect Source\\n\",\n    \"        \\n\",\n    \"In the interactive mode `__name__ == '__main__' and 'In' in globals() and \\\\` exists to store the prior code executed.\\n\",\n    \"\\n\",\n    \"    print(\\\"\\\"\\\"The source code for the previous cell is:\\\\n\\\\n\\\"\\\"\\\", In[-2])\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 9,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# Nbconvert\\n\",\n       \"\\n\",\n       \"`literacy;` complies with the __nbconvert__ converters.  A successful use of literate programming will require the input cells to be suppressed\\n\",\n       \"\\n\",\n       \"```%%bash\\n\",\n       \"jupyter nbconvert --to markdown --TemplateExporter.exclude_input=True readme.ipynb\\n\",\n       \"```\\n\",\n       \"\\n\",\n       \"add the \u003ccode\u003e--execute\u003c/code\u003e flag to execute the notebook before it is converted.\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"name\": \"stderr\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"[NbConvertApp] Converting notebook readme.ipynb to markdown\\n\",\n      \"[NbConvertApp] Writing 2381 bytes to readme.md\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"# Nbconvert\\n\",\n    \"\\n\",\n    \"`literacy;` complies with the __nbconvert__ converters.  A successful use of literate programming will require the input cells to be suppressed\\n\",\n    \"\\n\",\n    \"```%%bash\\n\",\n    \"jupyter nbconvert --to markdown --TemplateExporter.exclude_input=True readme.ipynb\\n\",\n    \"```\\n\",\n    \"\\n\",\n    \"add the \u003ccode\u003e--execute\u003c/code\u003e flag to execute the notebook before it is converted.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 10,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"    %%markdown\\n\",\n       \"    # This is literate source\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/markdown\": [\n       \"# This is literate source\"\n      ],\n      \"text/plain\": [\n       \"\u003cIPython.core.display.Markdown object\u003e\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"    %%markdown\\n\",\n    \"    # This is literate source\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.5.4\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyfast%2Fliteracy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonyfast%2Fliteracy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonyfast%2Fliteracy/lists"}