Skip to main content

bex-hooks

Project description

bex-hooks

bex-hooks is a configuration-driven entrypoint for bex that loads a workflow definition from a YAML file, resolves configured plugins, and executes hooks in order within an isolated environment bootstrapped by bex.

Content

Usage

bex-hooks is available on PyPI and is used as a bex entrypoint.

1. Add bex-hooks to the bootstrap header

In your workflow file, include bex-hooks in requirements and set the entrypoint:

# /// bootstrap
# requires-python: ">=3.11,<3.12"
# requirements: |
#   bex-hooks
#   bex-hooks-files
#   bex-hooks-python
# entrypoint: bex_hooks.exec:main
# ///

2. Configure plugins and hooks

Below the header, configure which plugins to load and which hooks to run:

config:
  plugins:
    - bex_hooks.hooks.python
    - bex_hooks.hooks.files

hooks:
  - id: files/download
    source: https://example.com/file.bin
    source_hash: md5:abc123...
    target: ./bin/file.bin

  - id: python/setup-python
    version: "3.12.8"
    requirements: |
      requests>=2,<3

CLI

This entrypoint exposes a CLI.

Global Options

The following options are defined by the entrypoint. They are set internally by the bootstrapper (via environment variables) and are not intended for manual use.

Flags Environment Variable Description
-f, --file BEX_FILE Path to the workflow file.
-C, --directory BEX_DIRECTORY Working directory used to resolve the workflow configuration.

Commands

Command Usage Description
run bex exec run -- <command> [args...] Executes the workflow, then runs the specified command within the resulting environment.
shell bex exec shell Executes the workflow, then opens an interactive shell using the resulting environment.
export bex exec export Executes the workflow and prints the resulting context as JSON (working_dir, metadata, environ).

Command arguments for run support templating using metadata produced by the entrypoint:

bex exec run -- echo "{working_dir}"

Configuration

The entrypoint expects the following YAML structure:

config:
  plugins:
    - some.plugin.module

hooks:
  - id: some/hook
    if: some_condition
    # hook-specific fields...

config

General entrypoint configuration.

Field Type Default Description
plugins list[str] [] List of plugin modules to load. Plugins register available hooks.

hooks

Ordered list of hook definitions. Each hook entry has the following structure:

Field Type Default Description
id str (required) Identifier of the hook to execute.
if str None Optional conditional expression. The hook executes only if the condition evaluates to true.
(extra fields) varies Additional fields are passed directly to the hook implementation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bex_hooks-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bex_hooks-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file bex_hooks-0.1.0.tar.gz.

File metadata

  • Download URL: bex_hooks-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bex_hooks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8fd77e8015a752ed3202968c8d0510077e7a656e30d91975e477f083dc6a68b1
MD5 7a22e8f380667111c6e0db4596dd1ac4
BLAKE2b-256 9f400f565c6bb2f6dc6f9b6164b8aa5faf75aa602222073a18241555cf24df15

See more details on using hashes here.

File details

Details for the file bex_hooks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bex_hooks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bex_hooks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b6914bc85e19526590e023e10eacc9ee7ae902cb1e797725c7ebc28aa686c3
MD5 66d6ab3aff582b63d6b5e7efe41d9498
BLAKE2b-256 dfa0a5f7ca29339053f39db14dfdfee59a3c731e7997b6b2babd30db4d6cab19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page