Skip to content

Commit a640c0b

Browse files
Merge branch 'main' into feat/addCustomModifierPython
2 parents 1d0600e + bd8c21a commit a640c0b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+787
-213
lines changed

.devcontainer/devcontainer.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "pyhf-devcontainer",
3+
"build": {
4+
"context": "..",
5+
"dockerfile": "../docker/Dockerfile"
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/git:1": {}
9+
},
10+
11+
"customizations": {
12+
"vscode": {
13+
"settings": {
14+
"python.defaultInterpreterPath": "/opt/venv/bin/python"
15+
},
16+
"extensions": [
17+
"ms-python.python",
18+
"ms-toolsai.jupyter"
19+
]
20+
}
21+
}
22+
}

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.nox
2+
.*cache

.github/ISSUE_TEMPLATE/~release-checklist.md

+26-10
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,40 @@ about: Checklist for core developers to complete as part of making a release
1010
* [ ] Migrate any unresolved Issues or PRs from the [release GitHub project board](https://github.com/scikit-hep/pyhf/projects/) to a new project board.
1111
* [ ] Verify that there is a release notes file for the release under [``docs/release-notes``](https://github.com/scikit-hep/pyhf/tree/main/docs/release-notes).
1212
* [ ] Verify that the release notes files correctly summarize all development changes since the last release.
13-
* [ ] Draft email to [``pyhf-announcements`` mailing list](https://groups.google.com/group/pyhf-announcements/subscribe) that summarizes the main points of the release notes and circulate it for development team approval.
1413
* [ ] Update the checklist Issue template in the [``.github/ISSUE_TEMPLATE``](https://github.com/scikit-hep/pyhf/tree/main/.github/ISSUE_TEMPLATE) directory if there are revisions.
15-
* [ ] Make a release to [TestPyPI][TestPyPI_pyhf] using the [workflow dispatch event trigger](https://github.com/scikit-hep/pyhf/actions/workflows/publish-package.yml).
16-
* [ ] Verify that the project README is displaying correctly on [TestPyPI][TestPyPI_pyhf].
1714
* [ ] Add any new use citations or published statistical models to the [Use and Citations page][citations_page].
18-
* [ ] Verify that the citations on the [Use and Citations page][citations_page] are up to date with their current [INSPIRE](https://inspirehep.net/) record.
19-
* [ ] Update the [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) GitHub Action used for deployment to TestPyPI and PyPI to the latest stable release.
15+
* [ ] Verify that the citations on the [Use and Citations page][citations_page] are up to date with their current [INSPIRE](https://inspirehep.net/) record. Checking the [Dimensions listing of publication citations](https://app.dimensions.ai/discover/publication?or_subset_publication_citations=pub.1135154020) can be helpful to catch citations that are now journal publications.
2016
* [ ] Update the ``codemeta.json`` file in the release PR if its requirements have updated.
17+
* [ ] Update the [pypa/gh-action-pypi-publish](https://github.com/pypa/gh-action-pypi-publish) GitHub Action used for deployment to TestPyPI and PyPI to the latest stable release.
18+
* [ ] Make a release to [TestPyPI][TestPyPI_pyhf] using the [workflow dispatch event trigger](https://github.com/scikit-hep/pyhf/actions/workflows/publish-package.yml).
19+
* [ ] Verify that the project README is displaying correctly on [TestPyPI][TestPyPI_pyhf].
20+
* [ ] Draft email to [``pyhf-announcements`` mailing list](https://groups.google.com/group/pyhf-announcements/subscribe) that summarizes the main points of the release notes and circulate it for development team approval.
2121

2222
[TestPyPI_pyhf]: https://test.pypi.org/project/pyhf/
2323
[citations_page]: https://scikit-hep.org/pyhf/citations.html
2424

25-
## Once Release PR is Merged
25+
## Create Release Tag
2626

27-
* [ ] Watch the CI to ensure that the deployment to [PyPI](https://pypi.org/project/pyhf/) is successful.
28-
* [ ] Create a [GitHub release](https://github.com/scikit-hep/pyhf/releases) from the generated PR tag and copy the release notes published to the GitHub release page. The creation of the GitHub release triggers all other release related activities.
27+
For a video walkthrough consult the [``pyhf`` ``v0.7.1`` release recording](https://youtu.be/ZV20tr3EpTw) on YouTube.
28+
29+
* [ ] Use the [bump version](https://github.com/scikit-hep/pyhf/actions/workflows/bump-version.yml) GitHub Actions workflow perform a [dry run](https://scikit-hep.org/pyhf/development.html#release-tags) of the bump version to the new release tag.
30+
* [ ] Check the annotated tag in the dry run workflow logs to make sure it looks correct.
31+
* [ ] If the dry run passes as expected, run the same workflow with the dry run option set to ``false`` to bump the release tag version and push the new tag back to GitHub.
32+
* [ ] Verify the release tag was pushed to the correct branch.
33+
* [ ] Verify the release tag commit has bumped the correct versions.
34+
* [ ] Watch the CI to verify all tag based jobs finish correctly.
35+
* [ ] Verify the release for the tag on [TestPyPI][TestPyPI_pyhf] looks correct.
36+
37+
## After Release Tag Pushed To GitHub
38+
39+
* [ ] Create a [GitHub release](https://github.com/scikit-hep/pyhf/releases) from the new release tag and copy the release notes published to the GitHub release page. The creation of the GitHub release triggers all other release related activities.
2940
- [ ] Before pasting in the release notes copy the changes that the GitHub bot has already queued up and pasted into the tag and place them in the "Changes" section of the release notes. If the release notes are published before these are copied then they will be overwritten and you'll have to add them back in by hand.
41+
- [ ] Create a corresponding [announcement GitHub Discussion](https://github.com/scikit-hep/pyhf/discussions/categories/announcements) for the release.
42+
* [ ] Watch the CI to ensure that the deployment to [PyPI](https://pypi.org/project/pyhf/) is successful.
43+
* [ ] Verify Docker images with the correct tags have been deployed to all container image registries.
44+
- [ ] [Docker Hub](https://hub.docker.com/r/pyhf/pyhf/tags)
45+
- [ ] [OSG Harbor](https://hub.opensciencegrid.org/harbor/projects/866/repositories/pyhf/)
46+
- [ ] [CERN Harbor](https://registry.cern.ch/harbor/projects/3550/repositories/pyhf/artifacts-tab)
3047
* [ ] Verify there is a new [Zenodo DOI](https://doi.org/10.5281/zenodo.1169739) minted for the release.
3148
- [ ] Verify that the new release archive metadata on Zenodo matches is being picked up as expected from [`CITATION.cff`](https://github.com/scikit-hep/pyhf/blob/main/CITATION.cff).
3249
* [ ] Verify that a Binder has properly built for the new release.
@@ -44,6 +61,5 @@ about: Checklist for core developers to complete as part of making a release
4461
* [ ] Update the [tutorial](https://github.com/pyhf/pyhf-tutorial) to use the new release number and API.
4562
* [ ] Make a PR to use the new release in the [CUDA enabled Docker images](https://github.com/pyhf/cuda-images).
4663
* [ ] Open a ticket on the CERN [Software Process and Infrastructure JIRA](https://sft.its.cern.ch/jira/browse/SPI) to update the version of `pyhf` available in the next LCG release.
47-
- c.f. the [`v0.6.3` request ticket](https://sft.its.cern.ch/jira/browse/SPI-2086) as an example.
48-
* [ ] If the release is a **major** or **minor** release, open a [GitHub Release Radar](https://github.com/github/release-radar) Issue for the release to potentially get featured on GitHub's [Release Radar blog](https://github.blog/?s=release+radar).
64+
- c.f. the [`v0.6.3` request ticket](https://sft.its.cern.ch/jira/browse/SPI-2086) and the [`v0.7.1` request ticket](https://sft.its.cern.ch/jira/browse/SPI-2333) as examples.
4965
* [ ] Close the [release GitHub Project board](https://github.com/scikit-hep/pyhf/projects/).

.github/workflows/dependencies-head.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
python -m pip install --upgrade pip setuptools wheel
6565
python -m pip --no-cache-dir --quiet install --upgrade .[test]
6666
python -m pip uninstall --yes scipy
67-
python -m pip install --upgrade --index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple scipy
67+
python -m pip install --upgrade --index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple scipy
6868
python -m pip list
6969
7070
- name: Test with pytest
@@ -143,12 +143,13 @@ jobs:
143143
python -m pip install --upgrade pip setuptools wheel
144144
python -m pip --no-cache-dir --quiet install --upgrade .[test]
145145
python -m pip uninstall --yes matplotlib
146-
# Need to use --extra-index-url as dependencies aren't on scipy-wheels-nightly package index.
146+
# Need to use --extra-index-url as dependencies aren't on scientific-python-nightly-wheels package index.
147147
# Need to use --pre as dev releases will need priority over stable releases.
148148
python -m pip install \
149149
--upgrade \
150150
--pre \
151-
--extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple \
151+
--index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
152+
--extra-index-url https://pypi.org/simple/ \
152153
matplotlib
153154
154155
- name: List installed Python packages

.github/workflows/docs.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,17 @@ jobs:
7878
[ ! -L "docs/_build/html/schemas" ]
7979
# is not empty
8080
[ "$(ls -A docs/_build/html/schemas)" ]
81+
# is not empty
82+
[ "$(ls -A docs/_build/html/lite)" ]
83+
84+
- name: Fix permissions if needed
85+
run: |
86+
chmod -c -R +rX "docs/_build/html/" | while read line; do
87+
echo "::warning title=Invalid file permissions automatically fixed::$line"
88+
done
8189
8290
- name: Upload artifact
83-
uses: actions/upload-pages-artifact@v1
91+
uses: actions/upload-pages-artifact@v2
8492
with:
8593
path: 'docs/_build/html'
8694

.github/workflows/merged.yml

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ jobs:
1515
- name: Trigger Binder build
1616
run: |
1717
# Use Binder build API to trigger repo2docker to build image on Google Cloud and Turing Institute Binder Federation clusters
18-
bash binder/trigger_binder.sh https://gke.mybinder.org/build/gh/scikit-hep/pyhf/main
1918
bash binder/trigger_binder.sh https://turing.mybinder.org/build/gh/scikit-hep/pyhf/main

.github/workflows/publish-package.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ concurrency:
2525
cancel-in-progress: true
2626

2727
jobs:
28-
build-and-publish:
29-
name: Build and publish Python distro to (Test)PyPI
28+
build:
29+
name: Build Python distribution
3030
runs-on: ubuntu-latest
3131
steps:
3232
- uses: actions/checkout@v3
@@ -88,21 +88,48 @@ jobs:
8888
- name: List contents of wheel
8989
run: python -m zipfile --list dist/pyhf-*.whl
9090

91+
- name: Upload distribution artifact
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: dist-artifact
95+
path: dist
96+
97+
publish:
98+
name: Publish Python distribution to (Test)PyPI
99+
if: github.event_name != 'pull_request'
100+
needs: build
101+
runs-on: ubuntu-latest
102+
# Mandatory for publishing with a trusted publisher
103+
# c.f. https://docs.pypi.org/trusted-publishers/using-a-publisher/
104+
permissions:
105+
id-token: write
106+
# Restrict to the environment set for the trusted publisher
107+
environment:
108+
name: publish-package
109+
110+
steps:
111+
- name: Download distribution artifact
112+
uses: actions/download-artifact@v3
113+
with:
114+
name: dist-artifact
115+
path: dist
116+
117+
- name: List all files
118+
run: ls -lh dist
119+
91120
- name: Publish distribution 📦 to Test PyPI
92121
# Publish to TestPyPI on tag events of if manually triggered
93122
# Compare to 'true' string as booleans get turned into strings in the console
94123
if: >-
95124
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'scikit-hep/pyhf')
96125
|| (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true' && github.repository == 'scikit-hep/pyhf')
97-
uses: pypa/[email protected].5
126+
uses: pypa/[email protected].8
98127
with:
99-
password: ${{ secrets.test_pypi_password }}
100128
repository-url: https://test.pypi.org/legacy/
101129
print-hash: true
102130

103131
- name: Publish distribution 📦 to PyPI
104132
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'scikit-hep/pyhf'
105-
uses: pypa/[email protected].5
133+
uses: pypa/[email protected].8
106134
with:
107-
password: ${{ secrets.pypi_password }}
108135
print-hash: true

.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ repos:
2626
# exclude generated files
2727
exclude: ^validation/|\.dtd$|\.xml$
2828

29-
- repo: https://github.com/charliermarsh/ruff-pre-commit
30-
rev: "v0.0.260"
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
30+
rev: "v0.0.276"
3131
hooks:
3232
- id: ruff
3333
args: ["--fix", "--show-fixes"]
@@ -38,13 +38,13 @@ repos:
3838
- id: black-jupyter
3939

4040
- repo: https://github.com/asottile/blacken-docs
41-
rev: 1.13.0
41+
rev: 1.14.0
4242
hooks:
4343
- id: blacken-docs
4444
additional_dependencies: [black==23.3.0]
4545

4646
- repo: https://github.com/pre-commit/mirrors-mypy
47-
rev: v1.1.1
47+
rev: v1.4.1
4848
# check the oldest and newest supported Pythons
4949
hooks:
5050
- &mypy
@@ -62,11 +62,11 @@ repos:
6262
rev: 1.7.0
6363
hooks:
6464
- id: nbqa-ruff
65-
additional_dependencies: [ruff==0.0.260]
65+
additional_dependencies: [ruff==0.0.276]
6666
args: ["--extend-ignore=F821,F401,F841,F811"]
6767

6868
- repo: https://github.com/codespell-project/codespell
69-
rev: v2.2.4
69+
rev: v2.2.5
7070
hooks:
7171
- id: codespell
7272
files: ^.*\.(py|md|rst)$

.zenodo.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"description": "pure-Python HistFactory implementation with tensors and autodiff",
33
"license": "Apache-2.0",
4-
"title": "scikit-hep/pyhf: v0.7.1",
5-
"version": "v0.7.1",
4+
"title": "scikit-hep/pyhf: v0.7.2",
5+
"version": "v0.7.2",
66
"upload_type": "software",
77
"creators": [
88
{
@@ -36,7 +36,7 @@
3636
"related_identifiers": [
3737
{
3838
"scheme": "url",
39-
"identifier": "https://github.com/scikit-hep/pyhf/tree/v0.7.1",
39+
"identifier": "https://github.com/scikit-hep/pyhf/tree/v0.7.2",
4040
"relation": "isSupplementTo"
4141
}
4242
]

CITATION.cff

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ authors:
1414
given-names: "Giordon"
1515
orcid: "https://orcid.org/0000-0001-6616-3433"
1616
affiliation: "SCIPP, University of California, Santa Cruz"
17-
title: "pyhf: v0.7.1"
18-
version: 0.7.1
17+
title: "pyhf: v0.7.2"
18+
version: 0.7.2
1919
doi: 10.5281/zenodo.1169739
20-
repository-code: "https://github.com/scikit-hep/pyhf/releases/tag/v0.7.1"
21-
url: "https://pyhf.readthedocs.io/en/v0.7.1/"
20+
repository-code: "https://github.com/scikit-hep/pyhf/releases/tag/v0.7.2"
21+
url: "https://pyhf.readthedocs.io/en/v0.7.2/"
2222
keywords:
2323
- python
2424
- physics

README.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. image:: https://raw.githubusercontent.com/scikit-hep/pyhf/main/docs/_static/img/pyhf-logo-small.png
1+
.. image:: https://raw.githubusercontent.com/scikit-hep/pyhf/main/docs/_static/img/pyhf-logo.svg
22
:alt: pyhf logo
33
:width: 320
44
:align: center
@@ -309,11 +309,11 @@ the preferred BibTeX entry for citation of ``pyhf`` includes both the
309309
310310
@software{pyhf,
311311
author = {Lukas Heinrich and Matthew Feickert and Giordon Stark},
312-
title = "{pyhf: v0.7.1}",
313-
version = {0.7.1},
312+
title = "{pyhf: v0.7.2}",
313+
version = {0.7.2},
314314
doi = {10.5281/zenodo.1169739},
315315
url = {https://doi.org/10.5281/zenodo.1169739},
316-
note = {https://github.com/scikit-hep/pyhf/releases/tag/v0.7.1}
316+
note = {https://github.com/scikit-hep/pyhf/releases/tag/v0.7.2}
317317
}
318318
319319
@article{pyhf_joss,
@@ -365,22 +365,22 @@ and grant `OAC-1450377 <https://www.nsf.gov/awardsearch/showAward?AWD_ID=1450377
365365
:target: https://nsf.gov/awardsearch/showAward?AWD_ID=1836650
366366
.. |NumFOCUS Affiliated Project| image:: https://img.shields.io/badge/NumFOCUS-Affiliated%20Project-orange.svg?style=flat&colorA=E1523D&colorB=007D8A
367367
:target: https://numfocus.org/sponsored-projects/affiliated-projects
368-
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v0.7.1-blue.svg
368+
.. |Docs from latest| image:: https://img.shields.io/badge/docs-v0.7.2-blue.svg
369369
:target: https://pyhf.readthedocs.io/
370370
.. |Docs from main| image:: https://img.shields.io/badge/docs-main-blue.svg
371371
:target: https://scikit-hep.github.io/pyhf
372372
.. |Jupyter Book tutorial| image:: https://jupyterbook.org/_images/badge.svg
373373
:target: https://pyhf.github.io/pyhf-tutorial/
374374
.. |Binder| image:: https://mybinder.org/badge_logo.svg
375-
:target: https://mybinder.org/v2/gh/scikit-hep/pyhf/main?filepath=docs%2Fexamples%2Fnotebooks%2Fbinderexample%2FStatisticalAnalysis.ipynb
375+
:target: https://mybinder.org/v2/gh/scikit-hep/pyhf/main?labpath=docs%2Fexamples%2Fnotebooks%2Fbinderexample%2FStatisticalAnalysis.ipynb
376376
377377
.. |PyPI version| image:: https://badge.fury.io/py/pyhf.svg
378378
:target: https://badge.fury.io/py/pyhf
379379
.. |Conda-forge version| image:: https://img.shields.io/conda/vn/conda-forge/pyhf.svg
380380
:target: https://prefix.dev/channels/conda-forge/packages/pyhf
381381
.. |Supported Python versions| image:: https://img.shields.io/pypi/pyversions/pyhf.svg
382382
:target: https://pypi.org/project/pyhf/
383-
.. |Docker Hub pyhf| image:: https://img.shields.io/badge/pyhf-v0.7.1-blue?logo=Docker
383+
.. |Docker Hub pyhf| image:: https://img.shields.io/badge/pyhf-v0.7.2-blue?logo=Docker
384384
:target: https://hub.docker.com/r/pyhf/pyhf/tags
385385
.. |Docker Hub pyhf CUDA| image:: https://img.shields.io/badge/pyhf-CUDA-blue?logo=Docker
386386
:target: https://hub.docker.com/r/pyhf/cuda/tags

binder/postBuild

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
python -m pip install --upgrade '.[all]'
2-
python -m pip install altair
2+
python -m pip install --upgrade \
3+
ipywidgets \
4+
ipympl \
5+
altair

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@
122122
"runtimePlatform": "Python 3"
123123
},
124124
"url": "https://github.com/scikit-hep/pyhf",
125-
"version": "0.7.1"
125+
"version": "0.7.2"
126126
}

docker/Dockerfile

+33-2
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,47 @@ RUN apt-get -qq -y update && \
1616
python -m venv /usr/local/venv && \
1717
cd /code && \
1818
python -m pip --no-cache-dir install --upgrade pip setuptools wheel && \
19-
python -m pip --no-cache-dir install .[xmlio,contrib] && \
19+
python -m pip --no-cache-dir install '.[xmlio,contrib]' && \
2020
python -m pip list
2121

2222
FROM base
23+
24+
USER root
25+
26+
SHELL [ "/bin/bash", "-c" ]
2327
ENV PATH=/usr/local/venv/bin:"${PATH}"
28+
2429
RUN apt-get -qq -y update && \
2530
apt-get -qq -y install --no-install-recommends \
2631
curl && \
2732
apt-get -y autoclean && \
2833
apt-get -y autoremove && \
2934
rm -rf /var/lib/apt/lists/*
30-
COPY --from=builder /usr/local/venv /usr/local/venv
35+
36+
# Create non-root user "moby" with uid 1000
37+
RUN adduser \
38+
--shell /bin/bash \
39+
--gecos "default user" \
40+
--uid 1000 \
41+
--disabled-password \
42+
moby && \
43+
chown -R moby /home/moby && \
44+
mkdir /work && \
45+
chown -R moby /work && \
46+
echo -e "\nexport PATH=/usr/local/venv/bin:${PATH}\n" >> /home/moby/.bashrc
47+
48+
COPY --from=builder --chown=moby /usr/local/venv /usr/local/venv/
49+
50+
USER moby
51+
52+
ENV USER ${USER}
53+
ENV HOME /home/moby
54+
WORKDIR ${HOME}/work
55+
56+
# Use C.UTF-8 locale to avoid issues with ASCII encoding
57+
ENV LC_ALL=C.UTF-8
58+
ENV LANG=C.UTF-8
59+
60+
ENV PATH=${HOME}/.local/bin:${PATH}
61+
3162
ENTRYPOINT ["/usr/local/venv/bin/pyhf"]

0 commit comments

Comments
 (0)