Skip to content

Commit

Permalink
feat: move to hatchling (#423)
Browse files Browse the repository at this point in the history
* feat: move to hatchling

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* chore: minor cleanup

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>

* Update pyproject.toml

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Oct 7, 2022
1 parent e53a502 commit 723c161
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 144 deletions.
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-complexity = 24
extend-ignore = E501, E402, B950
extend-select = B9
16 changes: 3 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ci:
autoupdate_commit_msg: "chore(deps): update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand All @@ -26,24 +28,12 @@ repos:
hooks:
- id: black-jupyter

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.0.0
hooks:
- id: setup-cfg-fmt
args: [--include-version-classifiers, --max-py-version=3.11]

- repo: https://github.com/asottile/pyupgrade
rev: v2.38.2
hooks:
- id: pyupgrade
args: ["--py37-plus"]

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

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
Expand Down
24 changes: 0 additions & 24 deletions MANIFEST.in

This file was deleted.

5 changes: 4 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ def build(session: nox.Session) -> None:
Build an SDist and wheel.
"""

session.install("build", "twine")
session.install("build", "twine", "check-wheel-contents")
session.run("python", "-m", "build")
session.run("twine", "check", "--strict", "dist/*")
session.run(
"check-wheel-contents", str(*Path("dist").glob("*.whl")), "--ignore=W002"
)


@nox.session
Expand Down
101 changes: 84 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,80 @@
[build-system]
requires = [
"setuptools>=42",
"setuptools_scm[toml]>=3.4"
]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.setuptools_scm]
write_to = "src/particle/version.py"
[project]
name = "particle"
description = "Extended PDG particle data and MC identification codes"
readme = "README.rst"
requires-python = ">=3.7"
authors = [
{ name = "Eduardo Rodrigues", email = "eduardo.rodrigues@cern.ch" },
{ name = "Henry Schreiner", email = "henryfs@princeton.edu" },
]
maintainers = [
{ name = "Scikit-HEP", email = "scikit-hep-admins@googlegroups.com" },
]
keywords = [
"HEP",
"MC identification codes",
"PDG",
"PDGID",
"particle",
"particle data table",
"particle properties",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"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 :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering",
]
dependencies = [
"attrs>=19.2",
"hepunits>=2.0.0",
"importlib-resources>=2.0;python_version<\"3.9\"",
"typing-extensions;python_version<\"3.8\"",
]
dynamic = ["version"]

[tool.check-manifest]
ignore = [
"src/particle/version.py",
"noxfile.py",
[project.optional-dependencies]
dev = [
"pandas",
"pytest-benchmark",
"pytest>=6",
"tabulate",
]
test = [
"pandas",
"pytest-benchmark",
"pytest-cov",
"pytest>=6",
"tabulate",
]

[project.urls]
Homepage = "https://github.com/scikit-hep/particle"


[tool.hatch]
version.source = "vcs"
build.hooks.vcs.version-file = "src/particle/version.py"

[tool.isort]
profile = "black"
add_imports = ["from __future__ import annotations"]


[tool.mypy]
warn_unused_configs = true
warn_unused_ignores = true
Expand All @@ -26,13 +83,17 @@ files = "src"
strict = true
show_error_codes = true
warn_unreachable = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]


enable_error_code = [
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]

# NumPy is used lightly, so ignored here for now
[[tool.mypy.overrides]]
module = [ "pandas.*", "numpy.*"]
module = [
"pandas.*",
"numpy.*",
]
ignore_missing_imports = true


Expand All @@ -41,7 +102,13 @@ minversion = "6.0"
testpaths = ["tests"]
junit_family = "xunit2"
log_cli_level = "info"
addopts = ["--benchmark-disable", "-ra", "--showlocals", "--strict-markers", "--strict-config"]
addopts = [
"--benchmark-disable",
"-ra",
"--showlocals",
"--strict-markers",
"--strict-config",
]
filterwarnings = [
"error",
]
78 changes: 0 additions & 78 deletions setup.cfg

This file was deleted.

11 changes: 0 additions & 11 deletions setup.py

This file was deleted.

0 comments on commit 723c161

Please sign in to comment.