Skip to content

feat: Add environment information CLI#2129

Open
matthewfeickert wants to merge 16 commits into
mainfrom
feat/add-pyhf-env-info-cli
Open

feat: Add environment information CLI#2129
matthewfeickert wants to merge 16 commits into
mainfrom
feat/add-pyhf-env-info-cli

Conversation

@matthewfeickert
Copy link
Copy Markdown
Member

@matthewfeickert matthewfeickert commented Mar 6, 2023

Description

Resolves #1580

Add pyhf.utils.environment_info which produces a Markdown-friendly bullet list summary of the environment useful for bug reports. Also adds a CLI command pyhf utils environment. Optional backends (iminuit, jax, jaxlib) show "not installed" when absent.

Example output:

$ pyhf utils environment
* os version: macOS 14.6.1
* kernel version: Darwin 23.6.0 arm64
* python version: CPython 3.12.7 [Clang 16.0.0 (clang-1600.0.26.4)]
* pyhf version: 0.8.0.dev0
* numpy version: 2.1.3
* scipy version: 1.14.1
* iminuit version: 2.30.1
* jax version: not installed
* jaxlib version: not installed

Checklist Before Requesting Reviewer

  • Tests are passing
  • "WIP" removed from the title of the pull request
  • Selected an Assignee for the PR to be responsible for the log summary

Before Merging

For the PR Assignees:

  • Summarize commit messages into a comprehensive review of the PR

* Add pyhf.utils.environment_info() to produce OS, Python, pyhf, numpy,
  scipy, and optional backend (iminuit, jax, jaxlib) version information
  as a Markdown-friendly bullet list for bug reports. Optional packages
  show "not installed" when absent.
* Add pyhf utils environment CLI command with --output-file option.
* Add tests for environment_info() including missing optional packages
  via monkeypatch, and CLI tests via script_runner.

Co-authored-by: Giordon Stark <kratsg@gmail.com>

@matthewfeickert matthewfeickert added feat/enhancement New feature or request tests pytest API Changes the public API CLI Affects the CLI API labels Mar 6, 2023
@matthewfeickert matthewfeickert self-assigned this Mar 6, 2023
@matthewfeickert matthewfeickert force-pushed the feat/add-pyhf-env-info-cli branch from 7e840bb to e64a2b3 Compare April 7, 2023 05:15
@matthewfeickert matthewfeickert force-pushed the feat/add-pyhf-env-info-cli branch from e64a2b3 to 0a2495e Compare July 5, 2023 15:28
@matthewfeickert matthewfeickert force-pushed the feat/add-pyhf-env-info-cli branch from 0a2495e to daf692e Compare November 2, 2023 07:14
@matthewfeickert matthewfeickert force-pushed the feat/add-pyhf-env-info-cli branch from daf692e to ae37c30 Compare April 7, 2026 07:55
@kratsg kratsg marked this pull request as ready for review April 11, 2026 04:09
@kratsg kratsg self-requested a review April 11, 2026 04:09
@kratsg kratsg self-assigned this Apr 11, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.30%. Comparing base (24b1013) to head (ff8ba4c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2129      +/-   ##
==========================================
+ Coverage   98.28%   98.30%   +0.02%     
==========================================
  Files          65       66       +1     
  Lines        4305     4360      +55     
  Branches      465      470       +5     
==========================================
+ Hits         4231     4286      +55     
  Misses         46       46              
  Partials       28       28              
Flag Coverage Δ
contrib 98.05% <89.65%> (-0.12%) ⬇️
doctest 98.16% <89.65%> (-0.12%) ⬇️
unittests-3.10 96.37% <89.65%> (-0.10%) ⬇️
unittests-3.11 96.37% <89.65%> (-0.10%) ⬇️
unittests-3.12 96.37% <89.65%> (-0.10%) ⬇️
unittests-3.13 96.37% <89.65%> (-0.10%) ⬇️
unittests-3.9 96.58% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kratsg kratsg force-pushed the feat/add-pyhf-env-info-cli branch from 1f7c13f to cc1d2e6 Compare April 11, 2026 06:20
matthewfeickert and others added 14 commits April 11, 2026 15:48
CentOS 7 has multiple
Add pyhf.utils.environment_info() and pyhf utils environment CLI command
to surface OS, Python, pyhf, numpy, scipy, and (if installed) iminuit/jax
version information in a Markdown-friendly bullet list format for bug reports.
Optional packages show "not installed" when absent.

Resolves #1580

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kratsg added 2 commits April 11, 2026 15:48
…on 3.9

platform.freedesktop_os_release was added in Python 3.10, so monkeypatch
raises AttributeError on 3.9 without raising=False.

Co-Authored-By: Giordon Stark <kratsg@gmail.com>
… is absent

Adds test simulating Python 3.9 (no platform.freedesktop_os_release) with
/etc/os-release not present, exercising the raise OSError branch in the
manual fallback implementation.

Co-Authored-By: Giordon Stark <kratsg@gmail.com>
@kratsg kratsg force-pushed the feat/add-pyhf-env-info-cli branch from b8409cb to ff8ba4c Compare April 11, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

API Changes the public API CLI Affects the CLI API feat/enhancement New feature or request tests pytest

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Provide pyhf debug utility that prints debugging information for user issues

2 participants