Skip to content

Instantly share code, notes, and snippets.

@macroscopicentric
Created October 10, 2014 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macroscopicentric/c25069735090e6138817 to your computer and use it in GitHub Desktop.
Save macroscopicentric/c25069735090e6138817 to your computer and use it in GitHub Desktop.
Boilerplate script for creating new project repos.
import sys
import subprocess
def make_boilerplate(directory):
#Don't split and add shell=True arg to subprocess to concatenate commands.
mkdir = 'mkdir {0}'
tests = 'mkdir {0}/tests && touch {0}/tests/__init__.py && touch {0}/__init__.py'
# virtualenv_config = 'mkvirtualenv {0} && pip install nose'
git_setup = 'git -C {0} init && echo "*.pyc" > {0}/.gitignore && git -C {0} add -A && git -C {0} commit -m "Boilerplate repo."'
commands = [mkdir, tests, git_setup]
for command in commands:
subprocess.call(command.format(directory), shell=True)
if __name__ == '__main__':
make_boilerplate(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment