title: Why does Python Fabric replace underscores with hyphens?
body: <p>I'm trying to run this simple <a href="http://docs.fabfile.org/en/2.4/getting-started.html#addendum-the-fab-command-line-tool" rel="nofollow noreferrer">Fabric</a> example and am getting an unexpected error.</p>
  
  <pre><code># fabfile.py
  from fabric import task
  
  @task
  def upload_and_unpack(c):
      if c.run('test -f /home/jones/test.yml', warn=True).failed:
          c.put('test.yml', '/home/jones')
  </code></pre>
  
  <p></p>
  
  <pre><code>$ fab -H 'web.example.com' upload_and_unpack
  No idea what 'upload_and_unpack' is!
  </code></pre>
  
  <p></p>
  
  <pre><code>$ fab --list
  Available tasks:
  
    upload-and-unpack
  </code></pre>
  
  <p>As can be seen, Fabric seems to have replaced the underscores in my method with hyphens.  Here are my versions:</p>
  
  <pre><code>$ fab --version
  Fabric 2.4.0
  Paramiko 2.4.2
  Invoke 1.2.0
  </code></pre>
  
  <p>Why is Fabric doing this and how can I correct this error?  I see <a href="http://www.fabfile.org/upgrading.html#cli-arguments-options-and-behavior" rel="nofollow noreferrer">here</a> a note about task names getting converted from underscores to hyphens but why show and example that defines the method with underscores if Fabric converts them to hyphens?  What is the right way to write and execute a method like this?</p>