vipr package

Subpackages

Submodules

vipr.main module

class vipr.main.VIPR(*args, celery_task_ref=None, **kwargs)

Bases: App

VIPR primary application.

class Meta

Bases: object

PLUGIN_CONFIG_PATH = '/home/sc/Developer/vipr/vipr-core/vipr/config/plugins.yaml'
cache_handler = 'in_memory_cache'
config_file_suffix = '.yml'
config_files = ['/home/sc/Developer/vipr/vipr-core/vipr/config/plugins.yaml']
config_handler = 'yaml'
exit_on_close = False
extensions = ['yaml', 'logging', 'jinja2', 'vipr.ext.strict_registration', 'vipr.ext.dynamic_hooks_filters']
handlers = [<class 'vipr.controllers.base.Base'>, <class 'vipr.controllers.tools.Tools'>, <class 'vipr.controllers.plugins.PluginController'>, <class 'vipr.handlers.in_memory_cache.InMemoryCacheHandler'>]
label = 'vipr'
log_handler = 'vipr_logging'
output_handler = 'jinja2'
plugin_handler = 'vipr_plugin'
plugins = []
template_handler = 'jinja2'
filter: FilterManager
setup()

Override setup to load external plugins via entry points after internal plugins.

This ensures that: 1. Cement’s plugin system loads internal plugins first 2. Entry point discovery finds and loads external plugins 3. All plugins are available before the app runs

class vipr.main.VIPRTest(*args, celery_task_ref=None, **kwargs)

Bases: TestApp, VIPR

A sub-class of VIPR that is better suited for testing.

class Meta

Bases: object

label = 'vipr'
vipr.main.main()

vipr.vipr_paths module

vipr.vipr_paths.resolve_file_path(data_path: str, base_dir: Path | None = None) Path | None

Central file path resolution for VIPR framework.

Supports multiple path formats: - Absolute paths: /tmp/file.txt - External plugin resources (MUST use @ prefix): @vipr_reflectometry/exp_data/data.txt - Internal VIPR package paths: plugins/normalizers/data.txt - Paths relative to an optional base directory

Resolution order: 1. Absolute paths → return if exists 2. Package resources (external plugins with @ prefix) → importlib.resources 3. Explicit internal VIPR paths → vipr/plugins/… 4. Base directory relative → base_dir / data_path

Parameters:
  • data_path – Path string in any supported format

  • base_dir – Optional directory used to resolve local relative paths

Returns:

Resolved Path object if file exists, None otherwise

Examples

resolve_file_path(“/tmp/data.txt”) # Absolute path resolve_file_path(“@vipr_reflectometry/exp_data/data.txt”) # External plugin (@ required) resolve_file_path(“plugins/normalizers/data.txt”) # Internal plugin resolve_file_path(“my-data/data.txt”, base_dir=Path.cwd()) # Config-relative/local file

vipr.vipr_paths.setup_default_env_vars(working_dir: Path | None = None) None

Set default environment variables if not already set. Uses current working directory as base for storage paths.

This allows users to run VIPR without manually setting environment variables. If variables are already set, they will not be overridden.

Parameters:

working_dir – Base directory for default paths. Defaults to current working directory.

vipr.vipr_runner module

class vipr.vipr_runner.ViprRunner

Bases: object

Runs individual CLI controller commands on a new VIPR instance and encapsulates argv construction plus setup/teardown in context manager.

run_controller(command: str, subcommand: str, config_path: str | None = None, extra_args: list[str] | None = None, post_args: list[str] | None = None, celery_task_ref: object | None = None, catch_signals: bool = True)
Parameters:
  • command – e.g. ‘registry’ or ‘reflectometry’

  • subcommand – e.g. ‘filters’ or ‘predict’

  • config_path – Path to YAML config, will be set as “–config”

  • extra_args – List of flags/args that are inserted _before_ command/subcommand

  • post_args – List of flags/args that are appended _after_ command/subcommand

  • celery_task_ref – Celery task instance for progress updates (not serialized to config)

  • catch_signals – Whether Cement should install its own signal handlers. Set to False when running inside an async event loop (e.g., FastAPI/uvicorn) to avoid conflicts with uvloop.

Returns:

The return value of app.run()

Module contents

VIPR Core package initialization.

This module initializes the VIPR package and activates type checking across the entire package.