bridge.pipelines.bt2gh_for_pr_issues.map_funcs package#

Public Interface#

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

Functions#

map_citation(gh_citation_cff, bt_params)

Generate or update a CITATION.cff file based on bio.tools and Europe PMC metadata.

map_description(gh_description, bt_description)

Propose a GitHub issue to add a description based on bio.tools metadata, using the generic bio.tools-over-GitHub issue policy.

map_topics(gh_topics, bt_edam)

Propose a GitHub issue to add missing EDAM-based topics from bio.tools.

map_homepage(gh_schema, bt_homepage)

Propose a GitHub issue to add a homepage based on bio.tools metadata, using the generic bio.tools-over-GitHub issue policy.

map_readme(gh_readme, bt_params)

Map bio.tools metadata onto a GitHub README and return updated content.

map_license(gh_license, bt_license)

Propose a GitHub pull request to add a LICENSE file based on bio.tools license metadata, using the generic bio.tools-over-GitHub policy.

map_version(gh_latest_version_tag, bt_versions)

Propose a GitHub issue to make a GitHub release based on bio.tools version metadata, if needed.

map_name(gh_name, bt_params)

Propose a GitHub issue to update the GitHub repository name based on bio.tools name and ID metadata, using the generic bio.tools-over-GitHub issue policy.

Individual mapping functions for bio.tools to GitHub.

async bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_citation(gh_citation_cff, bt_params)[source]#

Generate or update a CITATION.cff file based on bio.tools and Europe PMC metadata.

Steps performed: 1. Reads publication metadata from a bio.tools tool entry. 2. Resolves each publication via the Europe PMC API to obtain

bibliographic metadata.

  1. Optionally parses an existing CITATION.cff (if provided) and extracts existing references and a preferred-citation.

  2. Merges existing references and new references, deduplicating based on DOI/PMID/PMCID/title.

  3. Chooses a preferred citation following the configured precedence rules.

  4. Merges top-level metadata from the existing CFF and bio.tools.

  5. Returns a dictionary mapping “CITATION.cff” to the YAML-serialized CFF content.

Parameters:
  • gh_citation_cff (dict[str, Any]) – Parsed content of an existing CITATION.cff file from the GitHub repository.

  • bt_params (dict[str, Any]) – The bio.tools tool metadata as a dictionary. Expected keys include: - ‘publication’ : list of publication items from bio.tools metadata. - ‘name’ : name of the tool. - ‘biotoolsID’ : bio.tools identifier. - ‘homepage’ : homepage or repository URL. - ‘license’ : license identifier. - ‘topic’ : list of topics. - ‘description’ : description of the tool.

Returns:

A dictionary with the filename “CITATION.cff” as key, and the YAML-formatted CFF content as value.

Return type:

dict[str, str]

async bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_description(gh_description, bt_description)[source]#

Propose a GitHub issue to add a description based on bio.tools metadata, using the generic bio.tools-over-GitHub issue policy.

Both the GitHub and bio.tools descriptions are normalized (HTML/whitespace cleanup) before comparison. A suggestion is only made when bio.tools provides a description and the GitHub repository has no description set; existing, differing GitHub descriptions are treated as authoritative and result in a logged conflict but no proposed issue.

Parameters:
  • gh_description (str | None) – The current description of the GitHub repository, or None if no description is set.

  • bt_description (str | None) – The description from the corresponding bio.tools entry, or None if not available.

Returns:

A mapping with the issue title as key and the issue body as value, or None if no issue is to be created under the policy.

Return type:

dict[str, str] | None

async bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_homepage(gh_schema, bt_homepage)[source]#

Propose a GitHub issue to add a homepage based on bio.tools metadata, using the generic bio.tools-over-GitHub issue policy.

All URLs (GitHub homepage, GitHub HTML URL, and bio.tools homepage) are compared in canonicalized form to avoid spurious differences due to trailing slashes, case, or query parameter ordering. If the bio.tools homepage is equal to the repository HTML URL, no suggestion is made. If GitHub already has a different homepage configured, that value is treated as authoritative and a conflict is logged while still proposing an issue. When the bio.tools homepage is present, differs from the HTML URL, and the GitHub homepage is unset does this function propose an issue.

Parameters:
  • gh_schema (dict[AnyUrl | str | None]) – A dictionary containing existing GitHub repository data. Expected keys: - “homepage”: the configured GitHub homepage URL, or None/empty if unset. - “html_url”: the canonical GitHub repository URL.

  • bt_homepage (UrlftpType | None) – The homepage URL defined in the bio.tools metadata, or None if no homepage is provided.

Returns:

A mapping with the issue title as key and the issue body as value, or None if no issue is to be created.

Return type:

dict[str, str] | None

async bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_license(gh_license, bt_license)[source]#

Propose a GitHub pull request to add a LICENSE file based on bio.tools license metadata, using the generic bio.tools-over-GitHub policy.

The GitHub license (when present) is normalized via its SPDX identifier and compared against the bio.tools license enum. If bio.tools provides a license, the full canonical license text is fetched from the SPDX service and proposed as a new LICENSE.txt file. If GitHub already declares a different license, that value is treated as authoritative, a conflict is logged, but the pull request is still proposed.

Parameters:
  • gh_license (GHLicense | None) – License metadata detected on the GitHub repository, or None if no license is declared.

  • bt_license (BTLicense | None) – License value from the bio.tools entry, represented as a bio.tools license enum, or None if not available.

Returns:

A dictionary with the filename LICENSE.txt as key and the full license text as value, or None if no pull request should be created under the policy.

Return type:

dict[str, str] | None

async bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_name(gh_name, bt_params)[source]#

Propose a GitHub issue to update the GitHub repository name based on bio.tools name and ID metadata, using the generic bio.tools-over-GitHub issue policy.

Parameters:
  • gh_name (str | None) – GitHub repository name.

  • bt_params (dict[str, str | None] | None) – A dictionary containing existing bio.tools metadata parameters. Expected keys: - "name" : bio.tools name - "biotoolsID" : bio.tools ID

Returns:

A mapping with the issue title as key and the issue body as value, or None if no issue is to be created.

Return type:

dict[str, str] | None

bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_readme(gh_readme, bt_params)[source]#

Map bio.tools metadata onto a GitHub README and return updated content.

Steps performed: 1. Validates and interprets the required fields are present in bt_params. 2. Calls _build_readme to construct a new README that includes:

  • an existing title (if any), or a new one based on bt_params[‘name’],

  • merged badges (new bridge/bio.tools/tool type + existing badges),

  • the remaining original README content.

  1. Returns the updated README under the key “README.md”.

Parameters:
  • gh_readme (str | None) – The current README content from GitHub, or None if the file does not exist yet.

  • bt_params (dict[str, Any]) – The bio.tools tool metadata as a dictionary. Expected fields: - ‘name’ : Name of the tool. - ‘biotoolsID’ : bio.tools identifier of the tool. - ‘toolType’ : Optional list of tool types (typically ToolTypeEnum).

Returns:

A dictionary with the filename “README.md” as key, and the updated README content as value.

Return type:

dict[str, str]

Raises:

ValueError – If required fields are missing from bt_params.

bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_topics(gh_topics, bt_edam)[source]#

Propose a GitHub issue to add missing EDAM-based topics from bio.tools.

This function inspects EDAM annotations from bio.tools (both high-level topics and function-level operation/input/output terms), normalizes them to GitHub-topic-style slugs, and compares them against the normalized set of existing GitHub topics. It then applies the generic bio.tools-on-top-of-GitHub additive policy to decide whether an issue should be proposed and which EDAM terms to include.

Parameters:
  • gh_topics (list[str] | None) – Current list of GitHub topics for the repository, or None if no topics are set.

  • bt_edam (dict[str, Any] | None) – EDAM-related metadata from bio.tools. Expected keys include: - “topics” : list[TopicItem] - “functions” : list[FunctionItem]

Returns:

A mapping with the issue title as key and the issue body as value, or None if no issue is needed under the policy.

Return type:

dict[str, str] | None

bridge.pipelines.bt2gh_for_pr_issues.map_funcs.map_version(gh_latest_version_tag, bt_versions)[source]#

Propose a GitHub issue to make a GitHub release based on bio.tools version metadata, if needed.

The function checks whether the latest bio.tools version is newer than the latest GitHub release tag. If so, it proposes an issue to create a corresponding GitHub release. If GitHub has no latest release tag while bio.tools has versions defined, it also proposes an issue. If no action is needed, it returns None.

Parameters:
  • gh_latest_version_tag (str | None) – Latest GitHub release tag, or None if unavailable.

  • bt_versions (list[VersionType] | None) – Existing bio.tools versions.

Returns:

A mapping with the issue title as key and the issue body as value, or None if no issue is to be created.

Return type:

dict[str, str] | None

Submodules#

citation

Generate a CITATION.cff file from bio.tools publication metadata.

description

Map description metadata from bio.tools to GitHub.

homepage

Map homepage URL from bio.tools to a GitHub.

license

Map license metadata from bio.tools to GitHub.

name

Map repository name from bio.tools to GitHub.

readme

Map bio.tools metadata onto a GitHub README and inject badges.

topics

Functions for mapping bio.tools EDAM annotations to GitHub topics.

version

Mapping versions from bio.tools to GitHub.

Dependencies diagram#

Each architecture diagram below visualizes the internal dependency structure of the bridge.pipelines.bt2gh_for_pr_issues.map_funcs 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