From b18dbf4772a1502eef442f86d0dc998dac9fd6e5 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 16 Jul 2024 10:58:49 +0100 Subject: [PATCH] renamed hf-embed -> help --- aider/help.py | 4 +-- docker/Dockerfile | 2 +- pytest.ini | 1 + ...ments-hf-embed.in => requirements-help.in} | 0 ...nts-hf-embed.txt => requirements-help.txt} | 6 ++-- scripts/pip-compile.sh | 2 +- setup.py | 2 +- tests/browser/test_browser.py | 28 +++++++++---------- 8 files changed, 23 insertions(+), 22 deletions(-) rename requirements/{requirements-hf-embed.in => requirements-help.in} (100%) rename requirements/{requirements-hf-embed.txt => requirements-help.txt} (96%) diff --git a/aider/help.py b/aider/help.py index 24c549099..c7c8f7f48 100755 --- a/aider/help.py +++ b/aider/help.py @@ -15,14 +15,14 @@ warnings.simplefilter("ignore", category=FutureWarning) def install_help_extra(io): pip_install_cmd = [ - "aider-chat[hf-embed]", + "aider-chat[help]", "--extra-index-url", "https://download.pytorch.org/whl/cpu", ] res = utils.check_pip_install_extra( io, "llama_index.embeddings.huggingface", - "To use interactive /help you need to install HuggingFace embeddings", + "To use interactive /help you need to install the help extras", pip_install_cmd, ) return res diff --git a/docker/Dockerfile b/docker/Dockerfile index c4b557426..72c4f8006 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -9,7 +9,7 @@ COPY . /aider RUN apt-get update && \ apt-get install --no-install-recommends -y build-essential git libportaudio2 && \ rm -rf /var/lib/apt/lists/* && \ - pip install --no-cache-dir /aider[hf-embed] --extra-index-url https://download.pytorch.org/whl/cpu && \ + pip install --no-cache-dir /aider --extra-index-url https://download.pytorch.org/whl/cpu && \ rm -rf /aider WORKDIR /app diff --git a/pytest.ini b/pytest.ini index fc6f43f51..0fb394382 100644 --- a/pytest.ini +++ b/pytest.ini @@ -4,5 +4,6 @@ addopts = -p no:warnings testpaths = tests/basic tests/help + tests/browser diff --git a/requirements/requirements-hf-embed.in b/requirements/requirements-help.in similarity index 100% rename from requirements/requirements-hf-embed.in rename to requirements/requirements-help.in diff --git a/requirements/requirements-hf-embed.txt b/requirements/requirements-help.txt similarity index 96% rename from requirements/requirements-hf-embed.txt rename to requirements/requirements-help.txt index 1063714d0..9d3bb5437 100644 --- a/requirements/requirements-hf-embed.txt +++ b/requirements/requirements-help.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.12 # by the following command: # -# pip-compile --output-file=requirements/requirements-hf-embed.txt requirements/requirements-hf-embed.in +# pip-compile --output-file=requirements/requirements-help.txt requirements/requirements-help.in # aiohttp==3.9.5 # via @@ -109,10 +109,10 @@ llama-cloud==0.0.6 # via llama-index-core llama-index-core==0.10.52.post2 # via - # -r requirements/requirements-hf-embed.in + # -r requirements/requirements-help.in # llama-index-embeddings-huggingface llama-index-embeddings-huggingface==0.2.2 - # via -r requirements/requirements-hf-embed.in + # via -r requirements/requirements-help.in markupsafe==2.1.5 # via # -c requirements/../requirements.txt diff --git a/scripts/pip-compile.sh b/scripts/pip-compile.sh index 7efa35f95..0f0ae77b9 100755 --- a/scripts/pip-compile.sh +++ b/scripts/pip-compile.sh @@ -8,7 +8,7 @@ pip-compile \ --output-file=requirements.txt \ $1 -for SUFFIX in dev hf-embed browser playwright; do +for SUFFIX in dev help browser playwright; do pip-compile \ requirements/requirements-${SUFFIX}.in \ diff --git a/setup.py b/setup.py index 80a8c6c22..10a0b8c76 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ packages += ["aider.website"] print("Packages:", packages) -extras = "dev hf-embed browser playwright".split() +extras = "dev help browser playwright".split() setup( name="aider-chat", diff --git a/tests/browser/test_browser.py b/tests/browser/test_browser.py index 3bfda0454..35b1ea034 100644 --- a/tests/browser/test_browser.py +++ b/tests/browser/test_browser.py @@ -1,31 +1,31 @@ import unittest from unittest.mock import patch -import sys -import os - -# Add the parent directory to the Python path -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))) from aider.main import main + class TestBrowser(unittest.TestCase): - @patch('aider.main.launch_gui') + @patch("aider.main.launch_gui") def test_browser_flag_imports_streamlit(self, mock_launch_gui): # Run main with --browser and --yes flags - main(['--browser', '--yes']) - + main(["--browser", "--yes"]) + # Check that launch_gui was called mock_launch_gui.assert_called_once() - + # Try to import streamlit try: - import streamlit + import streamlit # noqa: F401 + streamlit_imported = True except ImportError: streamlit_imported = False - - # Assert that streamlit was successfully imported - self.assertTrue(streamlit_imported, "Streamlit should be importable after running with --browser flag") -if __name__ == '__main__': + # Assert that streamlit was successfully imported + self.assertTrue( + streamlit_imported, "Streamlit should be importable after running with --browser flag" + ) + + +if __name__ == "__main__": unittest.main()