entangled

bi-directional tangle daemon for literate programming

https://github.com/entangled/entangled

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary
Last synced: 7 months ago · JSON representation ·

Repository

bi-directional tangle daemon for literate programming

Basic Info
  • Host: GitHub
  • Owner: entangled
  • License: apache-2.0
  • Language: Haskell
  • Default Branch: master
  • Homepage: https://entangled.github.io/
  • Size: 5.4 MB
Statistics
  • Stars: 91
  • Watchers: 6
  • Forks: 14
  • Open Issues: 17
  • Releases: 8
Created over 7 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation Zenodo

README.md


title: Entangled

author: Johan Hidding

DOI Entangled badge Haskell CI

Literate programming [/ˈlɪtəɹət ˈpɹəʊɡɹæmɪŋ/]{.phonetic} (computing) Literate programming is a programming paradigm introduced by Donald Knuth in which a program is given as an explanation of the program logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which a compilable source code can be generated. (Wikipedia)

In short: you write Markdown containing code fragments. These code fragments are combined into working code in a process called tangling.

Entangled makes writing literate programs easier by keeping code blocks in markdown up-to-date with generated source files. By monitoring the tangled source files, any change in the master document or source files is reflected in the other. In practice this means:

  • Write well documented code using Markdown.
  • Use any programming language you like (or are forced to use).
  • Keep debugging and using other IDE features without change.
  • Generate a report in PDF or HTML from the same source (see examples at Entangled homepage).

Status

Entangled is approaching 1.0 release! It has been tested Linux, Windows and MacOS. Still, it is highly recommended to use version control and commit often. If you encounter unexpected behaviour, please post an issue and describe the steps to reproduce.

Features:

  • live bi-directional updates
  • (reasonably) robust against wrongly edited source files
  • configurable with Dhall
  • hackable through SQLite
  • create PDF or HTML pages from literate source
  • line directives to point compilers to markdown source

Building

Entangled is written in Haskell, and uses the cabal build system. You can build an executable by running

# (requires cabal >= 3.x)
cabal build

Install the executable in your ~/.local/bin

cabal install

Run unit tests

cabal test

Using

Entangled should be run from the command-line. The idea is that you run it from the root folder of the project that you're working on. This folder should contain a entangled.dhall file that contains the configuration. You can get an example config file by running

entangled config

This config asumes you have the markdown files in a folder named ./lit, and stores information in a SQLite3 database located at ./.entangled/db. To run the daemon,

entangled daemon [files ...]

where the [files ...] bits is sequence of additional files that you want monitored.

Syntax (markdown side)

The markdown syntax Entangled uses is compatible with Pandoc's. This relies on the use of fenced code attributes. To tangle a code block to a file:

~~~markdown {.bash file=src/count.sh} ... ~~~

Composing a file using multiple code blocks is done through noweb syntax. You can reference a named code block in another code block by putting something like <<named-code-block>> on a single line. This reference may be indented. Such an indentation is then prefixed to each line in the final result.

A named code block should have an identifier given:

~~~markdown {.python #named-code-block} ... ~~~

If a name appears multiple times in the source, the code blocks are concatenated during tangling. When weaving, the first code block with a certain name will appear as <<name>>=, while consecutive code blocks with the same name will appear as <<name>>+=.

Please see the Hello World and other examples!

Syntax (source side)

In the source code we know exactly where the code came from, so there would be no strict need for extra syntax there. However, once we start to edit the source file it may not be clear where the extra code needs to end up. To make our life a little easier, named code blocks that were tangled into the file are marked with a comment at begin and end.

cpp // ~|~ begin <<lit/story.md|main-body>>[0] std::cout << "Hello, World!" << std::endl; // ~|~ end

These comments should not be tampered with!

Running entangled

Assuming you have created a Markdown file, say program.md, you can start entangled by running

entangled daemon ./program.md

in the shell. You may run entangled --help to get help on options, or check out the user manual.

Running entangled with Docker

Entangled is available as a Docker image.

Assuming you have created a Markdown file, say program.md, you can start entangled by running

shell docker run --rm --user $(id -u):$(id -g) --volume $PWD:/data nlesc/entangled daemon ./program.md

This command starts a Docker container with the current working directory mounted as /data and running with your user/group id so files are written with the correct ownership.

Distribution

If you've written a literate code using Entangled and would like to distribute it, one way is to include the tangled source code in the tar ball. You may also wish to use the pandoc filters included in entangled/filters.

Development

Credits

The following persons have made contributions to Entangled:

  • Michał J. Gajda (gh:mgajda), first implemented the line-directive feature
  • Danny Wilson (gh:vizanto), first implemented the project annotation

Generating manpage

pandoc lit/a2-manpage.md -s -t man | /usr/bin/man -l -

License

Entangled is distributed under the Apache v2 license.

Owner

  • Name: entangled
  • Login: entangled
  • Kind: organization

Citation (CITATION.cff)

# YAML 1.2
---
abstract: "Literate programming is a programming paradigm introduced by Donald Knuth in which a program is given as an explanation of the program logic in a natural language, such as English, interspersed with snippets of macros and traditional source code, from which a compilable source code can be generated. Entangled makes writing literate programs easier by keeping code blocks in Markdown up-to-date with generated source files. By monitoring the tangled source files, any change in the master document or source files is reflected in the other."
authors: 
  -
    affiliation: "Netherlands eScience Center"
    family-names: Hidding
    given-names: Johan
    orcid: "https://orcid.org/0000-0002-7550-1796"
cff-version: 1.2.0
keywords: 
  - "Literate Programming"
license: "Apache-2.0"
message: "If you use this software, please cite it using these metadata."
repository-code: "https://github.com/entangled/entangled"
title: Entangled
...

GitHub Events

Total
  • Watch event: 7
  • Fork event: 1
Last Year
  • Watch event: 7
  • Fork event: 1

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 290
  • Total Committers: 9
  • Avg Commits per committer: 32.222
  • Development Distribution Score (DDS): 0.09
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Johan Hidding j****g@e****l 264
Michal J. Gajda m****a@m****m 13
Stefan Verhoeven s****n@e****l 4
Jurriaan H. Spaaks j****s@e****l 3
Danny Wilson g****t@d****c 2
Scott Noyes s****s@g****m 1
Mark Sisson 5****n 1
Josias 6****s 1
Abel Siqueira n****1@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 77
  • Total pull requests: 23
  • Average time to close issues: 3 months
  • Average time to close pull requests: about 1 month
  • Total issue authors: 22
  • Total pull request authors: 9
  • Average comments per issue: 2.18
  • Average comments per pull request: 1.74
  • Merged pull requests: 20
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jhidding (24)
  • mgajda (13)
  • sverhoeven (7)
  • vizanto (6)
  • MyriaCore (5)
  • numero-744 (3)
  • PabRod (2)
  • 7enderhead (2)
  • Tommos0 (2)
  • ayushnix (1)
  • shakfu (1)
  • danielytics (1)
  • veotos (1)
  • jspaaks (1)
  • sheenobu (1)
Pull Request Authors
  • mgajda (10)
  • vizanto (3)
  • jspaaks (3)
  • jhidding (2)
  • marksisson (1)
  • sverhoeven (1)
  • justjosias (1)
  • snoyes (1)
  • abelsiqueira (1)
Top Labels
Issue Labels
core (10) feature (9) daemon (6) bug (5) config (3) clean (3) enhancement (2) documentation (2) logging (2) linter (2) help wanted (1) weave (1)
Pull Request Labels

Dependencies

.github/workflows/build-and-upload.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • haskell/actions/setup v1 composite
  • softprops/action-gh-release v1 composite
.github/workflows/cffconvert.yml actions
  • actions/checkout v2 composite
  • citation-file-format/cffconvert-github-action 2.0.0 composite
.github/workflows/haskell-ci.yml actions
  • actions/cache v1 composite
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-haskell v1 composite
Dockerfile docker
  • debian buster build
  • haskell 8 build