We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Automate deployment to PyPI
# Description

According to @lukasheinrich, the current workflow for deploying to PyPI is:

```
git checkout master
git pull
bumpversion patch
git commit
git push origin master --tags
```

This is a bit annoyingly manual and ideally should be done automatically.

Luckily, there is an [official PyPA GitHub action](https://discuss.python.org/t/official-github-action-for-publishing-to-pypi/1061) to do this:

https://github.com/pypa/gh-action-pypi-publish

However, we need GitHub actions for pyhf, so we have to wait.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 from setuptools import setup, find_packages
2 from os import path
3 import sys
4 
5 this_directory = path.abspath(path.dirname(__file__))
6 if sys.version_info.major < 3:
7     from io import open
8 with open(path.join(this_directory, 'README.md'), encoding='utf-8') as readme_md:
9     long_description = readme_md.read()
10 
11 extras_require = {
12     'tensorflow': ['tensorflow~=1.15', 'tensorflow-probability~=0.8', 'numpy~=1.16',],
13     'torch': ['torch~=1.2'],
14     'xmlio': ['uproot'],
15     'minuit': ['iminuit'],
16     'develop': [
17         'pyflakes',
18         'pytest~=3.5',
19         'pytest-cov>=2.5.1',
20         'pytest-mock',
21         'pytest-benchmark[histogram]',
22         'pytest-console-scripts',
23         'pydocstyle',
24         'coverage>=4.0',  # coveralls
25         'matplotlib',
26         'jupyter',
27         'nbdime',
28         'uproot~=3.3',
29         'papermill~=1.0',
30         'nteract-scrapbook~=0.2',
31         'graphviz',
32         'bumpversion',
33         'sphinx',
34         'sphinxcontrib-bibtex',
35         'sphinxcontrib-napoleon',
36         'sphinx_rtd_theme',
37         'nbsphinx',
38         'sphinx-issues',
39         'm2r',
40         'jsonpatch',
41         'ipython',
42         'pre-commit',
43         'black;python_version>="3.6"',  # Black is Python3 only
44         'twine',
45         'check-manifest',
46     ],
47 }
48 extras_require['complete'] = sorted(set(sum(extras_require.values(), [])))
49 
50 
51 def _is_test_pypi():
52     """
53     Determine if the Travis CI environment has TESTPYPI_UPLOAD defined and
54     set to true (c.f. .travis.yml)
55 
56     The use_scm_version kwarg accepts a callable for the local_scheme
57     configuration parameter with argument "version". This can be replaced
58     with a lambda as the desired version structure is {next_version}.dev{distance}
59     c.f. https://github.com/pypa/setuptools_scm/#importing-in-setuppy
60 
61     As the scm versioning is only desired for TestPyPI, for depolyment to PyPI the version
62     controlled through bumpversion is used.
63     """
64     from os import getenv
65 
66     return (
67         {'local_scheme': lambda version: ''}
68         if getenv('TESTPYPI_UPLOAD') == 'true'
69         else False
70     )
71 
72 
73 setup(
74     name='pyhf',
75     version='0.2.0',
76     description='(partial) pure python histfactory implementation',
77     long_description=long_description,
78     long_description_content_type='text/markdown',
79     url='https://github.com/diana-hep/pyhf',
80     author='Lukas Heinrich, Matthew Feickert, Giordon Stark',
81     author_email='lukas.heinrich@cern.ch, matthew.feickert@cern.ch, gstark@cern.ch',
82     license='Apache',
83     keywords='physics fitting numpy scipy tensorflow pytorch',
84     classifiers=[
85         "Programming Language :: Python :: 2",
86         "Programming Language :: Python :: 2.7",
87         "Programming Language :: Python :: 3",
88         "Programming Language :: Python :: 3.6",
89         "Programming Language :: Python :: 3.7",
90     ],
91     package_dir={'': 'src'},
92     packages=find_packages(where='src'),
93     include_package_data=True,
94     python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*",
95     install_requires=[
96         'scipy',  # requires numpy, which is required by pyhf and tensorflow
97         'click>=6.0',  # for console scripts,
98         'tqdm',  # for readxml
99         'six',  # for modifiers
100         'jsonschema>=v3.0.0a2',  # for utils, alpha-release for draft 6
101         'jsonpatch',
102         'pyyaml',  # for parsing CLI equal-delimited options
103     ],
104     extras_require=extras_require,
105     entry_points={'console_scripts': ['pyhf=pyhf.commandline:pyhf']},
106     dependency_links=[],
107     use_scm_version=_is_test_pypi(),
108 )
109
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -50,8 +50,8 @@
 
 def _is_test_pypi():
     """
-    Determine if the Travis CI environment has TESTPYPI_UPLOAD defined and
-    set to true (c.f. .travis.yml)
+    Determine if the CI environment has IS_TESTPYPI defined and
+    set to true (c.f. .github/workflows/publish-package.yml)
 
     The use_scm_version kwarg accepts a callable for the local_scheme
     configuration parameter with argument "version". This can be replaced
@@ -65,7 +65,7 @@
 
     return (
         {'local_scheme': lambda version: ''}
-        if getenv('TESTPYPI_UPLOAD') == 'true'
+        if getenv('IS_TESTPYPI') == 'true'
         else False
     )

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -50,8 +50,8 @@\n \n def _is_test_pypi():\n     \"\"\"\n-    Determine if the Travis CI environment has TESTPYPI_UPLOAD defined and\n-    set to true (c.f. .travis.yml)\n+    Determine if the CI environment has IS_TESTPYPI defined and\n+    set to true (c.f. .github/workflows/publish-package.yml)\n \n     The use_scm_version kwarg accepts a callable for the local_scheme\n     configuration parameter with argument \"version\". This can be replaced\n@@ -65,7 +65,7 @@\n \n     return (\n         {'local_scheme': lambda version: ''}\n-        if getenv('TESTPYPI_UPLOAD') == 'true'\n+        if getenv('IS_TESTPYPI') == 'true'\n         else False\n     )\n", "issue": "Automate deployment to PyPI\n# Description\r\n\r\nAccording to @lukasheinrich, the current workflow for deploying to PyPI is:\r\n\r\n```\r\ngit checkout master\r\ngit pull\r\nbumpversion patch\r\ngit commit\r\ngit push origin master --tags\r\n```\r\n\r\nThis is a bit annoyingly manual and ideally should be done automatically.\r\n\r\nLuckily, there is an [official PyPA GitHub action](https://discuss.python.org/t/official-github-action-for-publishing-to-pypi/1061) to do this:\r\n\r\nhttps://github.com/pypa/gh-action-pypi-publish\r\n\r\nHowever, we need GitHub actions for pyhf, so we have to wait.\n", "before_files": [{"content": "from setuptools import setup, find_packages\nfrom os import path\nimport sys\n\nthis_directory = path.abspath(path.dirname(__file__))\nif sys.version_info.major < 3:\n    from io import open\nwith open(path.join(this_directory, 'README.md'), encoding='utf-8') as readme_md:\n    long_description = readme_md.read()\n\nextras_require = {\n    'tensorflow': ['tensorflow~=1.15', 'tensorflow-probability~=0.8', 'numpy~=1.16',],\n    'torch': ['torch~=1.2'],\n    'xmlio': ['uproot'],\n    'minuit': ['iminuit'],\n    'develop': [\n        'pyflakes',\n        'pytest~=3.5',\n        'pytest-cov>=2.5.1',\n        'pytest-mock',\n        'pytest-benchmark[histogram]',\n        'pytest-console-scripts',\n        'pydocstyle',\n        'coverage>=4.0',  # coveralls\n        'matplotlib',\n        'jupyter',\n        'nbdime',\n        'uproot~=3.3',\n        'papermill~=1.0',\n        'nteract-scrapbook~=0.2',\n        'graphviz',\n        'bumpversion',\n        'sphinx',\n        'sphinxcontrib-bibtex',\n        'sphinxcontrib-napoleon',\n        'sphinx_rtd_theme',\n        'nbsphinx',\n        'sphinx-issues',\n        'm2r',\n        'jsonpatch',\n        'ipython',\n        'pre-commit',\n        'black;python_version>=\"3.6\"',  # Black is Python3 only\n        'twine',\n        'check-manifest',\n    ],\n}\nextras_require['complete'] = sorted(set(sum(extras_require.values(), [])))\n\n\ndef _is_test_pypi():\n    \"\"\"\n    Determine if the Travis CI environment has TESTPYPI_UPLOAD defined and\n    set to true (c.f. .travis.yml)\n\n    The use_scm_version kwarg accepts a callable for the local_scheme\n    configuration parameter with argument \"version\". This can be replaced\n    with a lambda as the desired version structure is {next_version}.dev{distance}\n    c.f. https://github.com/pypa/setuptools_scm/#importing-in-setuppy\n\n    As the scm versioning is only desired for TestPyPI, for depolyment to PyPI the version\n    controlled through bumpversion is used.\n    \"\"\"\n    from os import getenv\n\n    return (\n        {'local_scheme': lambda version: ''}\n        if getenv('TESTPYPI_UPLOAD') == 'true'\n        else False\n    )\n\n\nsetup(\n    name='pyhf',\n    version='0.2.0',\n    description='(partial) pure python histfactory implementation',\n    long_description=long_description,\n    long_description_content_type='text/markdown',\n    url='https://github.com/diana-hep/pyhf',\n    author='Lukas Heinrich, Matthew Feickert, Giordon Stark',\n    author_email='lukas.heinrich@cern.ch, matthew.feickert@cern.ch, gstark@cern.ch',\n    license='Apache',\n    keywords='physics fitting numpy scipy tensorflow pytorch',\n    classifiers=[\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    package_dir={'': 'src'},\n    packages=find_packages(where='src'),\n    include_package_data=True,\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*\",\n    install_requires=[\n        'scipy',  # requires numpy, which is required by pyhf and tensorflow\n        'click>=6.0',  # for console scripts,\n        'tqdm',  # for readxml\n        'six',  # for modifiers\n        'jsonschema>=v3.0.0a2',  # for utils, alpha-release for draft 6\n        'jsonpatch',\n        'pyyaml',  # for parsing CLI equal-delimited options\n    ],\n    extras_require=extras_require,\n    entry_points={'console_scripts': ['pyhf=pyhf.commandline:pyhf']},\n    dependency_links=[],\n    use_scm_version=_is_test_pypi(),\n)\n", "path": "setup.py"}], "after_files": [{"content": "from setuptools import setup, find_packages\nfrom os import path\nimport sys\n\nthis_directory = path.abspath(path.dirname(__file__))\nif sys.version_info.major < 3:\n    from io import open\nwith open(path.join(this_directory, 'README.md'), encoding='utf-8') as readme_md:\n    long_description = readme_md.read()\n\nextras_require = {\n    'tensorflow': ['tensorflow~=1.15', 'tensorflow-probability~=0.8', 'numpy~=1.16',],\n    'torch': ['torch~=1.2'],\n    'xmlio': ['uproot'],\n    'minuit': ['iminuit'],\n    'develop': [\n        'pyflakes',\n        'pytest~=3.5',\n        'pytest-cov>=2.5.1',\n        'pytest-mock',\n        'pytest-benchmark[histogram]',\n        'pytest-console-scripts',\n        'pydocstyle',\n        'coverage>=4.0',  # coveralls\n        'matplotlib',\n        'jupyter',\n        'nbdime',\n        'uproot~=3.3',\n        'papermill~=1.0',\n        'nteract-scrapbook~=0.2',\n        'graphviz',\n        'bumpversion',\n        'sphinx',\n        'sphinxcontrib-bibtex',\n        'sphinxcontrib-napoleon',\n        'sphinx_rtd_theme',\n        'nbsphinx',\n        'sphinx-issues',\n        'm2r',\n        'jsonpatch',\n        'ipython',\n        'pre-commit',\n        'black;python_version>=\"3.6\"',  # Black is Python3 only\n        'twine',\n        'check-manifest',\n    ],\n}\nextras_require['complete'] = sorted(set(sum(extras_require.values(), [])))\n\n\ndef _is_test_pypi():\n    \"\"\"\n    Determine if the CI environment has IS_TESTPYPI defined and\n    set to true (c.f. .github/workflows/publish-package.yml)\n\n    The use_scm_version kwarg accepts a callable for the local_scheme\n    configuration parameter with argument \"version\". This can be replaced\n    with a lambda as the desired version structure is {next_version}.dev{distance}\n    c.f. https://github.com/pypa/setuptools_scm/#importing-in-setuppy\n\n    As the scm versioning is only desired for TestPyPI, for depolyment to PyPI the version\n    controlled through bumpversion is used.\n    \"\"\"\n    from os import getenv\n\n    return (\n        {'local_scheme': lambda version: ''}\n        if getenv('IS_TESTPYPI') == 'true'\n        else False\n    )\n\n\nsetup(\n    name='pyhf',\n    version='0.2.0',\n    description='(partial) pure python histfactory implementation',\n    long_description=long_description,\n    long_description_content_type='text/markdown',\n    url='https://github.com/diana-hep/pyhf',\n    author='Lukas Heinrich, Matthew Feickert, Giordon Stark',\n    author_email='lukas.heinrich@cern.ch, matthew.feickert@cern.ch, gstark@cern.ch',\n    license='Apache',\n    keywords='physics fitting numpy scipy tensorflow pytorch',\n    classifiers=[\n        \"Programming Language :: Python :: 2\",\n        \"Programming Language :: Python :: 2.7\",\n        \"Programming Language :: Python :: 3\",\n        \"Programming Language :: Python :: 3.6\",\n        \"Programming Language :: Python :: 3.7\",\n    ],\n    package_dir={'': 'src'},\n    packages=find_packages(where='src'),\n    include_package_data=True,\n    python_requires=\">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*\",\n    install_requires=[\n        'scipy',  # requires numpy, which is required by pyhf and tensorflow\n        'click>=6.0',  # for console scripts,\n        'tqdm',  # for readxml\n        'six',  # for modifiers\n        'jsonschema>=v3.0.0a2',  # for utils, alpha-release for draft 6\n        'jsonpatch',\n        'pyyaml',  # for parsing CLI equal-delimited options\n    ],\n    extras_require=extras_require,\n    entry_points={'console_scripts': ['pyhf=pyhf.commandline:pyhf']},\n    dependency_links=[],\n    use_scm_version=_is_test_pypi(),\n)\n", "path": "setup.py"}]}