internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: scikit-hep/pyhf

Issue:
Add link back to GitHub on webpage
At the moment there is no link on [the docs webpage](http://diana-hep.org/pyhf/) back to the pyhf GitHub page. It would be nice to add one to make navigation between the two easier.

Perhaps a ["Fork me on GitHub" ribbon](https://blog.github.com/2008-12-19-github-ribbons/)?



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -20,6 +20,9 @@
 import sys
 sys.path.insert(0, os.path.abspath('..'))
 
+def setup(app):
+    app.add_stylesheet('https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.2/gh-fork-ribbon.min.css')
+
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.


Test patch:
Repository: scikit-hep/pyhf

Issue:
Binder master build and Example Notebook breaks
# Description

the spec must be build as `Model({'channels': parsed['channels']})`

we should fix this and add a test so we are protected against future regressions


Discussion:

Resolving patch:
diff --git a/binder/trigger_binder.py b/binder/trigger_binder.py
new file mode 100644
--- /dev/null
+++ b/binder/trigger_binder.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import argparse
+import time
+from selenium import webdriver
+from selenium.webdriver.chrome.options import Options
+
+
+def main(args):
+    options = Options()
+    options.set_headless()
+    options.add_argument('--no-sandbox')
+    if args.chromedriver_path is not None:
+        driver = webdriver.Chrome(args.chromedriver_path, chrome_options=options)
+    else:
+        driver = webdriver.Chrome(chrome_options=options)
+    if args.is_verbose:
+        print('Chrome Headless Browser Invoked')
+    driver.get(args.url)
+    time.sleep(10)
+    driver.close()
+
+
+if __name__ == '__main__':
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-v', '--verbose', dest='is_verbose',
+                        action='store_true',
+                        help='Print out more information')
+    parser.add_argument('--chromedriver-path', dest='chromedriver_path',
+                        type=str, default=None, help='System path to ChromeDriver')
+    parser.add_argument('--url', dest='url',
+                        type=str, default=None, help='URL for Selinium to open')
+    args = parser.parse_args()
+
+    main(args)
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -37,6 +37,7 @@
         'coverage>=4.0',  # coveralls
         'matplotlib',
         'jupyter',
+        'nbdime',
         'uproot>=3.0.0',
         'papermill',
         'graphviz',


Test patch:
diff --git a/tests/test_notebooks.py b/tests/test_notebooks.py
--- a/tests/test_notebooks.py
+++ b/tests/test_notebooks.py
@@ -1,4 +1,5 @@
 import sys
+import os
 import papermill as pm
 
 
@@ -12,6 +13,13 @@ def test_notebooks(tmpdir):
     pm.execute_notebook(
         'docs/examples/notebooks/hello-world.ipynb', **common_kwargs)
 
+    if sys.version_info.major > 2:
+        # The Binder example uses specific relative paths
+        cwd = os.getcwd()
+        os.chdir(os.path.join(cwd, 'docs/examples/notebooks/binderexample'))
+        pm.execute_notebook('StatisticalAnalysis.ipynb', **common_kwargs)
+        os.chdir(cwd)
+
     pm.execute_notebook(
         'docs/examples/notebooks/learn/InterpolationCodes.ipynb', **common_kwargs)
Repository: scikit-hep/pyhf

Issue:
Add --version flag to pyhf CLI
# Description

As [suggested by Lukas](https://github.com/diana-hep/pyhf/pull/304#issuecomment-428856809), adding a `--version` flag to the pyhf CLI could be useful.


Discussion:

Resolving patch:
diff --git a/pyhf/commandline.py b/pyhf/commandline.py
--- a/pyhf/commandline.py
+++ b/pyhf/commandline.py
@@ -12,9 +12,11 @@
 from . import writexml
 from .utils import runOnePoint
 from .pdf import Model
+from .version import __version__
 
 
 @click.group(context_settings=dict(help_option_names=['-h', '--help']))
+@click.version_option(version=__version__)
 def pyhf():
     pass
 


Test patch:
Repository: scikit-hep/pyhf

Issue:
bumpversion missing from setup.py[develop]
# Description

As titled, `bumpversion` is not in list of develop dependencies.

# Expected Behavior

Installing `pyhf` installs `bumpversion`.

# Actual Behavior

It does not install `bumpversion`.

# Steps to Reproduce

`pip install pyhf[develop]`

# Checklist

- [x] Run `git fetch` to get the most up to date version of `master`
- [x] Searched through existing Issues to confirm this is not a duplicate issue
- [x] Filled out the Description, Expected Behavior, Actual Behavior, and Steps to Reproduce sections above or have edited/removed them in a way that fully describes the issue



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -35,6 +35,7 @@
         'uproot>=3.0.0',
         'papermill',
         'graphviz',
+        'bumpversion',
         'sphinx',
         'sphinxcontrib-bibtex',
         'sphinxcontrib-napoleon',


Test patch:
Repository: scikit-hep/pyhf

Issue:
Add README to PyPI
# Description

At the moment we have no README for the [PyPI page](https://pypi.org/project/pyhf/0.0.15/). The addition of one would be a nice touch (even though I assume that most users will discover the project through GitHub).


Discussion:
Note to self (as I've assigned this to myself): Use [`twine` to make sure that the README renders correctly.](https://pythonbytes.fm/episodes/show/97/java-goes-paid). It might be worth making this part of the set of tests.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 
 from setuptools import setup, find_packages
+from os import path
+
+this_directory = path.abspath(path.dirname(__file__))
+with open(path.join(this_directory, 'README.md'), encoding='utf-8') as readme_md:
+    long_description = readme_md.read()
 
 extras_require = {
     'tensorflow': [
@@ -46,6 +51,7 @@
         'ipython<7',  # jupyter_console and ipython clash in dependency requirement -- downgrade ipython for now
         'pre-commit',
         'black;python_version>="3.6"',  # Black is Python3 only
+        'twine',
     ],
 }
 extras_require['complete'] = sorted(set(sum(extras_require.values(), [])))
@@ -54,6 +60,8 @@
     name='pyhf',
     version='0.0.15',
     description='(partial) pure python histfactory implementation',
+    long_description=long_description,
+    long_description_content_type='text/markdown',
     url='https://github.com/diana-hep/pyhf',
     author='Lukas Heinrich',
     author_email='lukas.heinrich@cern.ch',


Test patch:
Repository: scikit-hep/pyhf

Issue:
Lock Tensorflow to 1.11.0 release until TensorFlow probability has caught up
# Description

[TensorFlow 1.12.0 has been released](https://github.com/tensorflow/tensorflow/releases/tag/v1.12.0) and it has breaking changes. Most notably

> Remove `tf.contrib.linalg`. `tf.linalg` should be used instead. 

This doesn't affect us, but it does affect [TensorFlow Probability `v0.3.0`, which breaks](https://travis-ci.org/diana-hep/pyhf/jobs/451151767#L668-L685):

```
ImportError while loading conftest '/home/travis/build/diana-hep/pyhf/tests/conftest.py'.
tests/conftest.py:46: in <module>
    (pyhf.tensor.tensorflow_backend(session=tf.Session()), None)
pyhf/tensor/__init__.py:28: in __getattr__
    from .tensorflow_backend import tensorflow_backend
pyhf/tensor/tensorflow_backend.py:3: in <module>
    import tensorflow_probability as tfp
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/tensorflow_probability/__init__.py:21: in <module>
    from tensorflow_probability.python import *  # pylint: disable=wildcard-import
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/tensorflow_probability/python/__init__.py:22: in <module>
    from tensorflow_probability.python import distributions
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/tensorflow_probability/python/distributions/__init__.py:44: in <module>
    from tensorflow_probability.python.distributions.linear_gaussian_ssm import LinearGaussianStateSpaceModel
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/tensorflow_probability/python/distributions/linear_gaussian_ssm.py:34: in <module>
    tfl = tf.contrib.linalg
../../../virtualenv/python3.6.3/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py:54: in __getattr__
    return getattr(module, item)
E   AttributeError: module 'tensorflow.contrib' has no attribute 'linalg'
```

Until `tfp` updates to using `v1.12` we'll have to lock to them.

## Related Issues

- Issue #330 

# Checklist

- [x] Run `git fetch` to get the most up to date version of `master`
- [x] Searched through existing Issues to confirm this is not a duplicate issue
- [x] Filled out the Description, Expected Behavior, Actual Behavior, and Steps to Reproduce sections above or have edited/removed them in a way that fully describes the issue



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
 
 extras_require = {
     'tensorflow': [
-        'tensorflow>=1.10.0',
+        'tensorflow<1.12.0,>=1.10.0',
         'tensorflow-probability==0.3.0',
         'numpy<=1.14.5,>=1.14.0',  # Lower of 1.14.0 instead of 1.13.3 to ensure doctest pass
         'setuptools<=39.1.0',


Test patch:
Repository: scikit-hep/pyhf

Issue:
consolidation: add simplemodls to __all__
# Description

It would be nice if the snippet in the README could be shorter:

right now this is needed
```
import pyhf
import pyhf.simplemodels
pdf = pyhf.simplemodels.hepdata_like(signal_data=[12.0], bkg_data=[50.0], bkg_uncerts=[3.0])
CLs_obs = pyhf.utils.hypotest(1.0, [51] + pdf.config.auxdata, pdf)
```

whereas if we pre-import `simplemodels` it could be 
```
import pyhf
pdf = pyhf.simplemodels.hepdata_like(signal_data=[12.0], bkg_data=[50.0], bkg_uncerts=[3.0])
CLs_obs = pyhf.utils.hypotest(1.0, [51] + pdf.config.auxdata, pdf)
```

since `simplemodels.py` doesn't add much code, i don't think it would slow down things a lot


Discussion:
> since `simplemodels.py` doesn't add much code, i don't think it would slow down things a lot

We have a test that measures how long it takes to import `pyhf`. So we can make the change in a PR and see if tests pass :) 

Resolving patch:
diff --git a/pyhf/__init__.py b/pyhf/__init__.py
--- a/pyhf/__init__.py
+++ b/pyhf/__init__.py
@@ -82,5 +82,6 @@ def set_backend(backend, custom_optimizer=None):
 
 
 from .pdf import Model
+from . import simplemodels
 
-__all__ = ['Model', 'utils', 'modifiers', '__version__']
+__all__ = ['Model', 'utils', 'modifiers', 'simplemodels', '__version__']


Test patch:
diff --git a/tests/test_pdf.py b/tests/test_pdf.py
--- a/tests/test_pdf.py
+++ b/tests/test_pdf.py
@@ -1,6 +1,5 @@
 import pyhf
 import pytest
-import pyhf.simplemodels
 import pyhf.exceptions
 import numpy as np
 import json
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -2,8 +2,6 @@
 import pytest
 
 import pyhf
-import pyhf.simplemodels
-import pyhf.utils
 
 
 def test_get_default_schema():
Repository: scikit-hep/pyhf

Issue:
papermill seems to break? pin version?
# Description

In the CI for @nikoladze's PR https://github.com/diana-hep/pyhf/pull/365 it seems like papermill is breaking for unrelated reasons. Did something change upstream? Maybe we need to pin the version? Maybe @matthewfeickert knows?


https://travis-ci.org/diana-hep/pyhf/jobs/454931484


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@
     'minuit': ['iminuit'],
     'develop': [
         'pyflakes',
-        'pytest>=3.5.1',
+        'pytest<4.0.0,>=3.5.1',
         'pytest-cov>=2.5.1',
         'pytest-benchmark[histogram]',
         'pytest-console-scripts',
@@ -41,7 +41,7 @@
         'jupyter',
         'nbdime',
         'uproot>=3.0.0',
-        'papermill',
+        'papermill>=0.16.0',
         'graphviz',
         'bumpversion',
         'sphinx',


Test patch:
diff --git a/tests/test_notebooks.py b/tests/test_notebooks.py
--- a/tests/test_notebooks.py
+++ b/tests/test_notebooks.py
@@ -6,7 +6,7 @@
 def test_notebooks(tmpdir):
     outputnb = tmpdir.join('output.ipynb')
     common_kwargs = {
-        'output': str(outputnb),
+        'output_path': str(outputnb),
         'kernel_name': 'python{}'.format(sys.version_info.major),
     }
Repository: scikit-hep/pyhf

Issue:
Update tensorflow-probability to the next release that includes continuous approximations
# Description

This is a follow up to #302. As the bug is fixed in upstream tensorflow-probability, we just need to wait for a new release to be shipped.

This bug was because of a change in the API to get rid of the continuous approximation to the Poisson pmf which broke our tests.

### Describe the solution you'd like

Unfix tensorflow-probability to `0.3.0` and bump to the next available release post-0.4.0.
Update Tensorflow to TensorFlow 1.12.0 release
# Description

[TensorFlow 1.12.0 has been released](https://github.com/tensorflow/tensorflow/releases/tag/v1.12.0) and it has breaking changes. Most notably

> Remove `tf.contrib.linalg`. `tf.linalg` should be used instead. 

Once there is a new release of TensorFlow probability (`v0.5.0` &mdash; c.f. Issue #360 and #330) that upgrades to `v1.12.0` then we can follow them in upgrading.



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,8 +12,8 @@
 
 extras_require = {
     'tensorflow': [
-        'tensorflow<1.12.0,>=1.10.0',
-        'tensorflow-probability==0.3.0',
+        'tensorflow>=1.12.0',
+        'tensorflow-probability>=0.5.0',
         'numpy<=1.14.5,>=1.14.0',  # Lower of 1.14.0 instead of 1.13.3 to ensure doctest pass
         'setuptools<=39.1.0',
     ],


Test patch:
Repository: scikit-hep/pyhf

Issue:
Use Binder Build API for Builds in PRs
# Description

After a discussion with @minrk and @betatim on the jupyterhub/binder Gitter, it was made clear that the use of Selenium in [`binder/trigger_binder.py`](https://github.com/diana-hep/pyhf/blob/c81f6007309f4c13241f9efac187594337d0bd08/binder/trigger_binder.py) (and the script itself) is unnecessary. Instead a simple API call can be made just using Python's `webbrowser` with an [endpoint of the form `https://mybinder.org/build/gh/owner/repo/ref`](https://gitter.im/jupyterhub/binder?at=5c2f87038dafa715c73ff54f) as can be [seen in the Binder Hub demo](https://github.com/jupyterhub/binderhub/blob/9ca8fa68bb8b69c6a2736f2275279583073f314f/examples/binder-api.py#L28) (thanks Tim for the link).

So, for example

```
python -m webbrowser "https://mybinder.org/build/gh/diana-hep/pyhf/master"
```

So asking [WWKHTD](https://github.com/kelseyhightower/nocode), this means that `binder/trigger_binder.py` is unnecessary and should be removed and `.travis.yml` should be updated to use the API calls.


Discussion:

Resolving patch:
diff --git a/binder/trigger_binder.py b/binder/trigger_binder.py
deleted file mode 100644
--- a/binder/trigger_binder.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-from contextlib import contextmanager
-from selenium import webdriver
-from selenium.webdriver.chrome.options import Options
-from selenium.webdriver.support.ui import WebDriverWait
-from selenium.webdriver.support.expected_conditions import staleness_of
-
-
-class SeleniumSession:
-    def __init__(self, args):
-        self.options = Options()
-        self.options.set_headless()
-        self.options.add_argument('--no-sandbox')
-        if args.chromedriver_path is not None:
-            self.browser = webdriver.Chrome(
-                args.chromedriver_path, chrome_options=self.options
-            )
-        else:
-            self.browser = webdriver.Chrome(chrome_options=self.options)
-
-    @contextmanager
-    def wait_for_page_load(self, timeout=20):
-        old_page = self.browser.find_element_by_tag_name('html')
-        yield
-        WebDriverWait(self.browser, timeout).until(staleness_of(old_page))
-
-    def trigger_binder(self, url):
-        with self.wait_for_page_load():
-            self.browser.get(url)
-
-
-def main(args):
-    driver = SeleniumSession(args)
-    if args.is_verbose:
-        print('Chrome Headless Browser Invoked')
-    driver.trigger_binder(args.url)
-
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser()
-    parser.add_argument(
-        '-v',
-        '--verbose',
-        dest='is_verbose',
-        action='store_true',
-        help='Print out more information',
-    )
-    parser.add_argument(
-        '--chromedriver-path',
-        dest='chromedriver_path',
-        type=str,
-        default=None,
-        help='System path to ChromeDriver',
-    )
-    parser.add_argument(
-        '--url', dest='url', type=str, default=None, help='URL for Selinium to open'
-    )
-    args = parser.parse_args()
-
-    main(args)


Test patch:
Repository: scikit-hep/pyhf

Issue:
Pin optional dependencies at the minor release level
# Description

To avoid having our prior releases break like `v0.0.15` did in Issue #396 it would be good to pin our optional dependencies at the minor release level for each release. This should safeguard us from old releases getting broken by API changes in the dependencies that we use as applications.

To be clear, I don't think we should limit the dependencies in `install_requires` beyond placing _lower_ bounds, but I do think that we should now be placing upper bounds on all of the optional dependencies as we are really more using those as **applications** in our library.


Discussion:
This should also make the CI more robust so that we don't have to drop everything and do CI debugging as often.

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -12,18 +12,13 @@
 
 extras_require = {
     'tensorflow': [
-        'tensorflow>=1.12.0',
-        'tensorflow-probability>=0.5.0',
+        'tensorflow~=1.13',
+        'tensorflow-probability~=0.5',
         'numpy<=1.14.5,>=1.14.0',  # Lower of 1.14.0 instead of 1.13.3 to ensure doctest pass
         'setuptools<=39.1.0',
     ],
-    'torch': ['torch>=1.0.0'],
-    'mxnet': [
-        'mxnet>=1.0.0',
-        'requests<2.19.0,>=2.18.4',
-        'numpy<1.15.0,>=1.8.2',
-        'requests<2.19.0,>=2.18.4',
-    ],
+    'torch': ['torch~=1.0'],
+    'mxnet': ['mxnet~=1.0', 'requests~=2.18.4', 'numpy<1.15.0,>=1.8.2'],
     # 'dask': [
     #     'dask[array]'
     # ],
@@ -31,7 +26,7 @@
     'minuit': ['iminuit'],
     'develop': [
         'pyflakes',
-        'pytest<4.0.0,>=3.5.1',
+        'pytest~=3.5',
         'pytest-cov>=2.5.1',
         'pytest-mock',
         'pytest-benchmark[histogram]',
@@ -41,8 +36,8 @@
         'matplotlib',
         'jupyter',
         'nbdime',
-        'uproot>=3.3.0',
-        'papermill>=0.16.0',
+        'uproot~=3.3',
+        'papermill~=0.16',
         'graphviz',
         'bumpversion',
         'sphinx',


Test patch:
Repository: scikit-hep/pyhf

Issue:
Add FAQ RE: how to use xml2json CLI tool
# Description

Add a section to the FAQ RE: how to install the `xmlimport` optional dependencies and how to use the `xml2json` CLI tool.

This could also be an entire example Jupyter notebook on using the CLI and then have the FAQ be just on how to install the `xmlimport` dependencies.



Discussion:

Resolving patch:
diff --git a/pyhf/commandline.py b/pyhf/commandline.py
--- a/pyhf/commandline.py
+++ b/pyhf/commandline.py
@@ -52,7 +52,7 @@ def xml2json(entrypoint_xml, basedir, output_file, track_progress):
     except ImportError:
         log.error(
             "xml2json requires uproot, please install pyhf using the "
-            "xmlimport extra: pip install pyhf[xmlimport] or install uproot "
+            "xmlio extra: pip install pyhf[xmlio] or install uproot "
             "manually: pip install uproot"
         )
     from . import readxml
@@ -74,6 +74,17 @@ def xml2json(entrypoint_xml, basedir, output_file, track_progress):
 @click.option('--dataroot', default='data')
 @click.option('--resultprefix', default='FitConfig')
 def json2xml(workspace, output_dir, specroot, dataroot, resultprefix):
+    try:
+        import uproot
+
+        assert uproot
+    except ImportError:
+        log.error(
+            "json2xml requires uproot, please install pyhf using the "
+            "xmlio extra: pip install pyhf[xmlio] or install uproot "
+            "manually: pip install uproot"
+        )
+
     ensure_dirs(output_dir)
     with click.open_file(workspace, 'r') as specstream:
         d = json.load(specstream)
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
     # 'dask': [
     #     'dask[array]'
     # ],
-    'xmlimport': ['uproot'],
+    'xmlio': ['uproot'],
     'minuit': ['iminuit'],
     'develop': [
         'pyflakes',


Test patch:
diff --git a/tests/test_notebooks.py b/tests/test_notebooks.py
--- a/tests/test_notebooks.py
+++ b/tests/test_notebooks.py
@@ -12,6 +12,10 @@ def test_notebooks(tmpdir):
 
     pm.execute_notebook('docs/examples/notebooks/hello-world.ipynb', **common_kwargs)
 
+    pm.execute_notebook(
+        'docs/examples/notebooks/XML_ImportExport.ipynb', **common_kwargs
+    )
+
     if sys.version_info.major > 2:
         # The Binder example uses specific relative paths
         cwd = os.getcwd()
Repository: scikit-hep/pyhf

Issue:
Test Deploy feature is broken
# Description

See https://github.com/FaradayRF/faradayio/issues/35 for a related issue - I think. Failing job on master here: https://travis-ci.org/diana-hep/pyhf/builds/517678508?utm_source=github_status&utm_medium=notification

# Expected Behavior

Expect it to pass.

# Actual Behavior

Observe it failing.

# Checklist

- [x] Run `git fetch` to get the most up to date version of `master`
- [x] Searched through existing Issues to confirm this is not a duplicate issue
- [x] Filled out the Description, Expected Behavior, Actual Behavior, and Steps to Reproduce sections above or have edited/removed them in a way that fully describes the issue



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -56,6 +56,29 @@
 }
 extras_require['complete'] = sorted(set(sum(extras_require.values(), [])))
 
+
+def _is_test_pypi():
+    """
+    Determine if the Travis CI environment has TESTPYPI_UPLOAD defined and
+    set to true (c.f. .travis.yml)
+
+    The use_scm_version kwarg accepts a callable for the local_scheme
+    configuration parameter with argument "version". This can be replaced
+    with a lambda as the desired version structure is {next_version}.dev{distance}
+    c.f. https://github.com/pypa/setuptools_scm/#importing-in-setuppy
+
+    As the scm versioning is only desired for TestPyPI, for depolyment to PyPI the version
+    controlled through bumpversion is used.
+    """
+    from os import getenv
+
+    return (
+        {'local_scheme': lambda version: ''}
+        if getenv('TESTPYPI_UPLOAD') == 'true'
+        else False
+    )
+
+
 setup(
     name='pyhf',
     version='0.0.16',
@@ -88,4 +111,5 @@
     extras_require=extras_require,
     entry_points={'console_scripts': ['pyhf=pyhf.commandline:pyhf']},
     dependency_links=[],
+    use_scm_version=_is_test_pypi(),
 )


Test patch: