Skip to content

Commit

Permalink
Merge branch 'master' into feat/assertExpectedDataAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert authored Dec 7, 2021
2 parents b85b05b + 29bc6da commit b895617
Show file tree
Hide file tree
Showing 39 changed files with 588 additions and 237 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@ jobs:
|| (github.event_name == 'push' && github.ref != 'refs/heads/master' && contains(github.event.head_commit.message, '[ci all]'))
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]
exclude:
os: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9']
include:
- os: macos-latest
python-version: 3.7
- os: macos-latest
python-version: 3.8
python-version: '3.9'

steps:
- uses: actions/checkout@v2
Expand All @@ -50,7 +48,7 @@ jobs:
pytest -r sx --ignore tests/benchmarks/ --ignore tests/contrib --ignore tests/test_notebooks.py
- name: Report core project coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
Expand All @@ -61,24 +59,24 @@ jobs:
pytest -r sx tests/contrib --mpl --mpl-baseline-path tests/contrib/baseline
- name: Report contrib coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: contrib

- name: Test docstring examples with doctest
if: matrix.python-version == 3.9
if: matrix.python-version == '3.9'
run: pytest -r sx src/ README.rst

- name: Report doctest coverage with Codecov
if: github.event_name != 'schedule' && matrix.python-version == 3.9 && matrix.os == 'ubuntu-latest'
if: github.event_name != 'schedule' && matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v2
with:
files: ./coverage.xml
flags: doctest

- name: Run benchmarks
if: github.event_name == 'schedule' && matrix.python-version == 3.9
if: github.event_name == 'schedule' && matrix.python-version == '3.9'
run: |
pytest -r sx --benchmark-sort=mean tests/benchmarks/test_benchmark.py
10 changes: 5 additions & 5 deletions .github/workflows/dependencies-head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -95,7 +95,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand All @@ -120,7 +120,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lower-bound-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# minimum supported Python
python-version: [3.7]
python-version: ['3.7']

steps:
- uses: actions/checkout@v2
Expand All @@ -27,9 +27,7 @@ jobs:
- name: Install dependencies and force lowest bound
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip --no-cache-dir --quiet install --requirement lower-bound-requirements.txt
python -m pip --no-cache-dir --quiet install .[test]
python -m pip install --requirement lower-bound-requirements.txt
python -m pip --no-cache-dir install --constraint tests/constraints.txt .[test]
- name: List installed Python packages
run: python -m pip list
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.9]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'

- name: Install python-build, check-manifest, and twine
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9']
include:
- os: macos-latest
python-version: 3.9
python-version: '3.9'

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.9'
- name: Install bump2version
run: |
python -m pip install --upgrade pip setuptools wheel
Expand Down
13 changes: 6 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ repos:
exclude: ^validation/|\.dtd$|\.json$|\.xml$
- id: mixed-line-ending
- id: requirements-txt-fixer
exclude: lower-bound-requirements.txt
- id: trailing-whitespace
# exclude generated files
exclude: ^validation/|\.dtd$|\.xml$

- repo: https://github.com/asottile/pyupgrade
rev: v2.29.0
rev: v2.29.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
Expand All @@ -37,26 +36,26 @@ repos:
- id: absolufy-imports

- repo: https://github.com/psf/black
rev: 21.10b0
rev: 21.12b0
hooks:
- id: black-jupyter

- repo: https://github.com/asottile/blacken-docs
rev: v1.11.0
rev: v1.12.0
hooks:
- id: blacken-docs
additional_dependencies: [black==21.10b0]
additional_dependencies: [black==21.12b0]

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.1.1
rev: 1.2.2
hooks:
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.29.0]
additional_dependencies: [pyupgrade==2.29.1]

- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
Expand Down
33 changes: 27 additions & 6 deletions docs/examples/notebooks/ImpactPlot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
"## Download the Model\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For this example we'll download the archive of probability models for the ATLAS analysis [JHEP 12 (2019) 060, 2019](https://inspirehep.net/literature/1748602) from its [HEPData page](https://www.hepdata.net/record/ins1748602) using its [specific DOI](https://www.hepdata.net/record/resource/1935437?landing_page=true). You can download this multiple ways, but for simplicity we'll download it using the `pyhf contrib download` command."
]
},
{
"cell_type": "code",
"execution_count": 2,
Expand All @@ -34,14 +41,25 @@
"name": "stdout",
"output_type": "stream",
"text": [
"RegionA/BkgOnly.json\n",
"RegionA/patch.sbottom_750_745_60.json\n"
"\u001b[01;34m1Lbb-probability-models\u001b[00m\n",
"├── README.md\n",
"├── \u001b[01;34mRegionA\u001b[00m\n",
"│   ├── BkgOnly.json\n",
"│   └── patchset.json\n",
"├── \u001b[01;34mRegionB\u001b[00m\n",
"│   ├── BkgOnly.json\n",
"│   └── patchset.json\n",
"└── \u001b[01;34mRegionC\u001b[00m\n",
" ├── BkgOnly.json\n",
" └── patchset.json\n",
"\n",
"3 directories, 7 files\n"
]
}
],
"source": [
"!curl -sL https://doi.org/10.17182/hepdata.89408.v1/r2 | tar -O -xzv RegionA/BkgOnly.json > lhood.json\n",
"!curl -sL https://doi.org/10.17182/hepdata.89408.v1/r2 | tar -O -xzv RegionA/patch.sbottom_750_745_60.json > patch.json"
"! pyhf contrib download https://doi.org/10.17182/hepdata.89408.v3/r2 1Lbb-probability-models\n",
"! tree 1Lbb-probability-models"
]
},
{
Expand All @@ -58,8 +76,11 @@
"outputs": [],
"source": [
"def make_model(channel_list):\n",
" spec = json.load(open(\"lhood.json\"))\n",
" patch = json.load(open(\"patch.json\"))\n",
" spec = json.load(open(\"1Lbb-probability-models/RegionA/BkgOnly.json\"))\n",
" patchset = pyhf.PatchSet(\n",
" json.load(open(\"1Lbb-probability-models/RegionA/patchset.json\"))\n",
" )\n",
" patch = patchset[\"sbottom_750_745_60\"]\n",
" spec = jsonpatch.apply_patch(spec, patch)\n",
" spec[\"channels\"] = [c for c in spec[\"channels\"] if c[\"name\"] in channel_list]\n",
"\n",
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ignore = [
'AUTHORS',
]

[tool.pytest]
xfail_strict = true

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down
14 changes: 8 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
extras_require = {
'shellcomplete': ['click_completion'],
'tensorflow': [
'tensorflow~=2.3,!=2.3.0', # c.f. https://github.com/tensorflow/tensorflow/pull/40789
'tensorflow-probability~=0.11',
'tensorflow>=2.3.1', # c.f. https://github.com/tensorflow/tensorflow/pull/40789
'tensorflow-probability>=0.11.0', # c.f. PR #1657
],
'torch': ['torch~=1.10'],
'torch': ['torch>=1.10.0'], # c.f. PR #1657
'jax': ['jax>=0.2.10', 'jaxlib>=0.1.60,!=0.1.68'], # c.f. Issue 1501
'xmlio': ['uproot>=4.1.1'],
'minuit': ['iminuit>=2.4'],
'xmlio': ['uproot>=4.1.1'], # c.f. PR #1567
'minuit': ['iminuit>=2.4.0'], # c.f. PR #1306
}
extras_require['backends'] = sorted(
set(
Expand All @@ -29,9 +29,11 @@
+ extras_require['contrib']
+ extras_require['shellcomplete']
+ [
'pytest~=6.0',
'scikit-hep-testdata>=0.4.11',
'pytest>=6.0',
'pytest-cov>=2.5.1',
'pytest-mock',
'requests-mock>=1.9.0',
'pytest-benchmark[histogram]',
'pytest-console-scripts',
'pytest-mpl',
Expand Down
1 change: 0 additions & 1 deletion src/pyhf/cli/complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def cli(shell):
'''Generate shell completion code for various shells.'''
click.echo(click_completion.core.get_code(shell, prog_name='pyhf'))


except ImportError:

@click.command(help='Generate shell completion code.', name='completions')
Expand Down
Loading

0 comments on commit b895617

Please sign in to comment.