This document specifies the Application Programming Interface (API) for the environment_setup module. The API consists of Python functions that can be imported and used by other modules or scripts within the Codomyrmex project to verify and guide the setup of the development environment.
These functions are primarily sourced from the env_checker.py script.
- Source:
environment_setup.env_checker.ensure_dependencies_installed - Description: Checks if essential Python dependencies for the Codomyrmex project (e.g.,
cased,dotenv) are installed by attempting to import them. If a dependency is missing, it prints an instructional message tostderrand callssys.exit(1). - Method: N/A (Python function)
- Path: N/A (Importable function)
- Parameters/Arguments: None.
- Request Body: N/A
- Returns/Response: None.
- Side Effects: Prints messages to
stderrand may terminate the calling script viasys.exit(1)if essential dependencies are missing.
- Side Effects: Prints messages to
- Events Emitted: N/A
- Source:
environment_setup.env_checker.check_and_setup_env_vars - Description: Checks for the existence of a
.envfile at the specifiedrepo_root_path.- If it exists, it informs the user.
- If it does not exist, it prints detailed instructions for creating a
.envfile with API key configuration examples for OpenAI, Anthropic, and Google AI providers, then exits with status code 1 to indicate the environment is not fully configured. - It attempts to load the
.envfile usingdotenv.load_dotenv()if the file exists.
- Method: N/A (Python function)
- Path: N/A (Importable function)
- Parameters/Arguments:
repo_root_path(str): The absolute path to the root of the Codomyrmex repository where the.envfile is expected.
- Request Body: N/A
- Returns/Response: None.
- Side Effects: Prints messages to
stdoutorstderr. May callsys.exit(1)if the.envfile is missing after guidance. Attempts to load environment variables from the.envfile into the current process's environment.
- Side Effects: Prints messages to
- Events Emitted: N/A
- Source:
environment_setup.env_checker.validate_python_version - Description: Validates that the current Python version meets the specified version requirements using semantic versioning comparison.
- Method: N/A (Python function)
- Path: N/A (Importable function)
- Parameters/Arguments:
required(str, optional): Version requirement string using PEP 440 specifiers (default: ">=3.10")
- Request Body: N/A
- Returns/Response:
boolTrueif current Python version meets requirementsFalseif version requirements are not met or validation fails
- Events Emitted: N/A
- Source:
environment_setup.env_checker.validate_environment_completeness - Description: Performs comprehensive validation of the development environment, checking Python version, dependencies, environment variables, and configuration. This is the primary validation function to call before running Codomyrmex operations.
- Method: N/A (Python function)
- Path: N/A (Importable function:
from codomyrmex.environment_setup.env_checker import validate_environment_completeness) - Parameters/Arguments:
repo_root(str | None, optional): The root directory of the repository. If not provided, defaults to the parent directory of the codomyrmex package.
- Request Body: N/A
- Returns/Response:
boolTrueif all environment checks pass (dependencies installed, .env file loaded, Python version valid)Falseotherwise
- Events Emitted: N/A
- Note: This function is not re-exported from
__init__.py; import it directly fromenv_checker.
- Source:
environment_setup.env_checker.generate_environment_report - Description: Generates an environment status report. Currently a placeholder that returns a static string; future implementation will return a detailed report.
- Method: N/A (Python function)
- Path: N/A (Importable function:
from codomyrmex.environment_setup.env_checker import generate_environment_report) - Parameters/Arguments: None
- Request Body: N/A
- Returns/Response:
str- Currently returns a placeholder string. Will return a full report once implemented.
- Events Emitted: N/A
- Note: This function is not re-exported from
__init__.py; import it directly fromenv_checker.
N/A for these functions.
N/A. These are local utility functions.
N/A.
These functions will be versioned as part of the environment_setup module, following the overall project's semantic versioning. Changes to function signatures or core behavior will be noted in the module's CHANGELOG.md.
- Parent: Project Overview
- Module Index: All Agents
- Documentation: Reference Guides
- Home: Root README