hatch_build_scripts
Dependency injection without the boilerplate.
What it is and what it does
hatch-build-scripts is a build-time plugin for Hatch that extends the hatchling build backend to run arbitrary shell commands and capture their artifacts during package creation. You configure it in your project's pyproject.toml with arrays of commands, output directories, and artifact patterns (using .gitignore-style syntax), and the plugin executes those commands at build time, then includes the matched artifacts in your final distribution.
It's useful when your package needs to generate code, compile resources, or produce other files as part of the build process—things that can't be checked into version control or that depend on build-time decisions. The plugin depends on hatchling and pathspec, and requires Python 3.10 or later. It is classified as Beta and has not seen a release in over a year, though the repository remains maintained.
Use it for:
- Generate source code or configuration files at build time based on templates or external data.
- Compile or transpile assets (e.g., TypeScript to JavaScript, SCSS to CSS) and include them in the wheel.
- Run code generation tools (e.g., protobuf, GraphQL schema generators) and package the output.
- Build native extensions or run build scripts that produce binary artifacts for inclusion.
- Automate documentation generation or changelog processing as part of the package build.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Hatch build plugin that runs arbitrary shell commands during package building and includes their output artifacts in distributions.
Yes, if you need to run build-time scripts and include their artifacts in your distribution. The plugin is straightforward to configure and has no security issues. The aging maintenance status (442 days since last release) is a minor concern for a build tool, but the repository is not archived and remains functional. Install friction is low. Suitable for projects that genuinely need build-time artifact generation.
Install
hatch-build-scripts on PyPI
pip
pip install hatch-build-scriptsuv
uv add hatch-build-scriptspoetry
poetry add hatch-build-scriptsInstalling hatch_build_scripts
Before you install
Low friction installation as a pure-Python wheel. Maintenance status is aging—last release was 442 days ago—but the repository remains active and unarchived with recent commits.
License in practice
MIT License permits unrestricted use, modification, and distribution with no warranty. Safe for commercial and private projects.
Quickstart
# In pyproject.toml:
[build-system]
requires = ["hatchling", "hatch-build-scripts"]
build-backend = "hatchling.build"
[[tool.hatch.build.hooks.build-scripts.scripts]]
commands = ["echo 'Hello' > hello.txt"]
artifacts = ["hello.txt"]
out_dir = "out"
Requires Python 3.10 or later. Must be configured in pyproject.toml as a build-system requirement, not installed as a runtime dependency.
Verify before relying
- Whether the plugin handles complex shell syntax or only simple commands reliably.
- Performance impact when running many build scripts or large artifact collections.
- Compatibility with non-POSIX shells or Windows batch commands.
Package facts
| License | MIT License Copyright (c) 2025 Ryan Morshead <ryan.morshead@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — hatchling, pathspec |
| Maintenance | aging — 442 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 221,415/month — #9,279 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: hatch_build_scripts-1.0.0-py3-none-any.whl
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
hatchling-autoextras-hookA Hatchling metadata hook that automatically…
permissive · top 5,000 on PyPI
hatch-polylith-bricksA Hatch build hook that integrates Polylith…
permissive · top 15,000 on PyPI
hatch-cythonA Hatch build hook that integrates Cython…
permissive · top 15,000 on PyPI
hatch-requirements-txtA Hatchling plugin that reads project…
permissive · top 5,000 on PyPI
hatch-vcsA Hatch plugin that automatically determines…
permissive · top 1,000 on PyPI
runtime-builderDeclares and executes build rules for compiled…
unclear · top 15,000 on PyPI
hatch-fancy-pypi-readmeA Hatch plugin that generates dynamic PyPI…
permissive · top 5,000 on PyPI
checkmk-dev-toolsProvides CLI tools for Checkmk developers to…
unclear · top 15,000 on PyPI
uv-dynamic-versioningA Hatch plugin that automatically derives…
permissive · top 5,000 on PyPI