diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..ffbcaf55 --- /dev/null +++ b/.flake8 @@ -0,0 +1,7 @@ +[flake8] +# E501: line too long +extend-ignore = E501 +max-line-length = 88 +max-complexity = 18 +count = True +statistics = True diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 92502c8c..23fd02e7 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -186,7 +186,7 @@ jobs: - name: Install Python dependencies run: | python -m pip install uv - uv pip install --system --upgrade pip setuptools wheel + uv pip install --system --upgrade pip wheel uv pip install --system tbump python -m pip list diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ab9ba7a..27042c31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,7 +32,7 @@ jobs: - name: Install dependencies run: | python -m pip install uv - uv pip install --system --upgrade pip setuptools wheel + uv pip install --system --upgrade pip wheel uv pip install --system --quiet '.[test]' python -m pip list diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ae56e69a..2afac136 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: | python -m pip install uv - uv pip install --system --upgrade pip setuptools wheel + uv pip install --system --upgrade pip wheel uv pip install --system --quiet '.[lint]' python -m pip list diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index f110c8f0..757d21f2 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -38,17 +38,13 @@ jobs: with: python-version: '3.12' - - name: Install python-build, check-manifest, and twine + - name: Install python-build, and twine run: | python -m pip install uv - uv pip install --system --upgrade pip setuptools wheel - uv pip install --system build check-manifest twine + uv pip install --system --upgrade pip wheel + uv pip install --system build twine python -m pip list - - name: Check MANIFEST - run: | - check-manifest - - name: Build a sdist and a wheel run: | python -m build . diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 1c564100..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,11 +0,0 @@ -prune ** -graft src - -include setup.py -include setup.cfg -include LICENSE -include README.md -include pyproject.toml -include MANIFEST.in - -global-exclude __pycache__ *.py[cod] diff --git a/docker/Dockerfile b/docker/Dockerfile index e9d19fea..fb7b9d54 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get -qq -y update && \ rm -rf /var/lib/apt-get/lists/* && \ cd /code && \ python -m pip install uv && \ - uv pip install --system --upgrade --no-cache pip setuptools wheel && \ + uv pip install --system --upgrade --no-cache pip wheel && \ uv pip install --system --no-cache . && \ python -m pip list diff --git a/pyproject.toml b/pyproject.toml index a2d5e29c..55f36ffc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,12 +1,93 @@ [build-system] -# Minimum requirements for the build system to execute. -requires = ["setuptools>=42", "setuptools_scm[toml]>=3.4"] -build-backend = "setuptools.build_meta" +requires = [ + "hatchling>=1.13.0", + "hatch-vcs>=0.3.0", +] +build-backend = "hatchling.build" + +[project] +name = "pylhe" +dynamic = ["version"] +description = "A small package to get structured data out of Les Houches Event files" +readme = "README.md" +license = { text = "Apache-2.0" } # SPDX short identifier +requires-python = ">=3.8" +authors = [ + { name = "Lukas Heinrich", email = "lukas.heinrich@cern.ch" }, + { name = "Matthew Feickert", email = "matthew.feickert@cern.ch" }, + { name = "Eduardo Rodrigues", email = "eduardo.rodrigues@cern.ch" }, +] +maintainers = [ {name = "The Scikit-HEP admins", email = "scikit-hep-admins@googlegroups.com"} ] +keywords = [ + "lhe", + "physics", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "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 :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", +] +dependencies = [ + "awkward>=1.2.0", + "graphviz>=0.12.0", + "particle>=0.16", + "vector>=0.8.1", +] + +[project.optional-dependencies] +lint = [ + "black", + "flake8", +] +test = [ + "pydocstyle", + "pytest-cov>=2.5.1", + "pytest>=6.0", + "scikit-hep-testdata>=0.4.36", +] +develop = [ + "pyhf[lint,test]", + "pre-commit", + "tbump>=6.7.0", +] + +[project.urls] +Homepage = "https://github.com/scikit-hep/pylhe" +"Source Code" = "https://github.com/scikit-hep/pylhe" +"Issue Tracker" = "https://github.com/scikit-hep/pylhe/issues" +"Releases" = "https://github.com/scikit-hep/pylhe/releases" + +[tool.hatch.version] +source = "vcs" -[tool.setuptools_scm] -write_to = "src/pylhe/_version.py" +[tool.hatch.version.raw-options] local_scheme = "no-local-version" +[tool.hatch.build.hooks.vcs] +version-file = "src/pylhe/_version.py" + +[tool.hatch.build.targets.sdist] +# hatchling always includes: +# pyproject.toml, .gitignore, any README, any LICENSE, AUTHORS +include = [ + "/src", + "/tests", + "/CITATION.cff", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/pylhe"] + [tool.black] line-length = 88 include = '\.pyi?$' @@ -19,18 +100,6 @@ extend-exclude = ''' )/ ''' -[tool.check-manifest] -ignore = [ - 'examples/*', - 'tests/*', - 'docker/*', - '.*', - 'pyproject.toml', - 'pytest.ini', - 'codecov.yml', - 'CODE_OF_CONDUCT.md', -] - [tool.isort] profile = "black" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 11a4691c..00000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[metadata] -name = pylhe -description = small package to get structured data out of Les Houches Event files -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/scikit-hep/pylhe -author = Lukas Heinrich, Matthew Feickert, Eduardo Rodrigues -author_email = lukas.heinrich@cern.ch, matthew.feickert@cern.ch, eduardo.rodrigues@cern.ch -license = Apache -license_file = LICENSE -keywords = physics lhe -project_urls = - Source = https://github.com/scikit-hep/pylhe - Tracker = https://github.com/scikit-hep/pylhe/issues -classifiers = - Development Status :: 4 - Beta - License :: OSI Approved :: Apache Software License - Intended Audience :: Science/Research - Intended Audience :: Developers - Topic :: Scientific/Engineering - Topic :: Scientific/Engineering :: Physics - 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 :: 3.11 - Programming Language :: Python :: 3.12 -[options] -package_dir = - = src -packages = find: -include_package_data = True -python_requires = >=3.8 -install_requires = - graphviz>=0.12.0 - particle>=0.16 - awkward>=1.2.0 - vector>=0.8.1 - -[options.packages.find] -where = src - -[flake8] -# E501: line too long -extend-ignore = E501 -max-line-length = 88 -max-complexity = 18 -count = True -statistics = True diff --git a/setup.py b/setup.py deleted file mode 100644 index ff1a8e99..00000000 --- a/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -from setuptools import setup - -extras_require = {} -extras_require["lint"] = sorted({"flake8", "black"}) -extras_require["test"] = sorted( - { - "pytest~=6.0", - "pytest-cov>=2.5.1", - "scikit-hep-testdata>=0.4.36", - "pydocstyle", - } -) -extras_require["develop"] = sorted( - set( - extras_require["lint"] - + extras_require["test"] - + ["pre-commit", "check-manifest", "tbump>=6.7.0", "twine"] - ) -) -extras_require["complete"] = sorted(set(sum(extras_require.values(), []))) - -setup( - extras_require=extras_require, - use_scm_version=lambda: {"local_scheme": lambda version: ""}, -)