git: 96919cce2620 - main - misc/py-aider-chat: update to 0.55.0
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Sep 2024 05:54:59 UTC
The branch main has been updated by dch:
URL: https://cgit.FreeBSD.org/ports/commit/?id=96919cce2620f92d943fcad10180d006c3e8bfd5
commit 96919cce2620f92d943fcad10180d006c3e8bfd5
Author: Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2024-09-11 05:53:32 +0000
Commit: Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2024-09-11 05:54:25 +0000
misc/py-aider-chat: update to 0.55.0
Sponsored by: Skunkwerks, GmbH
---
misc/py-aider-chat/Makefile | 11 ++-
misc/py-aider-chat/distinfo | 6 +-
misc/py-aider-chat/files/patch-aider_commands.py | 25 +++++++
misc/py-aider-chat/files/patch-aider_scrape.py | 91 ++++++++++++++++++++----
misc/py-aider-chat/files/patch-pyproject.toml | 11 +++
misc/py-aider-chat/files/patch-setup.py | 11 ---
6 files changed, 126 insertions(+), 29 deletions(-)
diff --git a/misc/py-aider-chat/Makefile b/misc/py-aider-chat/Makefile
index bdc939f240d8..94871a2e9859 100644
--- a/misc/py-aider-chat/Makefile
+++ b/misc/py-aider-chat/Makefile
@@ -1,5 +1,5 @@
PORTNAME= aider_chat
-DISTVERSION= 0.45.0
+DISTVERSION= 0.55.0
CATEGORIES= misc python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@@ -12,7 +12,9 @@ WWW= https://aider.chat/
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE.txt
-BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR}
+BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools-scm>0:devel/py-setuptools-scm@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}arrow>0:devel/py-arrow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}backoff>0:devel/py-backoff@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}beautifulsoup>=0:www/py-beautifulsoup@${PY_FLAVOR} \
@@ -26,6 +28,7 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}arrow>0:devel/py-arrow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}greenlet>=0:devel/py-greenlet@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}grep-ast>0:textproc/py-grep-ast@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}huggingface-hub>0:misc/py-huggingface-hub@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}json5>0:devel/py-json5@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}jsonschema>=0:devel/py-jsonschema@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}litellm>=1.24.5:misc/py-litellm@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}networkx>0:math/py-networkx@${PY_FLAVOR} \
@@ -33,9 +36,11 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}arrow>0:devel/py-arrow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}openai>=1.0.0:misc/py-openai@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}packaging>=0:devel/py-packaging@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pathspec>0:devel/py-pathspec@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pexpect>=4.9.0:misc/py-pexpect@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pillow>0:graphics/py-pillow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}prompt-toolkit>0:devel/py-prompt-toolkit@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pypandoc>=0:textproc/py-pypandoc@${PY_FLAVOR} \
+ ${PYTHON_PKGNAMEPREFIX}pyperclip>=1.7.0:devel/py-pyperclip@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pyyaml-include>=1.2:devel/py-pyyaml-include@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}rich>0:textproc/py-rich@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}scipy>0:science/py-scipy@${PY_FLAVOR} \
@@ -50,7 +55,7 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}arrow>0:devel/py-arrow@${PY_FLAVOR} \
# google-generativeai is not a popular aider dependency
USES= python shebangfix
-USE_PYTHON= autoplist concurrent distutils
+USE_PYTHON= autoplist concurrent pep517
NO_ARCH= yes
diff --git a/misc/py-aider-chat/distinfo b/misc/py-aider-chat/distinfo
index e764ae7be70f..212de797711d 100644
--- a/misc/py-aider-chat/distinfo
+++ b/misc/py-aider-chat/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1722097913
-SHA256 (aider_chat-0.45.0.tar.gz) = 47afeb18a342dd5d33aa1b034ca04120b7a599f55c127365297bc097ee565b6b
-SIZE (aider_chat-0.45.0.tar.gz) = 135453
+TIMESTAMP = 1725874773
+SHA256 (aider_chat-0.55.0.tar.gz) = 926aee4a58db65be3aef90871ef8154aa7279e404cf6f87ab74d3f3cc7380703
+SIZE (aider_chat-0.55.0.tar.gz) = 38770341
diff --git a/misc/py-aider-chat/files/patch-aider_commands.py b/misc/py-aider-chat/files/patch-aider_commands.py
new file mode 100644
index 000000000000..e10a23a450fe
--- /dev/null
+++ b/misc/py-aider-chat/files/patch-aider_commands.py
@@ -0,0 +1,25 @@
+--- aider/commands.py.orig 2024-09-09 10:14:11 UTC
++++ aider/commands.py
+@@ -15,7 +15,7 @@ from aider.run_cmd import run_cmd
+ from aider.llm import litellm
+ from aider.repo import ANY_GIT_ERROR
+ from aider.run_cmd import run_cmd
+-from aider.scrape import Scraper, install_playwright
++from aider.scrape import Scraper
+ from aider.utils import is_image_file
+
+ from .dump import dump # noqa: F401
+@@ -145,12 +145,8 @@ class Commands:
+
+ self.io.tool_output(f"Scraping {url}...")
+ if not self.scraper:
+- res = install_playwright(self.io)
+- if not res:
+- self.io.tool_warning("Unable to initialize playwright.")
+-
+ self.scraper = Scraper(
+- print_error=self.io.tool_error, playwright_available=res, verify_ssl=self.verify_ssl
++ print_error=self.io.tool_error, playwright_available=False, verify_ssl=self.verify_ssl
+ )
+
+ content = self.scraper.scrape(url) or ""
diff --git a/misc/py-aider-chat/files/patch-aider_scrape.py b/misc/py-aider-chat/files/patch-aider_scrape.py
index f590cbbf2c49..969ff29d15f8 100644
--- a/misc/py-aider-chat/files/patch-aider_scrape.py
+++ b/misc/py-aider-chat/files/patch-aider_scrape.py
@@ -1,17 +1,17 @@
---- aider/scrape.py.orig 2024-07-27 19:09:04 UTC
+--- aider/scrape.py.orig 2024-09-09 10:28:04 UTC
+++ aider/scrape.py
-@@ -15,56 +15,9 @@ def install_playwright(io):
+@@ -15,57 +15,8 @@ def install_playwright(io):
def install_playwright(io):
- try:
- from playwright.sync_api import sync_playwright
-+ return
++ return False
- has_pip = True
- except ImportError:
- has_pip = False
-
+-
- try:
- with sync_playwright() as p:
- p.chromium.launch()
@@ -23,7 +23,8 @@
- return True
-
- pip_cmd = utils.get_pip_install(["aider-chat[playwright]"])
-- chromium_cmd = "playwright install --with-deps chromium".split()
+- chromium_cmd = "-m playwright install --with-deps chromium"
+- chromium_cmd = [sys.executable] + chromium_cmd.split()
-
- cmds = ""
- if not has_pip:
@@ -37,7 +38,7 @@
-See {urls.enable_playwright} for more info.
-"""
-
-- io.tool_error(text)
+- io.tool_output(text)
- if not io.confirm_ask("Install playwright?", default="y"):
- return
-
@@ -58,15 +59,81 @@
class Scraper:
pandoc_available = None
playwright_available = None
-@@ -89,10 +42,7 @@ class Scraper:
- `url` - the URLto scrape.
+@@ -82,7 +33,7 @@ class Scraper:
+ else:
+ self.print_error = print
+
+- self.playwright_available = playwright_available
++ self.playwright_available = False
+ self.verify_ssl = verify_ssl
+
+ def scrape(self, url):
+@@ -93,10 +44,7 @@ class Scraper:
+ `url` - the URL to scrape.
"""
- if self.playwright_available:
-- content = self.scrape_with_playwright(url)
+- content, mime_type = self.scrape_with_playwright(url)
- else:
-- content = self.scrape_with_httpx(url)
-+ content = self.scrape_with_httpx(url)
+- content, mime_type = self.scrape_with_httpx(url)
++ content, mime_type = self.scrape_with_httpx(url)
if not content:
- return
+ self.print_error(f"Failed to retrieve content from {url}")
+@@ -130,56 +78,6 @@ class Scraper:
+ return False
+
+ # Internals...
+- def scrape_with_playwright(self, url):
+- import playwright # noqa: F401
+- from playwright.sync_api import Error as PlaywrightError
+- from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
+- from playwright.sync_api import sync_playwright
+-
+- with sync_playwright() as p:
+- try:
+- browser = p.chromium.launch()
+- except Exception as e:
+- self.playwright_available = False
+- self.print_error(str(e))
+- return None, None
+-
+- try:
+- context = browser.new_context(ignore_https_errors=not self.verify_ssl)
+- page = context.new_page()
+-
+- user_agent = page.evaluate("navigator.userAgent")
+- user_agent = user_agent.replace("Headless", "")
+- user_agent = user_agent.replace("headless", "")
+- user_agent += " " + aider_user_agent
+-
+- page.set_extra_http_headers({"User-Agent": user_agent})
+-
+- response = None
+- try:
+- response = page.goto(url, wait_until="networkidle", timeout=5000)
+- except PlaywrightTimeoutError:
+- self.print_error(f"Timeout while loading {url}")
+- except PlaywrightError as e:
+- self.print_error(f"Error navigating to {url}: {str(e)}")
+- return None, None
+-
+- try:
+- content = page.content()
+- mime_type = None
+- if response:
+- content_type = response.header_value("content-type")
+- if content_type:
+- mime_type = content_type.split(";")[0]
+- except PlaywrightError as e:
+- self.print_error(f"Error retrieving page content: {str(e)}")
+- content = None
+- mime_type = None
+- finally:
+- browser.close()
+-
+- return content, mime_type
+-
+ def scrape_with_httpx(self, url):
+ import httpx
+
diff --git a/misc/py-aider-chat/files/patch-pyproject.toml b/misc/py-aider-chat/files/patch-pyproject.toml
new file mode 100644
index 000000000000..2c261ee0ce98
--- /dev/null
+++ b/misc/py-aider-chat/files/patch-pyproject.toml
@@ -0,0 +1,11 @@
+--- pyproject.toml.orig 2024-09-09 09:50:15 UTC
++++ pyproject.toml
+@@ -62,7 +62,7 @@ include = ["aider*", "aider.website"]
+ ]
+
+ [build-system]
+-requires = ["setuptools>=68", "setuptools_scm[toml]>=8"]
++requires = ["setuptools>=61", "setuptools_scm[toml]>=8"]
+ build-backend = "setuptools.build_meta"
+
+ [tool.setuptools_scm]
diff --git a/misc/py-aider-chat/files/patch-setup.py b/misc/py-aider-chat/files/patch-setup.py
deleted file mode 100644
index 6a9f4e08d16e..000000000000
--- a/misc/py-aider-chat/files/patch-setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
---- setup.py.orig 2024-07-27 19:19:07 UTC
-+++ setup.py
-@@ -33,7 +33,7 @@ print("Packages:", packages)
-
- print("Packages:", packages)
-
--extras = "dev help browser playwright".split()
-+extras = []
-
- setup(
- name="aider-chat",