{"id":21891233,"url":"https://github.com/deathbeds/tingle","last_synced_at":"2026-04-12T17:10:36.332Z","repository":{"id":56702680,"uuid":"300931198","full_name":"deathbeds/tingle","owner":"deathbeds","description":"tangle md and rst to programs in python","archived":false,"fork":false,"pushed_at":"2020-11-06T03:10:12.000Z","size":2490,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T22:36:18.339Z","etag":null,"topics":["documentation","literate-programming"],"latest_commit_sha":null,"homepage":"https://deathbeds.github.io/tingle/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deathbeds.png","metadata":{"files":{"readme":"readme.md","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":"2020-10-03T16:55:45.000Z","updated_at":"2020-11-06T03:09:02.000Z","dependencies_parsed_at":"2022-08-15T23:40:15.145Z","dependency_job_id":null,"html_url":"https://github.com/deathbeds/tingle","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/deathbeds%2Ftingle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeds%2Ftingle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeds%2Ftingle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeds%2Ftingle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deathbeds","download_url":"https://codeload.github.com/deathbeds/tingle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898458,"owners_count":20528341,"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":["documentation","literate-programming"],"created_at":"2024-11-28T12:23:41.131Z","updated_at":"2026-04-12T17:10:36.297Z","avatar_url":"https://github.com/deathbeds.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `tingle` tangle\n\n`tingle` is a library to __import__ modern markup and data languages into python programs. it provides machinery to _tangle_ code from its document language to python modules. tangle is a concept from literate programming that describes converting document into compiled program languages.\n\ncurrently, `tingle` supports \n\n        from tingle import md, rst, yml, yaml\n\n`tingle` is primarily designed for interactive computing to generalize the reuse of code in different formats. `tingle` can be used with `jupyter` or `IPython` to import alternative document formats as python modules.\n\n`tingle` is a `pytest` extension that can test literate programs written\nin markdown or rst formats. it ensures that your documentation stays up to date with your code.\n\n## importing literate programs and data\n\n`tingle` uses context managers to modify pythons conventional imports.\n\n        import tingle\n        with tingle.loaders.Markdown():\n            ...\n\n`tingle.loaders.Markdown` is a loader that can discover notebooks with cells written in markdown and individual markdown files.\n\ncontext managers can combined into a single context manager.\n\n        import importnb\n        with importnb.Notebook(), tingle.loaders.Markdown():\n            ...\n\nor used in serial\n\n        with importnb.Notebook():\n            ...\n        with tingle.loaders.Markdown():\n            ...\n\nserial loading is necessary in the special case that two modules are loaded from files with the same name, but different extensions.\n\n### parameterized modules\n\n## fuzzy imports\n\na feature of `importnb` is the discovery of invalidate python module names. consider a notebook that is a blog post. `1968-12-09-mother-of-all-demos.ipynb`\n\n        with tingle.loaders.Markdown():\n            try:\n                from .docs import _968_12_09_mother_of_all_demos, __mother_of_all_demos\n            except:\n                ...\n\n\n## the `tingle` extension\n\n```ipython\n%load_ext tingle\n```\n\n`tingle` is an `IPython` extension that makes small modifications to the interactive computing experience.\n\n1. allows markdown input in cells, there is no weaving step, see `nowidget` for more on weaving.\n2. top level returns\n3. emojis\n\nsee the [`\"extension.md\"`](tingle/extension.md)\n\n## what does it do?\n\nthe import discovery hooks are implemented in the `importnb` package. `tingle` is specifically concerned with the need to __tangle__ input to source code.\n\nit uses `docutils` and `myst_parser` to parse RST and Markdown to \nintermediate representations as `docutils` documents. from the `docutils`\ndocument heuristics are applied to transform the document language to\npython or yml files.\n\n\n\n## developing\n\nthe tasks below require `doit`, `#pip install doit`.\n\n        def task_book():\n\nBuild the docs using jupyter book.\n\n            return dict(actions=[\n                \"jb build . --toc docs/_toc.yml --config docs/_config.yml\"\n            ], file_dep=['docs/_toc.yml', 'docs/_config.yml'], targets=['_build/html'])\n\n        def task_pdf():\n\nconfigure a pdf to build from the book task.\n\n            object = task_book()\n            object['actions'][0] += F\"  --builder pdfhtml\" \n            object['targets'][0] = object['targets'][0].replace('html', 'pdf')\n            return object\n\n        def task_test():\n\ntest the `tingle` package using `pytest`. extra pytest arguments are included in `\"pyproject.toml\"` meaning we can use the top-level `pytest` execution.\n\n            return dict(actions=[\"pytest\"])","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeathbeds%2Ftingle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeathbeds%2Ftingle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeathbeds%2Ftingle/lists"}