Skip to content

Commit

Permalink
build: move to hatch, src and pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-eschle committed Jan 6, 2025
1 parent fb49c98 commit 65e9e4f
Show file tree
Hide file tree
Showing 23 changed files with 571 additions and 607 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ tests/plots
/data/backup/B2K1Gamma_RapidSim_7TeV_Tree.root
/data/backup/B2KstGamma_RapidSim_7TeV_KstarNonResonant_Tree.root
/data/backup/B2KstGamma_RapidSim_7TeV_Tree.root
/src/phasespace/_version.py
56 changes: 26 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ repos:
- id: fix-byte-order-marker
- id: check-ast

- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
hooks:
- id: docformatter
args:
- -r
- --in-place
- --wrap-descriptions=110
- --wrap-summaries=110
# Requires a fix: https://github.com/PyCQA/docformatter/issues/293
# - repo: https://github.com/PyCQA/docformatter
# rev: v1.7.6
# hooks:
# - id: docformatter
# args:
# - -r
# - --in-place
# - --wrap-descriptions=110
# - --wrap-summaries=110

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
Expand All @@ -41,56 +42,51 @@ repos:
- id: python-no-eval
- id: rst-directive-colons

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [ --py39-plus ]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
stages: [manual]
stages: [ manual ]

- repo: https://github.com/sondrelg/pep585-upgrade
rev: "v1.0" # Use the sha / tag you want to point at
hooks:
- id: upgrade-type-hints
args: ["--futures=true"]
args: [ "--futures=true" ]

- repo: https://github.com/MarcoGorelli/auto-walrus
rev: 0.3.4
hooks:
- id: auto-walrus
- repo: https://github.com/MarcoGorelli/auto-walrus
rev: 0.3.4
hooks:
- id: auto-walrus


# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v4.0.0-alpha.8"
# hooks:
# - id: prettier
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: "v4.0.0-alpha.8"
# hooks:
# - id: prettier

- repo: https://github.com/kynan/nbstripout
rev: 0.7.1
rev: 0.8.1
hooks:
- id: nbstripout

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.9"
rev: "v0.8.6"
hooks:
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix, --unsafe-fixes, --show-fixes , --line-length=120]
args: [ --fix, --unsafe-fixes, --show-fixes , --line-length=120 ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
1 change: 0 additions & 1 deletion benchmark/bench_phasespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from timeit import default_timer

import tensorflow as tf

from phasespace import phasespace

sys.path.append(os.path.dirname(__file__))
Expand Down
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
# absolute, like shown here.
#

import sphinx_bootstrap_theme

import phasespace
import sphinx_bootstrap_theme

# -- General configuration ---------------------------------------------

Expand Down
125 changes: 119 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,125 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools_scm[toml]>=3.4",
"setuptools_scm_git_archive",
"wheel"
requires = ["hatchling>=1.17.1", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "phasespace"
description = "TensorFlow implementation of the Raubold and Lynch method for n-body events"
authors = [{name = "Albert Puig Navarro", email = "apuignav@gmail.com"}]
maintainers = [{name = "zfit", email = "zfit@physik.uzh.ch"}]
license = {text = "BSD-3-Clause"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Operating System :: MacOS",
"Operating System :: Unix",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Physics",
]
keywords = ["TensorFlow", "phasespace", "HEP"]
urls = {Homepage = "https://github.com/zfit/phasespace"}
requires-python = ">=3.9"
dependencies = [
"tensorflow>=2.16.0",
"tensorflow_probability>=0.22.0",
]
dynamic = ["version"]

[project.readme]
file = "README.rst"
content-type = "text/x-rst"

[project.optional-dependencies]
tf = [
"tensorflow", # TODO(2.0): make this the only requirement, add versions, remove from install_requires
"tensorflow_probability",
]
tensorflow = ["phasespace[tf]"]
fromdecay = [
"particle >= 0.16.0",
"zfit >=0.12.0",
"zfit-physics >= 0.6",
"decaylanguage >= 0.12.0", # not required but everyone using this feature will likely use DecayLanguage
]
vector = ["vector >= 1.0.0"]
all = [
"phasespace[fromdecay]",
"phasespace[vector]",
"phasespace[tf]",
]
test = [
"phasespace[all]",
"awkward>=1.0,<2.0",
"coverage",
"flaky",
"matplotlib",
"nbval",
"numpy",
"pytest",
"pytest-cov",
"pytest-xdist",
"scipy",
"uproot>=4.0,<5.0",
"wget",
]
doc = [
"phasespace[fromdecay]",
"phasespace[vector]",
"graphviz",
"Sphinx",
"myst-nb",
"sphinx_bootstrap_theme",
"jupyter_sphinx",
"sphinx-math-dollar",
]
dev = [
"phasespace[doc]",
"phasespace[test]",
"bumpversion",
"pre-commit",
"twine",
"watchdog",
]

[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/phasespace/_version.py"
metadata.allow-direct-references = true

[tool.distutils.bdist_wheel]
universal = 1

[tool.flake8]
exclude = """
benchmark,
data,
dist,
docs,
paper,
scripts,
utils"""
max-line-length = "110"
statistics = "True"
max-complexity = "30"

[tool.coverage.run]
branch = true
include = ["phasespace/*"]

[tool.pytest.ini_options]
addopts = """
--color=yes
--ignore=setup.py"""
filterwarnings = ["ignore:.*the imp module is deprecated in favour of importlib.*:DeprecationWarning"]
norecursedirs = ["tests/helpers"]

build-backend = "setuptools.build_meta"

[tool.isort]
profile = "black"
Expand Down
114 changes: 0 additions & 114 deletions setup.cfg

This file was deleted.

20 changes: 0 additions & 20 deletions setup.py

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 65e9e4f

Please sign in to comment.