wads.setup_utils¶
Utilities for setting up packages based on pyproject.toml configuration.
This module provides tools for users to:
Install Python dependencies with various options
Install system dependencies based on OS and toml specs
Validate environment variables
Diagnose missing dependencies and provide instructions
Functions
|
Check required environment variables from pyproject.toml. |
|
Check if a system dependency is installed using check commands. |
|
Diagnose missing dependencies and configuration issues. |
Get current platform identifier (linux, macos, windows). |
|
Get set of installed pip package names. |
|
|
Install Python dependencies from pyproject.toml. |
|
Install system dependencies based on pyproject.toml configuration. |
|
Check if a Python package can be imported. |
|
Print a formatted diagnostic report. |
Classes
|
Result of dependency diagnostics. |
|
Result of an installation attempt. |
- class wads.setup_utils.DiagnosticResult(missing_python_deps, missing_system_deps, missing_env_vars, warnings, recommendations)[source]¶
Bases:
objectResult of dependency diagnostics.
- class wads.setup_utils.InstallResult(success, package_name, message, command_executed=None)[source]¶
Bases:
objectResult of an installation attempt.
- wads.setup_utils.check_environment_variables(pyproject_path, verbose=True)[source]¶
Check required environment variables from pyproject.toml.
- wads.setup_utils.check_system_dependency(dep_name, dep_ops, platform, verbose=True)[source]¶
Check if a system dependency is installed using check commands.
- Parameters:
- Return type:
- Returns:
True if dependency is installed (or no check command available)
- wads.setup_utils.diagnose_setup(pyproject_path, check_python=True, check_system=True, check_env=True, platform=None)[source]¶
Diagnose missing dependencies and configuration issues.
- Parameters:
- Return type:
- Returns:
DiagnosticResult with comprehensive analysis
- wads.setup_utils.get_current_platform()[source]¶
Get current platform identifier (linux, macos, windows).
- Return type:
- Returns:
Platform string compatible with wads configuration
- wads.setup_utils.install_python_dependencies(pyproject_path, exclude=None, check_importable=True, upgrade=False, allow_downgrade=False, extras=None, dry_run=False, verbose=True)[source]¶
Install Python dependencies from pyproject.toml.
- Parameters:
pyproject_path (
str|Path) – Path to pyproject.toml or directory containing itexclude (
Optional[List[str]]) – List of package names to exclude from installationcheck_importable (
bool) – Only install if package is not already importableupgrade (
bool) – Pass –upgrade flag to pipallow_downgrade (
bool) – Allow pip to downgrade packages (adds –force-reinstall)extras (
Optional[List[str]]) – List of extras to install (e.g., [‘dev’, ‘test’])dry_run (
bool) – If True, only show what would be installedverbose (
bool) – Print detailed progress information
- Return type:
- Returns:
List of InstallResult objects
- wads.setup_utils.install_system_dependencies(pyproject_path, platform=None, check_first=True, dry_run=False, verbose=True, interactive=True)[source]¶
Install system dependencies based on pyproject.toml configuration.
This is a wrapper around wads.install_system_deps module.
- Parameters:
pyproject_path (
str|Path) – Path to pyproject.toml or directory containing itplatform (
Optional[str]) – Platform identifier (auto-detected if None)check_first (
bool) – Use check commands to verify if already installed (ignored in dry_run)dry_run (
bool) – If True, only show what would be installedverbose (
bool) – Print detailed progress informationinteractive (
bool) – Ask for confirmation before installing (not yet implemented)
- Return type:
- Returns:
List of InstallResult objects
- wads.setup_utils.is_package_importable(package_name)[source]¶
Check if a Python package can be imported.
- wads.setup_utils.print_diagnostic_report(result)[source]¶
Print a formatted diagnostic report.
- Parameters:
result (
DiagnosticResult) – DiagnosticResult to display