Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: use Hatch build backend #1888

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,12 @@ jobs:
with:
python-version: '3.10'

- 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

- name: Build a wheel and a sdist
run: |
python -m build --outdir dist/ .
Expand Down
12 changes: 0 additions & 12 deletions MANIFEST.in

This file was deleted.

300 changes: 256 additions & 44 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,252 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools>=42.0.0", "setuptools_scm[toml]>=3.4"]
build-backend = "setuptools.build_meta"
requires = [
"hatchling>=1.3.1",
"hatch-vcs",
]
build-backend = "hatchling.build"

[project]
name = "pyhf"
description = "pure-Python HistFactory implementation with tensors and autodiff"
readme = "README.rst"
license = { file = "LICENSE" }
requires-python = ">=3.7"
keywords = [
"fitting",
"jax",
"numpy",
"physics",
"pytorch",
"scipy",
"tensorflow",
]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"click>=7.0", # for console scripts
"importlib_resources>=1.3.0; python_version < \"3.9\"", # for resources in schema
"jsonpatch>=1.15",
"jsonschema>=3.0.0", # for utils
"pyyaml>=5.1", # for parsing CLI equal-delimited options
"scipy>=1.1.0", # requires numpy, which is required by pyhf and tensorflow
"tqdm>=4.56.0" # for readxml
]
dynamic = [
"version",
]
authors = [
{ name = "Lukas Heinrich", email = "lukas.heinrich@cern.ch" },
{ name = "Matthew Feickert", email = "matthew.feickert@cern.ch"},
{ name = "Giordon Stark", email = "gstark@cern.ch" }
]

[project.optional-dependencies]
backends = [
"iminuit>=2.4.0",
"jax>=0.2.10",
"jaxlib>=0.1.60,!=0.1.68",
"tensorflow-probability>=0.11.0",
"tensorflow>=2.6.5",
"torch>=1.10.0",
]
complete = [
"black>=22.1.0",
"click_completion",
"codemetapy>=0.3.4",
"flake8",
"graphviz",
"iminuit>=2.4.0",
"ipython",
"ipywidgets",
"jax>=0.2.10",
"jaxlib>=0.1.60,!=0.1.68",
"jupyter",
"matplotlib",
"nbdime",
"nbsphinx!=0.8.8",
"papermill~=2.3.4",
"pre-commit",
"pydocstyle",
"pytest-benchmark[histogram]",
"pytest-console-scripts",
"pytest-cov>=2.5.1",
"pytest-mock",
"pytest-mpl",
"pytest>=6.0",
"requests",
"requests-mock>=1.9.0",
"scikit-hep-testdata>=0.4.11",
"scrapbook~=0.5.0",
"sphinx-click",
"sphinx-copybutton>=0.3.2",
"sphinx-issues",
"sphinx-togglebutton>=0.3.0",
"sphinx>=4.0.0",
"sphinx_rtd_theme",
"sphinxcontrib-bibtex~=2.1",
"tbump>=6.7.0",
"tensorflow-probability>=0.11.0",
"tensorflow>=2.6.5",
"torch>=1.10.0",
"twine",
"uproot>=4.1.1",
]
contrib = [
"matplotlib",
"requests",
]
develop = [
"black>=22.1.0",
"click_completion",
"codemetapy>=0.3.4",
"flake8",
"graphviz",
"iminuit>=2.4.0",
"ipython",
"ipywidgets",
"jax>=0.2.10",
"jaxlib>=0.1.60,!=0.1.68",
"jupyter",
"matplotlib",
"nbdime",
"nbsphinx!=0.8.8",
"papermill~=2.3.4",
"pre-commit",
"pydocstyle",
"pytest-benchmark[histogram]",
"pytest-console-scripts",
"pytest-cov>=2.5.1",
"pytest-mock",
"pytest-mpl",
"pytest>=6.0",
"requests",
"requests-mock>=1.9.0",
"scikit-hep-testdata>=0.4.11",
"scrapbook~=0.5.0",
"sphinx-click",
"sphinx-copybutton>=0.3.2",
"sphinx-issues",
"sphinx-togglebutton>=0.3.0",
"sphinx>=4.0.0",
"sphinx_rtd_theme",
"sphinxcontrib-bibtex~=2.1",
"tbump>=6.7.0",
"tensorflow-probability>=0.11.0",
"tensorflow>=2.6.5",
"torch>=1.10.0",
"twine",
"uproot>=4.1.1",
]
docs = [
"ipywidgets",
"matplotlib",
"nbsphinx!=0.8.8",
"requests",
"sphinx-click",
"sphinx-copybutton>=0.3.2",
"sphinx-issues",
"sphinx-togglebutton>=0.3.0",
"sphinx>=4.0.0",
"sphinx_rtd_theme",
"sphinxcontrib-bibtex~=2.1",
"uproot>=4.1.1",
]
jax = [
"jax>=0.2.10",
"jaxlib>=0.1.60,!=0.1.68",
]
lint = [
"black>=22.1.0",
"flake8",
]
minuit = [
"iminuit>=2.4.0",
]
shellcomplete = [
"click_completion",
]
tensorflow = [
"tensorflow-probability>=0.11.0",
"tensorflow>=2.6.5",
]
test = [
"click_completion",
"graphviz",
"iminuit>=2.4.0",
"jax>=0.2.10",
"jaxlib>=0.1.60,!=0.1.68",
"jupyter",
"matplotlib",
"papermill~=2.3.4",
"pydocstyle",
"pytest-benchmark[histogram]",
"pytest-console-scripts",
"pytest-cov>=2.5.1",
"pytest-mock",
"pytest-mpl",
"pytest>=6.0",
"requests",
"requests-mock>=1.9.0",
"scikit-hep-testdata>=0.4.11",
"scrapbook~=0.5.0",
"tensorflow-probability>=0.11.0",
"tensorflow>=2.6.5",
"torch>=1.10.0",
"uproot>=4.1.1",
]
torch = [
"torch>=1.10.0",
]
xmlio = [
"uproot>=4.1.1",
]

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

[project.urls]
"Documentation" = "https://pyhf.readthedocs.io/"
"Homepage" = "https://github.com/scikit-hep/pyhf"
"Issue Tracker" = "https://github.com/scikit-hep/pyhf/issues"
"Release Notes" = "https://pyhf.readthedocs.io/en/stable/release-notes.html"
"Source Code" = "https://github.com/scikit-hep/pyhf"

# Give Hatch the ability to determine the project version
[tool.hatch.version]
source = "vcs"

# Generate _version.py at build time
[tool.hatch.build.hooks.vcs]
version-file = "src/pyhf/_version.py"

[tool.hatch.build]
packages = [
"src/pyhf"
]

[tool.setuptools_scm]
write_to = "src/pyhf/_version.py"
local_scheme = "no-local-version"

[tool.black]
line-length = 88
target-version = ['py37', 'py38']
target-version = [
"py37",
"py38",
]
skip-string-normalization = true
include = '\.pyi?$'
exclude = '''
/(
\.git
| .eggs
| build
)/
'''
include = "\\.pyi?$"
exclude = "/(\n \\.git\n | .eggs\n | build\n)/\n"

[tool.check-manifest]
ignore = [
'docs*',
'validation*',
'examples*',
'tests*',
'docker*',
'binder*',
'.*',
'pyproject.toml',
'pytest.ini',
'codecov.yml',
'codemeta.json',
'CODE_OF_CONDUCT.md',
'CONTRIBUTING.md',
'AUTHORS',
]

[tool.pytest.ini_options]
minversion = "6.0"
Expand Down Expand Up @@ -78,21 +288,23 @@ markers = [
]
filterwarnings = [
"error",
'ignore:the imp module is deprecated:DeprecationWarning', # tensorflow
'ignore:distutils Version classes are deprecated:DeprecationWarning', # tensorflow-probability
'ignore:the `interpolation=` argument to percentile was renamed to `method=`, which has additional options:DeprecationWarning', # Issue #1772
"ignore:The interpolation= argument to 'quantile' is deprecated. Use 'method=' instead:DeprecationWarning", # Issue #1772
'ignore: Exception ignored in:pytest.PytestUnraisableExceptionWarning', #FIXME: Exception ignored in: <_io.FileIO [closed]>
'ignore:invalid value encountered in (true_)?divide:RuntimeWarning', #FIXME
'ignore:invalid value encountered in add:RuntimeWarning', #FIXME
"ignore:In future, it will be an error for 'np.bool_' scalars to be interpreted as an index:DeprecationWarning", #FIXME: tests/test_tensor.py::test_pdf_eval[pytorch]
'ignore:Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with:UserWarning', #FIXME: tests/test_optim.py::test_minimize[no_grad-scipy-pytorch-no_stitch]
'ignore:divide by zero encountered in (true_)?divide:RuntimeWarning', #FIXME: pytest tests/test_tensor.py::test_pdf_calculations[numpy]
'ignore:[A-Z]+ is deprecated and will be removed in Pillow 10:DeprecationWarning', # keras
"ignore:the imp module is deprecated:DeprecationWarning",
"ignore:distutils Version classes are deprecated:DeprecationWarning",
"ignore:the `interpolation=` argument to percentile was renamed to `method=`, which has additional options:DeprecationWarning",
"ignore:The interpolation= argument to 'quantile' is deprecated. Use 'method=' instead:DeprecationWarning",
"ignore: Exception ignored in:pytest.PytestUnraisableExceptionWarning",
"ignore:invalid value encountered in (true_)?divide:RuntimeWarning",
"ignore:invalid value encountered in add:RuntimeWarning",
"ignore:In future, it will be an error for 'np.bool_' scalars to be interpreted as an index:DeprecationWarning",
"ignore:Creating a tensor from a list of numpy.ndarrays is extremely slow. Please consider converting the list to a single numpy.ndarray with:UserWarning",
"ignore:divide by zero encountered in (true_)?divide:RuntimeWarning",
"ignore:[A-Z]+ is deprecated and will be removed in Pillow 10:DeprecationWarning",
]

[tool.nbqa.mutate]
pyupgrade = 1

[tool.nbqa.addopts]
pyupgrade = ["--py37-plus"]
pyupgrade = [
"--py37-plus",
]
Loading