Hatch Build Scripts is a plugin for Hatch, the modern Python project manager, designed to allow users to execute arbitrary shell commands during the build process and include their generated artifacts directly within package distributions. It extends Hatch's build capabilities, providing a flexible way to automate tasks such as compiling assets or generating code, ensuring these outputs are properly bundled. The current stable version is 1.0.0, and releases follow an as-needed cadence to add features and fix bugs.
pip install hatch-build-scriptsVerified import paths — ran on the pinned version, not inferred.
To integrate `hatch-build-scripts`, add it to your project's `build-system.requires` in `pyproject.toml`. Then, define scripts under `[[tool.hatch.build.hooks.build-scripts.scripts]]` with `commands` to execute and `artifacts` patterns (like .gitignore) to include in your package. The `out_dir` specifies where artifacts should be placed within the build context.
Refer to the GitHub repository or the detailed PyPI description for the correct understanding of the plugin's functionality.
Carefully review the `quickstart` example and the official documentation for correct TOML syntax and required keys.
Ensure all IDEs and other applications are closed before running `hatch build`. If the issue persists, try deleting the Hatch cache directory (e.g., `C:\Users\{USERNAME}\AppData\Local\hatch`).Upgrade to `hatch-build-scripts>=1.0.0` to leverage automatic artifact cleaning. If on older versions, manually manage artifact cleanup via custom commands.