-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Switch to using Hatchling as build backend (#2095)
* Migrate build system to Hatchling and add Hatch configuration in pyproject.toml. - Use pip v21.2+'s ability to handle recursive dependencies to define nested extras. c.f. https://hynek.me/articles/python-recursive-optional-dependencies/ - Use hatch-vcs to dynamically determine the version information from Git. - Use 'only-include' option with `[tool.hatch.build.targets.sdist]` to avoid problem with hatchling discovering the symlink of src/pyhf/schemas under docs/ before src/ and skipping including it in the sdist. c.f. #791 and pypa/hatch#276 * Remove all setuptools related files: setup.py, setup.cfg, MANIFEST.in. * Add .flake8 config file as the config for flake8 had previously been in setup.cfg as flake8 doesn't support pyproject.toml. * Remove use of check-manifest from packaging GitHub Actions workflow. * Remove mention of setup.cfg from release checklist. * Add Scikit-HEP admins info to maintainers metadata. Co-authored-by: Angus Hollands <[email protected]> Co-authored-by: Ofek Lev <[email protected]>
- Loading branch information
1 parent
3eef1ff
commit 14127ae
Showing
7 changed files
with
152 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[flake8] | ||
# E203: whitespace before ':' | ||
# E402: module level import not at top of file | ||
# E501: line too long | ||
extend-ignore = E203, E402, E501 | ||
max-line-length = 88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,149 @@ | ||
[build-system] | ||
# Minimum requirements for the build system to execute. | ||
requires = ["setuptools>=61.0.0", "setuptools_scm>=7.0.1"] | ||
build-backend = "setuptools.build_meta" | ||
requires = ["hatchling>=1.0.0", "hatch-vcs"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "src/pyhf/_version.py" | ||
[project] | ||
name = "pyhf" | ||
dynamic = ["version"] | ||
description = "pure-Python HistFactory implementation with tensors and autodiff" | ||
readme = "README.rst" | ||
license = { text = "Apache-2.0" } # SPDX short identifier | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{ name = "Lukas Heinrich", email = "[email protected]" }, | ||
{ name = "Matthew Feickert", email = "[email protected]" }, | ||
{ name = "Giordon Stark", email = "[email protected]" }, | ||
] | ||
maintainers = [ {name = "The Scikit-HEP admins", email = "[email protected]"} ] | ||
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.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Scientific/Engineering :: Physics", | ||
] | ||
dependencies = [ | ||
"click>=8.0.0", # for console scripts | ||
"importlib_resources>=1.4.0; python_version < '3.9'", # for resources in schema | ||
"jsonpatch>=1.15", | ||
"jsonschema>=4.15.0", # for utils | ||
"pyyaml>=5.1", # for parsing CLI equal-delimited options | ||
"scipy>=1.5.1", # requires numpy, which is required by pyhf and tensorflow | ||
"tqdm>=4.56.0", # for readxml | ||
"numpy", # compatible versions controlled through scipy | ||
] | ||
|
||
[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" | ||
|
||
[project.optional-dependencies] | ||
shellcomplete = ["click_completion"] | ||
tensorflow = [ | ||
"tensorflow>=2.7.0", # c.f. PR #1962 | ||
"tensorflow-probability>=0.11.0", # c.f. PR #1657 | ||
] | ||
torch = ["torch>=1.10.0"] # c.f. PR #1657 | ||
jax = [ | ||
"jax>=0.4.1", # c.f. PR #2079 | ||
"jaxlib>=0.4.1", # c.f. PR #2079 | ||
] | ||
xmlio = ["uproot>=4.1.1"] # c.f. PR #1567 | ||
minuit = ["iminuit>=2.7.0"] # c.f. PR #1895 | ||
contrib = [ | ||
"matplotlib>=3.0.0", | ||
"requests>=2.22.0", | ||
] | ||
backends = ["pyhf[tensorflow,torch,jax,minuit]"] | ||
all = ["pyhf[backends,xmlio,contrib,shellcomplete]"] | ||
|
||
# Developer extras | ||
test = [ | ||
"pyhf[all]", | ||
"scikit-hep-testdata>=0.4.11", | ||
"pytest>=6.0", | ||
"coverage[toml]>=6.0.0", | ||
"pytest-mock", | ||
"requests-mock>=1.9.0", | ||
"pytest-benchmark[histogram]", | ||
"pytest-console-scripts", | ||
"pytest-mpl", | ||
"pydocstyle", | ||
"papermill~=2.3.4", | ||
"scrapbook~=0.5.0", | ||
"jupyter", | ||
"graphviz", | ||
"pytest-socket>=0.2.0", # c.f. PR #1917 | ||
] | ||
docs = [ | ||
"pyhf[xmlio,contrib]", | ||
"sphinx>=5.1.1", # c.f. https://github.com/scikit-hep/pyhf/pull/1926 | ||
"sphinxcontrib-bibtex~=2.1", | ||
"sphinx-click", | ||
"sphinx_rtd_theme", | ||
"nbsphinx!=0.8.8", # c.f. https://github.com/spatialaudio/nbsphinx/issues/620 | ||
"ipywidgets", | ||
"sphinx-issues", | ||
"sphinx-copybutton>=0.3.2", | ||
"sphinx-togglebutton>=0.3.0", | ||
"ipython!=8.7.0", # c.f. https://github.com/scikit-hep/pyhf/pull/2068 | ||
] | ||
develop = [ | ||
"pyhf[test,docs]", | ||
"tbump>=6.7.0", | ||
"pre-commit", | ||
"nox", | ||
"codemetapy>=2.3.0", | ||
] | ||
|
||
[tool.hatch.version] | ||
source = "vcs" | ||
|
||
[tool.hatch.version.raw-options] | ||
local_scheme = "no-local-version" | ||
|
||
[tool.hatch.build.hooks.vcs] | ||
version-file = "src/pyhf/_version.py" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
# only-include needed to properly include src/pyhf/schemas | ||
# c.f. https://github.com/pypa/hatch/pull/299 | ||
only-include = [ | ||
"/src", | ||
"/LICENSE", | ||
"/README.rst", | ||
"/pyproject.toml", | ||
"/AUTHORS", | ||
"/CITATION.cff" | ||
] | ||
exclude = [ | ||
"/src/conftest.py" | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["src/pyhf"] | ||
|
||
[tool.black] | ||
line-length = 88 | ||
target-version = ['py38', 'py39', 'py310'] | ||
|
@@ -21,24 +158,6 @@ exclude = ''' | |
)/ | ||
''' | ||
|
||
[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" | ||
xfail_strict = true | ||
|