diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3b40c28..ef8a2d9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -20,8 +20,9 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -e . pip install pytest + woodwork init --all - name: Run tests - run: pytest test/ + run: pytest -s tests/ diff --git a/README.md b/README.md index 9b4b49e..4eebbef 100644 --- a/README.md +++ b/README.md @@ -24,4 +24,4 @@ With 3. and 4. traditionally being merged. These components often have reinforce ### Agent Memory This is typically referred to as the Knowledge Base (KB), used primarily in Retrieval Augmented Generation (RAG). This essentially allows us to use similar or relevant information to pass as to another part of the AI Agent workflow. -Typically, the problem with AI Agent performance is related to its context, assuming that modern LLMs are able to reason relatively well given the correct information. \ No newline at end of file +Typically, the problem with AI Agent performance is related to its context, assuming that modern LLMs are able to reason relatively well given the correct information. Design of this system should accomodate future developments. \ No newline at end of file diff --git a/tests/input_interface_test.py b/tests/input_interface_test.py index 225a963..d5b5b7f 100644 --- a/tests/input_interface_test.py +++ b/tests/input_interface_test.py @@ -11,6 +11,7 @@ def get_all_subclasses(cls): return subclasses input_implementors = get_all_subclasses(input_interface) +print("Collected subclasses of input_interface:", input_implementors) @pytest.mark.parametrize("input_implementor", input_implementors) def test_input_returns(input_implementor): diff --git a/woodwork/__main__.py b/woodwork/__main__.py index 0156b05..e9f6c2d 100644 --- a/woodwork/__main__.py +++ b/woodwork/__main__.py @@ -1,4 +1,4 @@ -from woodwork.dependencies import init, activate_virtual_environment +from woodwork.dependencies import init, activate_virtual_environment, install_all from woodwork.helper_functions import set_globals import sys @@ -25,4 +25,6 @@ def main(): init() else: if sys.argv[2] == "--isolated": - init({"isolated": True}) \ No newline at end of file + init({"isolated": True}) + if sys.argv[2] == "--all": + install_all() \ No newline at end of file diff --git a/woodwork/dependencies.py b/woodwork/dependencies.py index 323098b..807c069 100644 --- a/woodwork/dependencies.py +++ b/woodwork/dependencies.py @@ -128,4 +128,53 @@ def init(options={"isolated": False}): os.remove(temp_requirements_file) + print("Initialization complete.") + +def get_subdirectories(path: str) -> list[str]: + entries = os.listdir(path) + + # Filter the entries to include only directories + return [entry for entry in entries if os.path.isdir(os.path.join(path, entry))] + +def install_all(): + print("Installing all dependencies...") + + # Access the requirements directory as a package resource + requirements_dir = pkg_resources.files('woodwork')/'requirements' + + components = get_subdirectories(requirements_dir) + requirements_set = set() + + for component in components: + component_requirements = os.path.join(requirements_dir, component, f"{component}.txt") + try: + parse_requirements(requirements_set, component_requirements) + except subprocess.CalledProcessError: + sys.exit(1) + + # Install the component type dependencies + type_requirements = os.path.join(requirements_dir, component, f"{type}.txt") + try: + parse_requirements(requirements_set, type_requirements) + except subprocess.CalledProcessError: + sys.exit(1) + + # Write combined unique requirements to a temporary file + os.makedirs(".woodwork", exist_ok=True) + temp_requirements_file = '.woodwork/requirements.txt' + with open(temp_requirements_file, 'w') as f: + for requirement in sorted(requirements_set): + f.write(f"{requirement}\n") + + try: + subprocess.check_call([f"pip install -r {temp_requirements_file}"], shell=True) + print(f"Installed all combined dependencies.") + except subprocess.CalledProcessError: + sys.exit(1) + finally: + # Clean up temporary requirements file + if os.path.exists(temp_requirements_file): + os.remove(temp_requirements_file) + + print("Initialization complete.") \ No newline at end of file