Cog is a file generation tool that allows users to use Python code as generators in their source files to generate text. It works by finding Python code embedded in the files, executing the code, and inserting the output back into the file. The marker lines indicate where the Python code begins and ends, and the output is written using the cog.outl function. Cog is designed to be easy to run, as it writes the results back into the original file while retaining the executed code. It can be run multiple times on the same file, and the Python code can be hidden within the marker lines. Cog requires Python 2.7, 3.5, 3.6, 3.7, 3.8, or Jython 2.5 for installation and is distributed under the MIT license.
https://nedbatchelder.com/code/cog/