bridge.pipelines.policies.bt2gh package#

Public Interface#

This section documents user-facing interface of the bridge.pipelines.policies.bt2gh package (as defined in its __init__.py file).

Functions#

reconcile_bt_ontop_gh(*, gh_norm, bt_norm, ...)

Apply a generic bio.tools-on-top-of-GitHub policy for additive metadata.

reconcile_bt_over_gh(*, gh_norm, bt_norm, ...)

Apply a generic bio.tools-over-GitHub policy to decide whether to propose a GitHub issue or pull request based on bio.tools metadata.

Generic reconciliation policies for bio.tools to GitHub mapping.

bridge.pipelines.policies.bt2gh.reconcile_bt_ontop_gh(*, gh_norm, bt_norm, make_output, log_label)[source]#

Apply a generic bio.tools-on-top-of-GitHub policy for additive metadata.

This function is intended for multi-valued fields where bio.tools can contribute additional values without replacing existing GitHub ones (e.g. topics, labels, EDAM terms). Both GitHub and bio.tools values are provided as sets and the function computes the subset of bio.tools values that are missing from GitHub.

Policy: 1. If bt_norm is None or empty, bio.tools is treated as silent and

no issue/pr is proposed. An “unchanged” log entry is emitted.

  1. If gh_norm is None or empty, all values from bt_norm are considered missing and an issue/pr is proposed with an “added” log entry.

  2. If both gh_norm and bt_norm are non-empty: - If all values in bt_norm are already present in gh_norm,

    no issue/pr is proposed and an “exact” log entry is emitted.

    • Otherwise, the set difference missing = bt_norm - gh_norm is passed to make_output and an “added” log entry is emitted.

Parameters:
  • gh_norm (set[GHN] | None) – Normalized set of values currently present on GitHub, or None if no values are recorded.

  • bt_norm (set[BTN] | None) – Normalized set of values from bio.tools, or None if bio.tools does not provide values for this field.

  • make_output (Callable[[set[BTN]], OUTPUT]) – Callable that constructs an issue/pr payload from the set of missing bio.tools values.

  • log_label (str) – Short label used in log messages to identify the metadata field (e.g., "topics", "edam terms").

Returns:

Issue payload to propose according to the policy, or None if no issue should be created.

Return type:

ISSUE | None

async bridge.pipelines.policies.bt2gh.reconcile_bt_over_gh(*, gh_norm, bt_norm, make_output, log_label, equality_fn=None)[source]#

Apply a generic bio.tools-over-GitHub policy to decide whether to propose a GitHub issue or pull request based on bio.tools metadata.

This function operates on normalized representations of GitHub and bio.tools values (gh_norm and bt_norm) and returns an issue/pr payload constructed from the bio.tools value when applicable.

Policy: 1. If bt_norm is None, bio.tools is treated as silent and no

issue/pr is proposed. An “unchanged” log entry is emitted.

  1. If gh_norm is not None and equals bt_norm, the values are considered aligned and no issue/pr is proposed. An “exact” log entry is emitted.

  2. If gh_norm is not None and differs from bt_norm, GitHub is treated as conflicting with bio.tools. A conflict log entry is emitted and an issue/pr proposing the bio.tools value is constructed via make_output(bt_norm).

  3. If gh_norm is None and bt_norm is not None, GitHub is missing the value and an issue/pr proposing the bio.tools value is constructed via make_output(bt_norm) with an added log entry.

Parameters:
  • gh_norm (GHN | None) – Normalized representation of the GitHub value, or None if no usable value is available from GitHub.

  • bt_norm (BTN | None) – Normalized representation of the bio.tools value, or None if no value is recorded in bio.tools.

  • make_output (Callable[[BTN], Awaitable[OUTPUT] | OUTPUT]) – Callable that constructs an issue/pr payload from the normalized bio.tools value. The callable may be asynchronous.

  • log_label (str) – Short label used in log messages to identify the metadata field (e.g., "description", "homepage", "license").

  • equality_fn (Callable[[GHN, BTN], bool] | None, optional) – Optional equality function to compare normalized GitHub and bio.tools values. If None, the default equality operator (==) is used.

Returns:

Issue/pr payload to propose according to the policy, or None if no issue should be created.

Return type:

OUTPUT | None

Submodules#

reconcile_bt_ontop_gh

Apply a generic bio.tools-on-top-of-GitHub policy for additive metadata.

reconcile_bt_over_gh

Apply a generic bio.tools-over-GitHub policy to decide whether to propose a GitHub issue or pull request based on bio.tools metadata.

Dependencies diagram#

Each architecture diagram below visualizes the internal dependency structure of the bridge.pipelines.policies.bt2gh package. It shows how modules and subpackages within the package depend on each other, based on direct Python imports.

  • Packages are shown as purple rectangles

  • Modules are shown as pink rectangles

  • Arrows (A → B) indicate that A directly imports B

Each subpackage’s diagram focuses only on its own internal structure, it does not include imports to or from higher-level packages (those appear in the parent package’s diagram).

bridge package dependencies