Skip to content

Commit

Permalink
ci: Migrate build to use hatchling (#241)
Browse files Browse the repository at this point in the history
* Use hatchling and hatch-vcs as build system.
* Remove setuptools and related files from repository.
   - Remove setup.py, setup.cfg, MANIFEST.in.
   - Remove check-manifest from 'develop' extra.
* Remove setuptools install from CI.
* Remove check-manifest checks from CI.
* Add .flake8 file as flake8 doesn't support pyproject.toml.
  • Loading branch information
matthewfeickert authored Aug 23, 2024
1 parent a2e7ad1 commit 5168e71
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 114 deletions.
7 changes: 7 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
# E501: line too long
extend-ignore = E501
max-line-length = 88
max-complexity = 18
count = True
statistics = True
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Expand Down
11 changes: 0 additions & 11 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
103 changes: 86 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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?$'
Expand All @@ -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"

Expand Down
50 changes: 0 additions & 50 deletions setup.cfg

This file was deleted.

25 changes: 0 additions & 25 deletions setup.py

This file was deleted.

0 comments on commit 5168e71

Please sign in to comment.