import fabric.api as fab


def generate_type_hierarchy():
    """
    Generate a document containing the available variable types.
    """
    fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')


@fab.task
def doc():
    generate_type_hierarchy()
    fab.local('sphinx-apidoc '
              '-o docs/developer_guide/api '
              '-f '
              '-e '
              'puresnmp '
              'puresnmp/test')
    with fab.lcd('docs'):
        fab.local('make html')


@fab.task
def publish():
    fab.local('python3 setup.py bdist_wheel --universal')
    fab.local('python3 setup.py sdist')
    fab.local('twine upload dist/*')

import fabric.api as fab


def generate_type_hierarchy():
    """
    Generate a document containing the available variable types.
    """
    fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')


@fab.task
def doc():
    generate_type_hierarchy()
    fab.local('sphinx-apidoc '
              '-o docs/developer_guide/api '
              '-f '
              '-e '
              'puresnmp '
              'puresnmp/test')
    with fab.lcd('docs'):
        fab.local('make html')


@fab.task
def publish():
    fab.local('rm -rf dist')
    fab.local('python3 setup.py bdist_wheel --universal')
    fab.local('python3 setup.py sdist')
    fab.local('twine upload dist/*')

Make sure "fab publish" cleans the dist folder
Make sure "fab publish" cleans the dist folder

This avoids accidentally uploading a package twice

  import fabric.api as fab
  
  
  def generate_type_hierarchy():
      """
      Generate a document containing the available variable types.
      """
      fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')
  
  
  @fab.task
  def doc():
      generate_type_hierarchy()
      fab.local('sphinx-apidoc '
                '-o docs/developer_guide/api '
                '-f '
                '-e '
                'puresnmp '
                'puresnmp/test')
      with fab.lcd('docs'):
          fab.local('make html')
  
  
  @fab.task
  def publish():
+     fab.local('rm -rf dist')
      fab.local('python3 setup.py bdist_wheel --universal')
      fab.local('python3 setup.py sdist')
      fab.local('twine upload dist/*')
  
Make sure "fab publish" cleans the dist folder
## Code Before:
import fabric.api as fab


def generate_type_hierarchy():
    """
    Generate a document containing the available variable types.
    """
    fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')


@fab.task
def doc():
    generate_type_hierarchy()
    fab.local('sphinx-apidoc '
              '-o docs/developer_guide/api '
              '-f '
              '-e '
              'puresnmp '
              'puresnmp/test')
    with fab.lcd('docs'):
        fab.local('make html')


@fab.task
def publish():
    fab.local('python3 setup.py bdist_wheel --universal')
    fab.local('python3 setup.py sdist')
    fab.local('twine upload dist/*')

## Instruction:
Make sure "fab publish" cleans the dist folder
## Code After:
import fabric.api as fab


def generate_type_hierarchy():
    """
    Generate a document containing the available variable types.
    """
    fab.local('./env/bin/python -m puresnmp.types > docs/typetree.rst')


@fab.task
def doc():
    generate_type_hierarchy()
    fab.local('sphinx-apidoc '
              '-o docs/developer_guide/api '
              '-f '
              '-e '
              'puresnmp '
              'puresnmp/test')
    with fab.lcd('docs'):
        fab.local('make html')


@fab.task
def publish():
    fab.local('rm -rf dist')
    fab.local('python3 setup.py bdist_wheel --universal')
    fab.local('python3 setup.py sdist')
    fab.local('twine upload dist/*')
