Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

testing testing #57

Merged
merged 11 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
1 change: 1 addition & 0 deletions tests/input_interface_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 4 additions & 2 deletions woodwork/__main__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -25,4 +25,6 @@ def main():
init()
else:
if sys.argv[2] == "--isolated":
init({"isolated": True})
init({"isolated": True})
if sys.argv[2] == "--all":
install_all()
49 changes: 49 additions & 0 deletions woodwork/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Loading