PyLit (Python Literate) provides a plain but efficient tool for literate programming: a bidirectional text/code converter.
It converts between text with embedded source code and source code with embedded documentation (comment blocks).
#> python pylit.py [options] INFILE [OUTFILE]
--version show program’s version number and exit
-h, --help show this help message and exit
-c, --code2txt convert code source to text source
text block marker (default '# ')
-d, --diff test for differences to existing file
--doctest run doctest.testfile() on the text version
-e, --execute execute code (Python only)
use LANGUAGE native comment style
overwrite output file (default ‘update’)
--replace move infile to a backup copy (appending ‘~’)
-s, --strip export by stripping text or code
-t, --txt2code convert text source to code source
Here are some key features of "PyLit":
· Dual Source
· Markup with reStructuredText
· Python Doctest Support
· The parallel existence of code and text formats might lead to confusion on which is the up to date, authoritative source.
· While by default, an output file is not overwritten if it is newer than the input file, loss of changes can occur when both formats are edited in parallel.
· PyLit does not allow the specification of a separate output file for individual code blocks like e.g. noweb. The “dual source” concept limits the choice to one output file per input file. However, this can be compensated by the use of the include directive. See the tutorial for an example.
· Only one comment string (including whitespace) can be specified as “text block marker”.
What's New in This Release: [ read full changelog ]
· Bugfix: ignore blank lines in test for end of code block