seqme.models.ThirdPartyModel#

class seqme.models.ThirdPartyModel(entry_point, path, url=None, branch=None, shallow=True, extras=None, uv=None, git=None)[source]#

Wrapper for loading and calling a third-party plugin model.

Clones a Git repository into a local directory (if not already present) and invokes a specified function from that repository in an isolated uv environment.

uv is used over conda because it provides precise lockfile-based reproducibility, strict package version pinning, and per-project Python version isolation — ensuring the plugin runs in exactly the environment its author intended.

Officially supported models can be found here: szczurek-lab/seqme-thirdparty

Note

uv and git may not be on the PATH of a Jupyter kernel. In that case, pass their absolute paths via the uv and git parameters.

Examples

>>> import seqme as sm
>>> hello_model = sm.models.ThirdPartyModel(
...     entry_point="hello_model.model:embed",
...     path="./thirdparty/hello-model",
...     url="https://github.com/szczurek-lab/seqme-thirdparty",
...     branch="main",
... )
>>> hello_model(["MKQW", "RKSPL"], batch_size=32)
array([[44.,  8., 12., 32.],
       [55., 10., 15., 40.]])
__init__(entry_point, path, url=None, branch=None, shallow=True, extras=None, uv=None, git=None)[source]#

Initialize the third-party model.

Parameters:
  • entry_point (str) – Module and function to call, in the form ‘module.path:function’.

  • path (str | Path) – Path to the plugin repository. Cloned here if it does not exist and url is provided.

  • url (Optional[str]) – Git repository URL to clone (optionally prefixed with ‘git+’). If None, path must already exist.

  • branch (Optional[str]) – Branch to clone. If None, clones the default branch.

  • shallow (bool) – If True, clones only the latest commit (no full history). Defaults to True.

  • extras (Optional[list[str]]) – Optional dependency groups from the project to install, e.g. ['cpu', 'cuda']. Each entry is passed to uv sync via --extra.

  • uv (Union[str, Path, None]) – Path to the uv executable. If None, ‘uv’ is looked up on PATH.

  • git (Union[str, Path, None]) – Path to the git executable. If None, ‘git’ is looked up on PATH.

Raises:
  • ValueError – If entry_point is not of the form ‘module:function’.

  • FileNotFoundError – If path does not exist and no url is provided.

__call__(*args, **kwargs)[source]#

Execute the plugin’s function with the given arguments.

Parameters:
  • *args – Positional arguments passed to the plugin function.

  • **kwargs – Keyword arguments passed to the plugin function.

Return type:

Any

Returns:

The return value of the plugin function.

Methods

__init__(entry_point, path[, url, branch, ...])

Initialize the third-party model.

__call__(*args, **kwargs)

Execute the plugin's function with the given arguments.