Skip to content

Commit

Permalink
chore(backport): Update GitHub Actions and pre-commit hooks (#2359)
Browse files Browse the repository at this point in the history
* Backport:
   - PR #2332
   - PR #2333
   - PR #2334
   - PR #2335
   - PR #2337
   - PR #2343
  • Loading branch information
matthewfeickert authored Oct 25, 2023
1 parent c9f9d33 commit f757f1a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 28 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,29 @@ jobs:
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Test build
id: docker_build_test
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
# every PR will trigger a push event on main, so check the push event is actually coming from main
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'scikit-hep/pyhf'
id: docker_build_latest
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand All @@ -131,7 +131,7 @@ jobs:
- name: Build and publish to registry with release tag
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'scikit-hep/pyhf'
id: docker_build_release
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
- release/v*
release:
types: [published]
# Run weekly at 1:23 UTC
schedule:
- cron: '23 1 * * 0'
workflow_dispatch:
inputs:
publish:
Expand Down Expand Up @@ -44,7 +47,13 @@ jobs:
python -m pip install build twine
python -m pip list
- name: Build a wheel and a sdist
- name: Build a sdist and wheel
if: github.event_name != 'schedule'
run: |
python -m build .
- name: Build a sdist and wheel and check for warnings
if: github.event_name == 'schedule'
run: |
PYTHONWARNINGS=error,default::DeprecationWarning python -m build .
Expand Down
15 changes: 6 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ repos:
# exclude generated files
exclude: ^validation/|\.dtd$|\.xml$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.287"
hooks:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.292"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black-jupyter

Expand All @@ -46,9 +46,6 @@ repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
# check the oldest and newest supported Pythons
# Though use Python 3.8 as the oldest Python to run mypy
# to avoid positional-only errors from NumPy in Python 3.11
# runtime.
hooks:
- &mypy
id: mypy
Expand All @@ -65,11 +62,11 @@ repos:
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.287]
additional_dependencies: [ruff==0.0.292]
args: ["--extend-ignore=F821,F401,F841,F811"]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
files: ^.*\.(py|md|rst)$
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ How did ``pyhf`` get started?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In 2017 Lukas Heinrich was discussing with colleauge Holger Schulz how it would be convenient
to share and produce statistical results from LHC experiements if they were able to be
to share and produce statistical results from LHC experiments if they were able to be
created with tools that didn't require the large ``C++`` dependencies and tooling expertise as
:math:`\HiFa{}`.
Around the same time that Lukas began thinking on these ideas, Matthew Feickert was working on
Expand Down
2 changes: 1 addition & 1 deletion docs/governance/ROADMAP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is the pyhf 2019 into 2020 Roadmap (Issue
Overview and Goals
------------------

We will follow loosely Seibert’s `Heirarchy of
We will follow loosely Seibert’s `Hierarchy of
Needs <https://twitter.com/FRoscheck/status/1159158552298229763>`__

|Seibert Hierarchy of Needs SciPy 2019| (`Stan
Expand Down
2 changes: 1 addition & 1 deletion src/pyhf/contrib/viz/brazil.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def plot_brazil_band(test_pois, cls_obs, cls_exp, test_size, ax, **kwargs):
ax (:obj:`matplotlib.axes.Axes`): The matplotlib axis object to plot on.
Returns:
:obj:`tuple`: The :obj:`matplotlib.aritst` objects drawn.
:obj:`tuple`: The :obj:`matplotlib.artist` objects drawn.
"""
line_color = kwargs.pop("color", "black")
(cls_obs_line,) = ax.plot(
Expand Down
4 changes: 2 additions & 2 deletions src/pyhf/tensor/jax_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def clip(self, tensor_in, min_value, max_value):
Args:
tensor_in (:obj:`tensor`): The input tensor object
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be cliped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be cliped to
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be clipped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be clipped to
Returns:
JAX ndarray: A clipped `tensor`
Expand Down
4 changes: 2 additions & 2 deletions src/pyhf/tensor/numpy_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def clip(
Args:
tensor_in (:obj:`tensor`): The input tensor object
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be cliped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be cliped to
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be clipped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be clipped to
Returns:
NumPy ndarray: A clipped `tensor`
Expand Down
4 changes: 2 additions & 2 deletions src/pyhf/tensor/pytorch_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def clip(self, tensor_in, min_value, max_value):
Args:
tensor_in (:obj:`tensor`): The input tensor object
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be cliped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be cliped to
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be clipped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be clipped to
Returns:
PyTorch tensor: A clipped `tensor`
Expand Down
4 changes: 2 additions & 2 deletions src/pyhf/tensor/tensorflow_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def clip(self, tensor_in, min_value, max_value):
Args:
tensor_in (:obj:`tensor`): The input tensor object
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be cliped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be cliped to
min_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The minimum value to be clipped to
max_value (:obj:`scalar` or :obj:`tensor` or :obj:`None`): The maximum value to be clipped to
Returns:
TensorFlow Tensor: A clipped `tensor`
Expand Down

0 comments on commit f757f1a

Please sign in to comment.