-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Migrate to hatchling for packaging (#553)
* Change from setuptools to hatchling for packaging and package distribution building. - Move all packaging information into pyproject.toml. - Use vcs information to determine version information. - Ignore the vcs generated _version.py file. - Remove setup.cfg and VERSION files. * Switching to getting version information from importlib.metadata.version in the docs. * Clone the full repository history as needed in CI to get all tag information.
- Loading branch information
1 parent
853ee6a
commit b7f7916
Showing
8 changed files
with
133 additions
and
74 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,3 +144,6 @@ patches/ | |
black.sh | ||
run_sphinx.sh | ||
publish.sh | ||
|
||
# version information | ||
*_version.py |
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 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,21 +1,118 @@ | ||
# Black formatting options | ||
[build-system] | ||
requires = [ | ||
"hatchling>=1.13.0", | ||
"hatch-vcs>=0.3.0", | ||
] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "madminer" | ||
dynamic = ["version"] | ||
description = "Mining gold from MadGraph to improve limit setting in particle physics" | ||
readme = "README.md" | ||
license = { text = "MIT" } # SPDX short identifier | ||
requires-python = ">=3.8" | ||
authors = [ | ||
{ name = "Johann Brehmer", email = "[email protected]" }, | ||
{ name = "Felix Kling" }, | ||
{ name = "Irina Espejo" }, | ||
{ name = "Sinclert Perez" }, | ||
{ name = "Kyle Cranmer", email = "[email protected]" }, | ||
] | ||
maintainers = [ {name = "Matthew Feickert", email = "[email protected]"} ] | ||
keywords = [ | ||
"physics", | ||
"simulation based inference", | ||
] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"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 = [ | ||
"h5py", | ||
"matplotlib>=2.0.0", | ||
"particle>=0.16.0", | ||
"scipy>=1.0.0", | ||
"sympy>=0.7.4", | ||
"torch>=1.0.0", | ||
"uproot>=4.0.0", | ||
"vector>=0.8.4", | ||
"numpy", # compatible versions controlled through scipy | ||
] | ||
|
||
[project.urls] | ||
Documentation = "https://madminer.readthedocs.io/" | ||
Homepage = "https://github.com/madminer-tool/madminer" | ||
"Issue Tracker" = "https://github.com/madminer-tool/madminer/issues" | ||
"Releases" = "https://github.com/madminer-tool/madminer/releases" | ||
"Source Code" = "https://github.com/madminer-tool/madminer" | ||
|
||
[project.optional-dependencies] | ||
examples = [ | ||
"bqplot", | ||
"pandas", | ||
] | ||
|
||
# Developer extras | ||
lint = [ | ||
"black[jupyter]", | ||
"isort", | ||
] | ||
test = [ | ||
"pytest>=6.0", | ||
] | ||
docs = [ | ||
"myst-parser", | ||
"numpydoc", | ||
"sphinx>=7.0.0", | ||
"sphinx-rtd-theme>=1.3.0", | ||
] | ||
|
||
[tool.hatch.version] | ||
source = "vcs" | ||
|
||
[tool.hatch.version.raw-options] | ||
local_scheme = "no-local-version" | ||
|
||
[tool.hatch.build.hooks.vcs] | ||
version-file = "madminer/_version.py" | ||
|
||
[tool.hatch.build.targets.sdist] | ||
# hatchling always includes: | ||
# pyproject.toml, .gitignore, any README, any LICENSE, AUTHORS | ||
only-include = [ | ||
"/madminer", | ||
"/CITATION.cff" | ||
] | ||
|
||
[tool.hatch.build.targets.wheel] | ||
packages = ["madminer"] | ||
|
||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38', 'py39', 'py310'] | ||
include = '(\.py$|\.ipynb$)' | ||
include = '(\.pyi?$|\.ipynb$)' | ||
exclude = ''' | ||
( | ||
\.eggs | ||
| \.git | ||
| \.hg | ||
| \.mypy_cache | ||
| \.tox | ||
| \.nox | ||
| \.venv | ||
| _build | ||
| buck-out | ||
| build | ||
| dist | ||
| mg_processes | ||
) | ||
''' | ||
|
||
|
@@ -24,3 +121,16 @@ force_single_line = true | |
ignore_whitespace = true | ||
only_sections = true | ||
profile = "black" | ||
|
||
[tool.coverage.run] | ||
source = ["madminer"] | ||
branch = true | ||
omit = ["*/madminer/typing.py"] | ||
|
||
[tool.coverage.report] | ||
precision = 1 | ||
sort = "cover" | ||
show_missing = true | ||
exclude_also = [ | ||
"if TYPE_CHECKING:" | ||
] |