barrel_rerank_venv (barrel_rerank v1.0.0)
View SourceManaged Python virtual environment for barrel_rerank
Creates and manages a Python venv with all dependencies required for the rerank server (transformers, torch, uvloop).
Usage
%% Ensure venv exists and has dependencies
{ok, VenvPath} = barrel_rerank_venv:ensure_venv().
%% Check if venv is valid
true = barrel_rerank_venv:is_valid().
%% Check for uvloop support
true = barrel_rerank_venv:has_uvloop().
%% Force refresh (reinstall deps)
ok = barrel_rerank_venv:refresh().Configuration
The venv path can be configured via application env:
{barrel_rerank, [{venv_path, "/custom/path/.venv"}]}Default path is "priv/.venv" relative to the application.
Summary
Functions
Create a new Python venv.
Ensure venv exists with all dependencies. Creates venv and installs deps if needed.
Check if uvloop is installed.
Install all required dependencies.
Check if the venv is valid (exists with Python).
Force refresh - reinstall all dependencies.
Get the venv path (configured or default).
Functions
-spec create_venv() -> ok | {error, term()}.
Create a new Python venv.
Ensure venv exists with all dependencies. Creates venv and installs deps if needed.
-spec has_uvloop() -> boolean().
Check if uvloop is installed.
-spec install_deps() -> ok | {error, term()}.
Install all required dependencies.
-spec is_valid() -> boolean().
Check if the venv is valid (exists with Python).
-spec refresh() -> ok | {error, term()}.
Force refresh - reinstall all dependencies.
-spec venv_path() -> string().
Get the venv path (configured or default).