ho22joshua commited on
Commit
d5cfbf0
·
1 Parent(s): cbbff50

build: harden packaging and release validation

Browse files
.gitignore CHANGED
@@ -6,6 +6,7 @@ slurm/
6
  .png
7
 
8
  # Python tooling
 
9
  .pytest_cache/
10
  .ruff_cache/
11
  .mypy_cache/
@@ -16,6 +17,9 @@ htmlcov/
16
  .coverage
17
  profiles/
18
  *.trace.json
 
 
 
19
 
20
  # Local data and generated outputs
21
  data/raw/*
 
6
  .png
7
 
8
  # Python tooling
9
+ *.py[cod]
10
  .pytest_cache/
11
  .ruff_cache/
12
  .mypy_cache/
 
17
  .coverage
18
  profiles/
19
  *.trace.json
20
+ dist/
21
+ build/
22
+ benchmark-results/
23
 
24
  # Local data and generated outputs
25
  data/raw/*
CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ### Added
6
+
7
+ - Release validation and CI coverage for the rewritten package.
8
+ - Installed-package Hydra configuration discovery and public import smoke tests.
9
+
10
+ ### Compatibility
11
+
12
+ - The `0.1.0` package version remains a static, single-source version exposed
13
+ as `gnn4colliders.__version__`.
MANIFEST.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ include README.md
2
+ include CHANGELOG.md
3
+ recursive-include docs *.md
docs/releasing.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Releasing
2
+
3
+ The project uses a static version defined once in
4
+ `src/gnn4colliders/__init__.py`; setuptools reads that value for package
5
+ metadata. The current package is not published to PyPI.
6
+
7
+ Before a release:
8
+
9
+ 1. Update `__version__`, `CHANGELOG.md`, and this release checklist.
10
+ 2. Run `uv sync --dev` (and `--extra root-gnn` when ROOT-GNN validation is
11
+ available), then run lint and tests.
12
+ 3. Run `bash scripts/dev/check_release.sh` to build and inspect the sdist and
13
+ wheel and smoke-test a wheel installation outside the checkout.
14
+ 4. Review the generated artifacts and `git diff`, then create a version tag
15
+ according to the repository's release policy.
16
+
17
+ The release-validation script never publishes artifacts. Publishing, if
18
+ adopted later, must use repository-managed credentials or trusted publishing.
19
+
20
+ The direct DGL wheel source is retained in `pyproject.toml` because the
21
+ validated ROOT-GNN environment requires the CUDA 12.1 DGL wheel. Core imports
22
+ do not import DGL or ONNX; install the corresponding extras for those
23
+ workflows.
pyproject.toml CHANGED
@@ -4,22 +4,26 @@ build-backend = "setuptools.build_meta"
4
 
5
  [project]
6
  name = "gnn4colliders"
7
- version = "0.1.0"
8
  description = "Graph neural network tools for collider event analysis."
9
  readme = "README.md"
10
- requires-python = ">=3.12"
11
  dependencies = [
12
  "awkward>=2.0",
13
  "hydra-core>=1.3",
14
- "numpy>=1.24",
15
  "scikit-learn>=1.3",
 
16
  "uproot>=5.0",
17
  ]
18
 
19
  [project.optional-dependencies]
20
- ml = [
21
- "dgl>=2.0",
22
- "torch>=2.0",
 
 
 
23
  ]
24
 
25
  [project.scripts]
@@ -27,27 +31,62 @@ gnn4colliders = "gnn4colliders.cli:main"
27
 
28
  [dependency-groups]
29
  dev = [
 
30
  "pytest>=8",
31
  "pytest-cov>=5",
32
  "ruff>=0.6",
 
33
  ]
34
 
35
  [tool.setuptools.packages.find]
36
  where = ["src"]
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  [tool.pytest.ini_options]
39
  testpaths = ["tests"]
40
  addopts = "-ra"
 
 
 
 
 
 
41
 
42
  [tool.ruff]
43
  line-length = 88
44
  target-version = "py312"
45
  src = ["src"]
46
- exclude = ["legacy"]
47
 
48
  [tool.ruff.lint]
49
  select = ["E", "F", "I"]
50
- exclude = ["legacy"]
51
 
52
  [tool.ruff.format]
53
  exclude = ["legacy"]
 
4
 
5
  [project]
6
  name = "gnn4colliders"
7
+ dynamic = ["version"]
8
  description = "Graph neural network tools for collider event analysis."
9
  readme = "README.md"
10
+ requires-python = ">=3.12,<3.13"
11
  dependencies = [
12
  "awkward>=2.0",
13
  "hydra-core>=1.3",
14
+ "numpy>=1.24,<2",
15
  "scikit-learn>=1.3",
16
+ "torch==2.2.2",
17
  "uproot>=5.0",
18
  ]
19
 
20
  [project.optional-dependencies]
21
+ root-gnn = [
22
+ "dgl==2.4.0+cu121",
23
+ ]
24
+ onnx = [
25
+ "onnx>=1.16,<2",
26
+ "onnxruntime>=1.18,<2",
27
  ]
28
 
29
  [project.scripts]
 
31
 
32
  [dependency-groups]
33
  dev = [
34
+ "matplotlib>=3.8,<4",
35
  "pytest>=8",
36
  "pytest-cov>=5",
37
  "ruff>=0.6",
38
+ "twine>=6,<7",
39
  ]
40
 
41
  [tool.setuptools.packages.find]
42
  where = ["src"]
43
 
44
+ [tool.setuptools.dynamic]
45
+ version = { attr = "gnn4colliders.__version__" }
46
+
47
+ [tool.setuptools.package-data]
48
+ "gnn4colliders.configs" = ["*.yaml", "*/*.yaml", "*/*/*.yaml"]
49
+
50
+ [tool.uv.sources]
51
+ torch = { index = "pytorch-cu121" }
52
+ dgl = { index = "dgl" }
53
+
54
+ [tool.uv]
55
+ environments = [
56
+ "sys_platform == 'linux' and platform_machine == 'x86_64' and python_full_version >= '3.12' and python_full_version < '3.13'",
57
+ ]
58
+
59
+ [[tool.uv.index]]
60
+ name = "pytorch-cu121"
61
+ url = "https://download.pytorch.org/whl/cu121"
62
+ explicit = true
63
+
64
+ [[tool.uv.index]]
65
+ name = "dgl"
66
+ url = "https://data.dgl.ai/wheels/torch-2.2/cu121/repo.html"
67
+ format = "flat"
68
+ explicit = true
69
+
70
+
71
  [tool.pytest.ini_options]
72
  testpaths = ["tests"]
73
  addopts = "-ra"
74
+ markers = [
75
+ "integration: small end-to-end tests using local fixtures",
76
+ "distributed: tests requiring torch distributed execution",
77
+ "legacy_env: tests requiring the historical runtime environment",
78
+ "gpu: tests requiring CUDA",
79
+ ]
80
 
81
  [tool.ruff]
82
  line-length = 88
83
  target-version = "py312"
84
  src = ["src"]
85
+ exclude = ["legacy", "tasks"]
86
 
87
  [tool.ruff.lint]
88
  select = ["E", "F", "I"]
89
+ exclude = ["legacy", "tasks"]
90
 
91
  [tool.ruff.format]
92
  exclude = ["legacy"]
scripts/dev/check_release.sh ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
5
+ cd "$repo_root"
6
+
7
+ rm -rf dist
8
+ uv run ruff check .
9
+ uv run ruff format --check .
10
+ uv run pytest
11
+ uv build
12
+
13
+ uv run python -m twine check dist/*
14
+
15
+ wheel="$(find dist -maxdepth 1 -type f -name '*.whl' -print -quit)"
16
+ test_root="$(mktemp -d)"
17
+ trap 'rm -rf "$test_root"' EXIT
18
+ python -m venv "$test_root/venv"
19
+ "$test_root/venv/bin/python" -m pip install --quiet "$wheel"
20
+ (
21
+ cd "$test_root"
22
+ "$test_root/venv/bin/python" -c \
23
+ 'import gnn4colliders; assert gnn4colliders.__version__ == "0.1.0"'
24
+ "$test_root/venv/bin/gnn4colliders" --help
25
+ "$test_root/venv/bin/gnn4colliders" train --help
26
+ "$test_root/venv/bin/gnn4colliders" evaluate --help
27
+ "$test_root/venv/bin/gnn4colliders" predict --help
28
+ "$test_root/venv/bin/gnn4colliders" export --help
29
+ )
src/gnn4colliders/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
- """New implementation of the GNN4Colliders project."""
2
 
3
- __all__: list[str] = []
 
 
 
1
+ """Public package metadata for GNN4Colliders."""
2
 
3
+ __version__ = "0.1.0"
4
+
5
+ __all__ = ["__version__"]
uv.lock CHANGED
The diff for this file is too large to render. See raw diff