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.1.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.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bex_hooks-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 8a63c22023877bb66e0fc4dbccfcd3735a264476a7cfe5fc49bddf1b40805858
MD5 c0aa93fcac7df0d96564cb75a98c7d7d
BLAKE2b-256 d5f48a4cd68489c01fa1302e3bc9073e96b3697edc598dee47dd319962c18c82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bex_hooks-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b238d146fd820dca9108c3e29de1ff71632f8d7dbb7f0dd1682838bc1c71ad62
MD5 44f50a71f9c892c8a8072093d536e69c
BLAKE2b-256 6836f7c742046f7b57abb20ffb950b86eeb63571a2855c76d96fe1f2af1db006

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