Skip to content

Commit

Permalink
Merge branch 'master' into correct_ndof
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAly98 authored Feb 28, 2025
2 parents 60c75da + 0ede4d9 commit 986126d
Show file tree
Hide file tree
Showing 17 changed files with 303 additions and 212 deletions.
13 changes: 13 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[flake8]
max-complexity = 18
max-line-length = 88
exclude = docs/conf.py
count = True
statistics = True
import-order-style = google
application-import-names = cabinetry, utils
# ignore whitespace before ':'
extend-ignore = E203
# ignore print statements in example
per-file-ignores =
example.py: T
8 changes: 2 additions & 6 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,12 @@ jobs:
with:
python-version: '3.x'

- name: Install python-build, check-manifest, and twine
- name: Install python-build and twine
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install build check-manifest twine
python -m pip install build twine
python -m pip list
- name: Check MANIFEST
run: |
check-manifest --verbose
- name: Build a wheel and a sdist
run: |
python -m build --outdir dist/ .
Expand Down
32 changes: 13 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.3.0
rev: 25.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.9.0
hooks:
- id: mypy
name: mypy with Python 3.9
files: src/cabinetry
additional_dependencies: ["numpy>=1.22", "boost-histogram>=1.0.1", "click>=8", "types-tabulate", "types-PyYAML", "hist>=2.3.0"]
# numpy 1.25 is no longer compatible with Python 3.8, so use Python >=3.9 for type checking
args: ["--python-version=3.9"]
- id: mypy
name: mypy with Python 3.12
files: src/cabinetry
additional_dependencies: ["numpy>=1.22", "boost-histogram>=1.0.1", "click>=8", "types-tabulate", "types-PyYAML", "hist>=2.3.0"]
args: ["--python-version=3.12"]
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.14.1
# hooks:
# - id: mypy
# name: mypy with Python 3.12
# files: src/cabinetry
# additional_dependencies: ["numpy>=1.22", "boost-histogram>=1.0.1", "click>=8", "types-tabulate", "types-PyYAML", "hist>=2.3.0"]
# args: ["--python-version=3.12"]
- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear, flake8-import-order, flake8-print]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.1
rev: v3.19.1
hooks:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: ["--maxkb=100"]
Expand All @@ -40,7 +34,7 @@ repos:
# configuration duplicated in setup.cfg
args: ["--match=(?!setup|example).*\\.py'", "--match-dir='^(?!(tests|utils|docs)).*'", "--convention=google"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.4.1
hooks:
- id: codespell
args: ["-L", "hist", "src", "tests", "utils", "docs/*rst"]
51 changes: 51 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
cff-version: 1.2.0
message: "Please cite the following works when using this software."
type: software
authors:
- family-names: "Held"
given-names: "Alexander"
orcid: "https://orcid.org/0000-0002-8924-5885"
affiliation: "University of Wisconsin-Madison"
title: "cabinetry: v0.6.0"
version: 0.6.0
doi: 10.5281/zenodo.4742752
repository-code: "https://github.com/scikit-hep/cabinetry/releases/tag/v0.6.0"
url: "https://cabinetry.readthedocs.io/"
keywords:
- python
- fitting
- physics
- profile likelihood
license: "BSD-3-Clause"
abstract: |
Statistical models in [HistFactory](https://cds.cern.ch/record/1456844)
format can be built by `cabinetry` from instructions in a declarative
configuration.
`cabinetry` makes heavy use of [`pyhf`](https://pyhf.readthedocs.io/) for
statistical inference, and provides additional utilities to help study and
disseminate fit results.
This includes commonly used visualizations.
Due to its modular approach, analyzers are free to use all of `cabinetry`'s
functionality or only some pieces.
`cabinetry` can be used for inference and visualization with any
`pyhf`-compatible model, whether it was built with `cabinetry` or not.
references:
- type: article
authors:
- family-names: "Held"
given-names: "Alexander"
orcid: "https://orcid.org/0000-0002-8924-5885"
affiliation: "New York University"
- family-names: "Cranmer"
given-names: "Kyle"
orcid: "https://orcid.org/0000-0002-5769-7094"
affiliation: "New York University"
title: "Building and steering binned template fits with cabinetry"
doi: 10.1051/epjconf/202125103067
url: "https://doi.org/10.1051/epjconf/202125103067"
year: 2021
publisher:
name: "EDP Sciences"
volume: 251
pages: 03067
journal: EPJ Web of Web of Conferences
13 changes: 0 additions & 13 deletions MANIFEST.in

This file was deleted.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ It requires additional dependencies obtained with `pip install cabinetry[contrib
## Documentation

Find more information in the [documentation](https://cabinetry.readthedocs.io/) and tutorial material in the [cabinetry-tutorials](https://github.com/cabinetry/cabinetry-tutorials) repository.
`cabinetry` is also described in a paper submitted to vCHEP 2021: [10.5281/zenodo.4627037](https://doi.org/10.5281/zenodo.4627037).

`cabinetry` is also described in a paper submitted to vCHEP 2021: [10.1051/epjconf/202125103067](https://doi.org/10.1051/epjconf/202125103067).

## Acknowledgements

Expand Down
126 changes: 124 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,115 @@
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
requires = [
"hatchling>=1.13.0",
]
build-backend = "hatchling.build"

[project]
name = "cabinetry"
version = "0.6.0"
description = "design and steer profile likelihood fits"
readme = "README.md"
license = { text = "BSD-3-Clause" } # SPDX short identifier
requires-python = ">=3.8"
authors = [
{ name = "Alexander Held", email = "[email protected]" },
]
maintainers = [ {name = "The Scikit-HEP admins", email = "[email protected]"} ]
keywords = [
"fitting",
"physics",
"profile likelihood",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"pyhf[minuit]~=0.7.0", # model.config.suggested_fixed / .par_names API changes, set_poi(None)
"boost_histogram>=1.0.0", # subclassing with family, 1.02 for stdev scaling fix (currently not needed)
"hist>=2.5.0", # hist.intervals.poisson_interval
"tabulate>=0.8.1", # multiline text
"matplotlib>=3.5.0", # layout kwarg for subplots
# below are direct dependencies of cabinetry, which are also included via pyhf[iminuit]
"numpy",
"pyyaml",
"iminuit",
"jsonschema",
"click",
"scipy",
"packaging", # for version parsing
]

[project.scripts]
cabinetry = "cabinetry.cli:cabinetry"

[project.urls]
Documentation = "https://cabinetry.readthedocs.io/"
Homepage = "https://github.com/scikit-hep/cabinetry"
"Issue Tracker" = "https://github.com/scikit-hep/cabinetry/issues"
"Releases" = "https://github.com/scikit-hep/cabinetry/releases"
"Source Code" = "https://github.com/scikit-hep/cabinetry"

[project.optional-dependencies]
contrib = ["uproot>=4.1.5"] # file writing bug-fixes
pyhf_backends = ["pyhf[backends]"]

# Developer extras
test = [
"cabinetry[contrib]",
"pytest",
"pytest-cov>=2.6.1", # no_cover support
"pydocstyle",
"check-manifest",
"flake8",
"flake8-bugbear",
"flake8-import-order",
"flake8-print",
"mypy",
"types-tabulate",
"types-PyYAML",
"typeguard>=4.0.0", # cabinetry#391
"black",
]
docs = [
"sphinx!=5.2.0.post0", # broken due to version parsing in RTD theme
"sphinx-click",
"sphinx-copybutton",
"sphinx-jsonschema",
"sphinx-rtd-theme>=1.2", # Sphinx 7 compatibility
]
develop = [
"cabinetry[test,docs]",
"pre-commit",
"twine",
]
complete = [
"cabinetry[develop]",
"cabinetry[pyhf_backends]",
]

[tool.hatch.build.targets.sdist]
# hatchling always includes:
# pyproject.toml, .gitignore, any README, any LICENSE, AUTHORS
only-include = [
"/src",
"/tests",
"/utils",
]

[tool.hatch.build.targets.wheel]
packages = ["src/cabinetry"]

[tool.black]
target-version = ['py38']
Expand All @@ -13,6 +122,19 @@ exclude = '''
)/
'''

[tool.pytest.ini_options]
# running typeguard can result in lower coverage https://github.com/agronholm/typeguard/issues/356
addopts = "--cov=cabinetry --cov-report html --cov-report term-missing --cov-branch -rsx --typeguard-packages=cabinetry"

[tool.pytype]
inputs = "src/cabinetry"

[tool.pydocstyle]
# configuration duplicated in pre-commit config
match = "(?!setup|example).*\\.py"
match_dir = "^(?!(tests|utils|docs)).*"
convention = "google"

[tool.mypy]
files = "src/cabinetry"
pretty = true
Expand Down
78 changes: 0 additions & 78 deletions setup.cfg

This file was deleted.

Loading

0 comments on commit 986126d

Please sign in to comment.