Home | Legal Tech | Music | Projects | Writings

Contract Creator

Create contracts on the fly from the command line.

Automating documents is a piece of cake. In this case, it's literally a matter of inserting curly braces around the parts of your document which you want to replace with a variable, like a company name or a date. This method can be applied to any document you happen to have handy.

The problem

When you are preparing dozens of the same document every day, you can either fork out thousands of points for bespoke software, or follow this tutorial and create tailored agreements from the comfort of the command line.

Tasklist

  1. Install the docxtpl module
  2. Create our template in docx (as used by Microsoft Word and other word processors)
  3. Write the script to generate the document
  4. Insert the variables from within the command line

1. Install the module

The module we need to install is called "docxtpl".

If you are unsure how to install this module, check the guide at python basics.

2. Create the template

3. Write the script

This step is as simple as pasting the code below into a new python file.

4. Create the document