docs: def setup_repo():
      r"""
      Creates default structure for a new repo
  
      CommandLine:
          python -m utool setup_repo --repo=dtool --codedir=~/code
  
          python -m utool setup_repo --repo=dtool --codedir=~/code
          python -m utool setup_repo --repo=ibeis-flukematch-module --codedir=~/code --modname=ibeis_flukematch
          python -m utool setup_repo --repo=mtgmonte --codedir=~/code --modname=mtgmonte
          python -m utool setup_repo --repo=pydarknet --codedir=~/code --modname=pydarknet
          python -m utool setup_repo --repo=sandbox_utools --codedir=~/code --modname=sandbox_utools
  
          python -m utool setup_repo --repo=ubelt --codedir=~/code --modname=ubelt -w
  
          python -m utool setup_repo
  
      Python:
          ipython
          import utool as ut
          ut.rrrr(0); ut.setup_repo()
  
      Example:
          >>> # DISABLE_DOCTEST
          >>> # SCRIPT
          >>> from utool.util_project import *  # NOQA
          >>> import utool as ut
          >>> result = setup_repo()
          >>> print(result)
      """
      print('\n [setup_repo]!')
      # import os
      from functools import partial
      import utool as ut
      # import os
      code_dpath  = ut.truepath(ut.get_argval('--code-dir', default='~/code'))
      _code_dpath = ut.unexpanduser(code_dpath)
      repo_fname = (ut.get_argval(('--repo', '--repo-name'), type_=str))
      repo_dpath = join(code_dpath, repo_fname)
      modname = ut.get_argval('--modname', default=repo_fname)
      ut.ensuredir(repo_dpath, verbose=True)
      _regencmd = 'python -m utool --tf setup_repo --repo={repo_fname} --codedir={_code_dpath} --modname={modname}'
      flake8_noqacmd = 'flake8' + ':noqa'
      regencmd = _regencmd.format(**locals())
      with ut.ChdirContext(repo_dpath):
          # os.chdir(repo_fname)
          locals_ = locals()
          force = True
  
          _ensure_text = partial(ensure_text, repo_dpath='.', force=None, locals_=locals_)
  
          _ensure_text(
              fname='todo.md',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  # {modname} TODO File
  
                  * Add TODOS!
                  # ENDBLOCK
                  ''')
          )
  
          _ensure_text(
              fname='README.md',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  # {modname} README FILE
                  # ENDBLOCK
                  ''')
          )
  
          _ensure_text(
              fname='setup.py',
              chmod='+x',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  #!/usr/bin/env python
                  """
                  Initially Generated By:
                      {regencmd} --force-{fname}
                  """
                  from __future__ import absolute_import, division, print_function, unicode_literals
                  from setuptools import setup
                  try:
                      from utool import util_setup
                  except ImportError:
                      print('ERROR: setup requires utool')
                      raise
  
                  INSTALL_REQUIRES = [
                      #'cython >= 0.21.1',
                      #'numpy >= 1.9.0',
                      #'scipy >= 0.16.0',
                  ]
  
                  CLUTTER_PATTERNS = [
                      # Patterns removed by python setup.py clean
                  ]
  
                  if __name__ == '__main__':
                      kwargs = util_setup.setuptools_setup(
                          setup_fpath=__file__,
                          name='{modname}',
                          packages=util_setup.find_packages(),
                          version=util_setup.parse_package_for_version('{modname}'),
                          license=util_setup.read_license('LICENSE'),
                          long_description=util_setup.parse_readme('README.md'),
                          ext_modules=util_setup.find_ext_modules(),
                          cmdclass=util_setup.get_cmdclass(),
                          #description='description of module',
                          #url='https://github.com/<username>/{repo_fname}.git',
                          #author='<author>',
                          #author_email='<author_email>',
                          keywords='',
                          install_requires=INSTALL_REQUIRES,
                          clutter_patterns=CLUTTER_PATTERNS,
                          #package_data={{'build': ut.get_dynamic_lib_globstrs()}},
                          #build_command=lambda: ut.std_build_command(dirname(__file__)),
                          classifiers=[],
                      )
                      setup(**kwargs)
                  # ENDBLOCK
                  '''
              )
          )
  
          _ensure_text(
              fname='.gitignore',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  *.py[cod]
  
                  # C extensions
                  *.so
                  # Packages
                  *.egg
                  *.egg-info
                  dist
                  build
                  eggs
                  parts
                  bin
                  var
                  sdist
                  develop-eggs
                  .installed.cfg
                  lib
                  lib64
                  __pycache__
  
                  # Installer logs
                  pip-log.txt
  
                  # Print Logs
                  logs
  
                  # Unit test / coverage reports
                  .coverage
                  .tox
                  nosetests.xml
  
                  # Translations
                  *.mo
  
                  # Mr Developer
                  .mr.developer.cfg
                  .project
                  .pydevproject
                  .DS_Store
                  *.dump.txt
                  *.sqlite3
  
                  # profiler
                  *.lprof
                  *.prof
  
                  *.flann
                  *.npz
  
                  # utool output
                  _timeings.txt
                  failed.txt
  
                  *.orig
                  _doc
                  timeings.txt
                  failed_doctests.txt
                  # ENDBLOCK
                  '''
              )
          )
  
          _ensure_text(
              fname=join(repo_dpath, modname, '__init__.py'),
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  # -*- coding: utf-8 -*-
                  # {flake8_noqacmd}
                  """
                  Initially Generated By:
                      {regencmd}
                  """
                  from __future__ import absolute_import, division, print_function, unicode_literals
                  import sys
                  __version__ = '0.0.0'
  
                  IMPORT_TUPLES = [
                      # ('<modname>', None),
                  ]
                  __DYNAMIC__ = '--nodyn' not in sys.argv
  
                  """
                  python -c "import {modname}" --dump-{modname}-init
                  python -c "import {modname}" --update-{modname}-init
                  """
  
                  DOELSE = False
                  if __DYNAMIC__:
                      # Dynamically import listed util libraries and their members.
                      from utool._internal import util_importer
                      ignore_endswith = []
                      import_execstr = util_importer.dynamic_import(
                          __name__, IMPORT_TUPLES, ignore_endswith=ignore_endswith)
                      exec(import_execstr)
                      DOELSE = False
                  else:
                      DOELSE = True
                  if DOELSE:
                      # <AUTOGEN_INIT>
                      pass
                      # </AUTOGEN_INIT>
                  # ENDBLOCK
                  '''
              )
          )
  
          _ensure_text(
              fname=join(repo_dpath, modname, '__main__.py'),
              chmod='+x',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  #!/usr/bin/env python
                  # -*- coding: utf-8 -*-
                  """
                  Initially Generated By:
                      {regencmd}
                  """
                  from __future__ import absolute_import, division, print_function, unicode_literals
  
  
                  def {modname}_main():
                      ignore_prefix = []
                      ignore_suffix = []
                      import utool as ut
                      ut.main_function_tester('{modname}', ignore_prefix, ignore_suffix)
  
                  if __name__ == '__main__':
                      """
                      Usage:
                          python -m {modname} <funcname>
                      """
                      print('Running {modname} main')
                      {modname}_main()
                  # ENDBLOCK
                  '''
              )
          )
  
          _ensure_text(
              fname='run_tests.py',
              chmod='+x',
              text=ut.codeblock(
                  r'''
                  # STARTBLOCK
                  #!/usr/bin/env python
                  """
                  Initially Generated By:
                      {regencmd} --force-{fname}
                  """
                  from __future__ import absolute_import, division, print_function
                  import sys
                  import utool as ut
  
  
                  def run_tests():
                      # Build module list and run tests
                      import sys
                      ut.change_term_title('RUN {modname} TESTS')
                      exclude_doctests_fnames = set([
                      ])
                      exclude_dirs = [
                          '_broken', 'old', 'tests', 'timeits',
                          '_scripts', '_timeits', '_doc', 'notebook',
                      ]
                      dpath_list = ['{modname}']
                      doctest_modname_list = ut.find_doctestable_modnames(
                          dpath_list, exclude_doctests_fnames, exclude_dirs)
  
                      coverage = ut.get_argflag(('--coverage', '--cov',))
                      if coverage:
                          import coverage
                          cov = coverage.Coverage(source=doctest_modname_list)
                          cov.start()
                          print('Starting coverage')
  
                          exclude_lines = [
                              'pragma: no cover',
                              'def __repr__',
                              'if self.debug:',
                              'if settings.DEBUG',
                              'raise AssertionError',
                              'raise NotImplementedError',
                              'if 0:',
                              'if ut.VERBOSE',
                              'if _debug:',
                              'if __name__ == .__main__.:',
                              'print(.*)',
                          ]
                          for line in exclude_lines:
                              cov.exclude(line)
  
                      for modname in doctest_modname_list:
                          exec('import ' + modname, globals())
                      module_list = [sys.modules[name] for name in doctest_modname_list]
  
                      nPass, nTotal, failed_cmd_list = ut.doctest_module_list(module_list)
  
                      if coverage:
                          print('Stoping coverage')
                          cov.stop()
                          print('Saving coverage')
                          cov.save()
                          print('Generating coverage html report')
                          cov.html_report()
  
                      if nPass != nTotal:
                          return 1
                      else:
                          return 0
  
                  if __name__ == '__main__':
                      import multiprocessing
                      multiprocessing.freeze_support()
                      retcode = run_tests()
                      sys.exit(retcode)
                  # ENDBLOCK
                  '''
              )
          )
  
      ut.ensuredir(join(repo_dpath, modname), verbose=True)