New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hatch-build-scripts

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hatch-build-scripts

A plugin for Hatch for writing build scripts

  • 0.0.4
  • Source
  • PyPI
  • Socket score

Maintainers
1

Hatch Build Scripts

A plugin for Hatch that allows you to run arbitrary build scripts and include their artifacts in your package distributions.

Installation

To set up hatch-build-scripts for your project you'll need to configure it in your project's pyproject.toml file as a build-system requirement:

[build-system]
requires = ["hatchling", "hatch-build-scripts"]
build-backend = "hatchling.build"

Usage

Now you'll need to configure the build scripts you want to run. This is done by adding an array of scripts to the tool.hatch.build.hooks.build-scripts.scripts key in your pyproject.toml file. Each script is configured with the following keys:

KeyDefaultDescription
commandsrequiredAn array of commands to run. Each command is run in a separate shell.
artifactsrequiredAn array of artifact patterns (same as .gitignore) to include in your package distributions.
out_dir"."The directory to copy artifacts into.
work_dir"."The directory to run the commands in. All artifact patterns are relative to this directory.
clean_artifactstrueWhether to clean files from the out_dir that match the artifact patterns before running the commands.
clean_out_dirfalseWhether to clean the out_dir before running the commands.

In practice this looks like:

[[tool.hatch.build.hooks.build-scripts.scripts]]
out_dir = "out"
commands = [
    "echo 'Hello, world!' > hello.txt",
    "echo 'Goodbye, world!' > goodbye.txt",
]
artifacts = [
    "hello.txt",
    "goodbye.txt",
]

[[tool.hatch.build.hooks.build-scripts.scripts]]
# you can add more scripts here...

You can configure script defaults for scripts by adding a [tool.hatch.build.hooks.build-scripts] table to your pyproject.toml file. The following keys are supported:

KeyDefaultDescription
out_dir"."The directory to copy artifacts into.
work_dir"."The directory to run the commands in. All artifact patterns are relative to this directory.
clean_artifactstrueWhether to clean files from the out_dir that match the artifact patterns before running the commands.
clean_out_dirfalseWhether to clean the out_dir before running the commands.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc