From 7d25d2eea2faa6e3829a893e53e36688c08d642e Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 19:05:55 -0500 Subject: [PATCH 01/10] build: Use hatchling as build backend * Migrate to using hatchling as the build backend. - Include all build metadata in pyproject.toml. - Remove setup.py, setup.cfg, and MANIFEST.in. - Remove package_data as not needed. * Remove MANIFEST check from CI. - Remove check-manifest install in CI workflow. - Remove MANIFEST check step from CI. --- .github/workflows/publish-package.yml | 8 +- MANIFEST.in | 12 --- pyproject.toml | 118 ++++++++++++++++++++++---- setup.cfg | 51 ----------- setup.py | 17 ---- 5 files changed, 105 insertions(+), 101 deletions(-) delete mode 100644 MANIFEST.in delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 82cf51d..b4c5fd0 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -31,17 +31,13 @@ jobs: with: python-version: '3.x' - - name: Install build, check-manifest, and twine + - name: Install 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 build twine uv pip list --system - - 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 90e312c..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -prune ** -graft src -graft tests - -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/pyproject.toml b/pyproject.toml index 6c0142b..5d12b21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,106 @@ +[build-system] +requires = [ + "hatchling>=1.13.0", + "hatch-vcs>=0.3.0", +] +build-backend = "hatchling.build" + +[project] +name = "recast_atlas" +dynamic = ["version"] +description = "RECAST for ATLAS at the LHC" +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" }, +] +maintainers = [ { name = "Matthew Feickert", email = "matthew.feickert@cern.ch" } ] +keywords = [ + "physics", + "RECAST", + "ATLAS", + "reinterpretation", + "analysis reuse", +] +classifiers = [ + "Development Status :: 4 - Beta", + "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", + "Programming Language :: Python :: Implementation :: CPython", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Physics", +] + +# TODO: Empirically evaluate lower bounds +dependencies = [ + "click>=7.0", # for console scripts + "jsonschema>=3.0.0", + "pyyaml>=5.1", # for parsing CLI options + "yadage-schemas>=0.10.7", # c.f. https://github.com/yadage/yadage-schemas/issues/35 + "importlib-resources>=5.10; python_version < '3.9'", # for accessing package filepaths +] + +[project.scripts] +recast = "recastatlas.cli:recastatlas" + +[project.urls] +Documentation = "https://github.com/recast-hep/recast-atlas" +Homepage = "https://github.com/recast-hep/recast-atlas" +"Issue Tracker" = "https://github.com/recast-hep/recast-atlas/issues" +"Releases" = "https://github.com/recast-hep/recast-atlas/releases" +"Source Code" = "https://github.com/recast-hep/recast-atlas" + +[project.optional-dependencies] +local = [ + "pydotplus==2.0.2", + "adage>=0.10.1", + "packtivity>=0.14.23", + "yadage>=0.20.1", # yadage[viz] breaks so install following manually + "pydot", # from yadage[viz] extra + "pygraphviz" # from yadage[viz] extra +] +kubernetes = ["kubernetes==9.0.0"] +reana = ["reana-client>=0.8.0"] +all = ["recast-atlas[local,kubernetes,reana]"] + +# Developer extras +develop = [ + "pytest>=7.0.0", + "flake8>=3.9.0", + "black", + "pre-commit", +] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.version.raw-options] +local_scheme = "no-local-version" + +[tool.hatch.build.hooks.vcs] +version-file = "src/recastatlas/_version.py" + +[tool.hatch.build.targets.sdist] +# hatchling always includes: +# pyproject.toml, .gitignore, any README, any LICENSE, AUTHORS +only-include = [ + "/src", + "/tests", + "/CITATION.cff" +] + +[tool.hatch.build.targets.wheel] +packages = ["src/recastatlas"] + [tool.black] line-length = 88 skip-string-normalization = true @@ -9,18 +112,3 @@ exclude = ''' | build )/ ''' - -[tool.check-manifest] -ignore = [ - 'docs*', - 'validation*', - 'examples*', - 'tests*', - 'docker*', - 'binder*', - '.*', - 'pyproject.toml', - 'pytest.ini', - 'CODE_OF_CONDUCT.md', - 'CONTRIBUTING.md', -] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b33846f..0000000 --- a/setup.cfg +++ /dev/null @@ -1,51 +0,0 @@ -[metadata] -name = recast_atlas -version = 0.4.0 -description = RECAST for ATLAS at the LHC -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/recast-hep/recast-atlas -author = Lukas Heinrich -author_email = lukas.heinrich@cern.ch -license = Apache -license_file = LICENSE -classifiers = - Development Status :: 4 - Beta - 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.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: Implementation :: CPython - Topic :: Scientific/Engineering - Topic :: Scientific/Engineering :: Physics -keywords = physics recast atlas -project_urls = - Documentation = https://github.com/recast-hep/recast-atlas - Source Code = https://github.com/recast-hep/recast-atlas - Issue Tracker = https://github.com/recast-hep/recast-atlas/issues - -[options] -packages = find: -# TODO: Empirically evaluate lower bounds -install_requires = - click>=7.0 # for console scripts - jsonschema>=3.0.0 - pyyaml>=5.1 # for parsing CLI options - yadage-schemas>=0.10.7 # c.f. https://github.com/yadage/yadage-schemas/issues/35 - importlib-resources>=5.10;python_version<'3.9' # for accessing package filepaths -python_requires = >=3.8 -include_package_data = True -package_dir = - = src - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - recast = recastatlas.cli:recastatlas diff --git a/setup.py b/setup.py deleted file mode 100644 index 9951715..0000000 --- a/setup.py +++ /dev/null @@ -1,17 +0,0 @@ -from setuptools import setup - -extras_require = { - 'develop': {'pytest', 'flake8>=3.9.0', 'black'}, - 'local': [ - 'pydotplus==2.0.2', - 'adage>=0.10.1', - 'packtivity>=0.14.23', - 'yadage>=0.20.1', # yadage[viz] breaks so install following manually - 'pydot', # from yadage[viz] extra - 'pygraphviz', # from yadage[viz] extra - ], - 'kubernetes': ['kubernetes==9.0.0'], - 'reana': ['reana-client>=0.8.0'], -} - -setup(extras_require=extras_require) From fc79c41ecd0d76a61a152f04de24e4b1ea338873 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 19:31:31 -0500 Subject: [PATCH 02/10] Ignore version file --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index badf98d..c43be0f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ htmlcov dist .coverage.* docs/_build + +# version file +src/recastatlas/_version.py From f3bb68d900550f4a18c4b08260292b02aeb06919 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 19:34:37 -0500 Subject: [PATCH 03/10] Use pipx to not install to lint --- .github/workflows/lint.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c776daf..ec307d9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -21,17 +21,10 @@ jobs: with: python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install uv - uv pip install --system --upgrade pip setuptools wheel - uv pip install --system --upgrade '.[develop]' - uv pip list --system - - name: Lint with flake8 run: | - python -m flake8 . + pipx run flake8 . - name: Lint with Black run: | - black --check --diff --verbose . + pipx run black --check --diff --verbose . From cbec067e546c8b87301589c305880dd1a42d48fa Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 19:45:20 -0500 Subject: [PATCH 04/10] Try switching to code only for build --- docker/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index cbc33c5..1224828 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,14 +36,15 @@ RUN apk add --update && \ font-bitstream-type1 \ ttf-freefont -WORKDIR /code COPY . /code +# Set PATH to pickup virtual environment by default ENV PATH=/usr/local/venv/bin:"${PATH}" RUN python3 -m venv /usr/local/venv && \ . /usr/local/venv/bin/activate && \ + cd /code && \ python -m pip --no-cache-dir install --upgrade uv && \ - uv --no-cache pip install --upgrade pip setuptools wheel && \ + uv --no-cache pip install --upgrade pip wheel && \ uv --no-cache pip install \ lxml \ cryptography \ From 6291914509b9bf04dee9d51bd858a0162685ce2f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 19:57:14 -0500 Subject: [PATCH 05/10] Add git archival options to support auto versioning --- .git_archival.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .git_archival.txt diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000..8fb235d --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ From b9c24c2378db029dae15e5dcf94fa7b1bbf957d9 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 20:14:06 -0500 Subject: [PATCH 06/10] Add docker ignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..37269f7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.nox +.*cache From a6c515e6c088e07c1cb4e2a669d1e081492d6e4d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 20:16:23 -0500 Subject: [PATCH 07/10] Try with git attributes --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..743057e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +.git_archival.txt export-subst +*.py diff=python +*.md diff=markdown From 769c9106fd9d47ff48dc3bf46b2bde62855e8cd1 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 20:34:48 -0500 Subject: [PATCH 08/10] Add git --- docker/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/Dockerfile b/docker/Dockerfile index 1224828..8cb073e 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,6 +3,7 @@ FROM docker:20.10.5 RUN apk add --update && \ apk add --no-cache \ build-base \ + git \ gcc \ make \ automake \ From 59aa84c5d73b8031debce0d3fe6b7b218929fc9c Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 20:37:21 -0500 Subject: [PATCH 09/10] Revert "Try with git attributes" This reverts commit a6c515e6c088e07c1cb4e2a669d1e081492d6e4d. --- .gitattributes | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 743057e..0000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -.git_archival.txt export-subst -*.py diff=python -*.md diff=markdown From f7a8cf36ed6b74c17c237fba5454544f4fb0f702 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 15 Jun 2024 20:37:40 -0500 Subject: [PATCH 10/10] Revert "Add docker ignore" This reverts commit b9c24c2378db029dae15e5dcf94fa7b1bbf957d9. --- .dockerignore | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 37269f7..0000000 --- a/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -.nox -.*cache