/hep-python-tools:python-packagingfrom hep-python-tools
Guides creation of modern Python packages with pyproject.toml, src layout, build backends (hatchling, flit, uv_build), VCS versioning, and pixi/uv environments for HEP projects.
Ships in hep-python-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Modern Python packages declare all metadata in pyproject.toml and use a
dedicated build backend (hatchling, flit, uv_build, etc.). The src layout
(src/<package>/) is the community standard. Environment management for HEP
projects should use pixi (preferred) or uv.
The Scientific Python community maintains a template ( scientific-python/cookie) and checker (sp-repo-review) that encode these recommendations. Use them as a reference for new projects.
setup.py / setup.cfg project to pyproject.tomlpixi.toml for reproducible developer environments| Concept | Details |
|---|---|
pyproject.toml | Single config file; replaces setup.py, setup.cfg, MANIFEST.in |
| Build backend | Hatchling is recommended; flit-core and uv_build also work well |
| src layout | src/<package>/ prevents accidental local-import bugs |
requires-python | Set minimum; never set an upper cap |
| VCS versioning | hatch-vcs reads git tags; no manual version bumps |
| pixi | Preferred for lockfile-based reproducible environments |
[project])[project]
name = "my-hep-tool"
description = "Short description"
readme = "README.md"
license = "MIT"
requires-python = ">=3.11"
dynamic = ["version"]
dependencies = [
"awkward>=2",
"uproot>=5",
"hist>=2.7",
]
# Optional extras ship with the package (installed via `pip install pkg[plot]`
# or `uv sync --extra plot`):
[project.optional-dependencies]
plot = ["matplotlib", "mplhep"]
# Local-only dev tools (PEP 735 dependency groups, installed via
# `uv sync --group dev`); these are NOT published to PyPI:
[dependency-groups]
dev = ["pytest", "pytest-cov"]
dynamic = ["version"] lets the backend compute the version; omit it only if
you pin the version manually.
my-hep-tool/
pyproject.toml
pixi.toml # or uv.lock / environment.yaml
src/
my_hep_tool/
__init__.py
analysis.py
tests/
test_analysis.py
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
[tool.hatch.version]
source = "vcs"
Add these two files so git archive (GitHub downloads) also get the version:
.git_archival.txt:
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
.gitattributes (append):
.git_archival.txt export-subst
# pixi.toml
# The manifest table is [workspace]; older pixi used [project] (now renamed).
[workspace]
name = "my-hep-tool"
channels = ["conda-forge"]
platforms = ["linux-64", "osx-arm64"]
[dependencies]
python = ">=3.11"
awkward = ">=2"
uproot = ">=5"
hist = ">=2.7"
[feature.dev.dependencies]
pytest = "*"
pre-commit = "*"
[feature.dev.tasks]
test = "pytest"
pre-commit = "pre-commit run --all-files"
[environments]
dev = { features = ["dev"], solve-group = "default" }
# In pyproject.toml, uv_build backend
[build-system]
requires = ["uv_build>=0.7.19"]
build-backend = "uv_build"
Run with uv run pytest or uv sync --group dev.
setup.py or setup.cfg for new projects — those are
setuptools-specific legacy files. Modern backends don't use them.requires-python: >=3.11 is correct; >=3.11,<4 is not
— upper caps break installation for future Python versions.import my_hep_tool silently picks up the
un-installed tree.license.file set explicitly in [project]; hatchling and
uv_build detect it automatically.dynamic = ["version"] must be set when using hatch-vcs; otherwise
hatchling expects a static version string.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
python-packaging, pyproject-toml, src-layout, build-backend, vcs-versioning, pixi
npx claudepluginhub usatlas/marketplace --plugin hep-python-tools6 skills in this plugin
/cli-creatorUse when building a Python command-line interface with Typer: adding arguments and options to a script, creating subcommands, wiring an entry point into pyproject.toml, validating CLI inputs with callbacks, or adding a CLI layer to an existing analysis script or HEP workflow./code-quality-toolsUse when setting up code quality tooling for a HEP Python project: configuring pre-commit hooks, adding ruff for linting and auto-formatting, setting up mypy for static type checking, or debugging linter failures in CI or a pre-commit run./pytest-speedupUse when a pytest suite is slow and needs speeding up: profiling slow tests, reducing collection time, parallelizing with pytest-xdist or pytest-split, selecting a subset of tests to run, blocking inadvertent network or large-file disk access in HEP tests, or optimizing CI test run time.