diff --git a/README.cn.md b/README.cn.md index 8b1717dd..8bf067dd 100644 --- a/README.cn.md +++ b/README.cn.md @@ -177,7 +177,7 @@ Playwright Chromium 的安装是可选项。即使失败: --- ## 🐳 使用容器运行 -仓库根目录包含一份 Docker 配置,内含 Python 3.10、关键系统包(包括用于 OCR 的 Tesseract)以及 `environment.yml`/`requirements.txt` 中定义的所有 Python 依赖,确保 Agent 在隔离环境中也能稳定运行。 +仓库根目录包含一份 Docker 配置,内含 Python 3.10、关键系统包(包括用于 OCR 的 Tesseract)以及 `requirements.txt` 中定义的所有 Python 依赖,确保 Agent 在隔离环境中也能稳定运行。 下面是用容器运行 Agent 的步骤。 @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot 通过 `-v` 挂载需要持久化到容器外的目录(例如数据或缓存目录),并根据你的部署需求调整端口或其他参数。镜像内置了 OCR(`tesseract`)所需的系统依赖和常见的 HTTP 客户端,让 Agent 可以直接在容器内处理文件和网络 API。 -镜像默认使用 Python 3.10,并已打包好 `environment.yml`/`requirements.txt` 中的依赖,因此 `python -m app.main` 开箱即用。 +镜像默认使用 Python 3.10,并已打包好 `requirements.txt` 中的依赖,因此 `python -m app.main` 开箱即用。 --- diff --git a/README.de.md b/README.de.md index a71a3b4e..d3f467af 100644 --- a/README.de.md +++ b/README.de.md @@ -177,7 +177,7 @@ Eine ausführliche Fehlerbehebung findest du in [INSTALLATION_FIX.md](INSTALLATI --- ## 🐳 Mit Container ausführen -Im Repository-Root liegt eine Docker-Konfiguration mit Python 3.10, wichtigen System-Paketen (inklusive Tesseract für OCR) und allen Python-Abhängigkeiten aus `environment.yml`/`requirements.txt`, damit der Agent auch in isolierten Umgebungen konsistent läuft. +Im Repository-Root liegt eine Docker-Konfiguration mit Python 3.10, wichtigen System-Paketen (inklusive Tesseract für OCR) und allen Python-Abhängigkeiten aus `requirements.txt`, damit der Agent auch in isolierten Umgebungen konsistent läuft. Hier sind die Schritte, um unseren Agent im Container zu starten. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot Mounte mit `-v` Verzeichnisse, die außerhalb des Containers persistieren sollen (etwa Daten- oder Cache-Ordner), und passe Ports und weitere Flags an deine Deployment-Anforderungen an. Das Image bringt die System-Abhängigkeiten für OCR (`tesseract`) sowie gängige HTTP-Clients mit, damit der Agent im Container direkt mit Dateien und Netzwerk-APIs arbeiten kann. -Standardmäßig nutzt das Image Python 3.10 und bündelt die Python-Abhängigkeiten aus `environment.yml`/`requirements.txt`, daher funktioniert `python -m app.main` sofort. +Standardmäßig nutzt das Image Python 3.10 und bündelt die Python-Abhängigkeiten aus `requirements.txt`, daher funktioniert `python -m app.main` sofort. --- diff --git a/README.es.md b/README.es.md index e53f86b1..0a8fb038 100644 --- a/README.es.md +++ b/README.es.md @@ -177,7 +177,7 @@ Para una solución de problemas más detallada, consulta [INSTALLATION_FIX.md](I --- ## 🐳 Ejecutar con un contenedor -La raíz del repositorio incluye una configuración Docker con Python 3.10, los paquetes de sistema clave (incluido Tesseract para OCR) y todas las dependencias de Python definidas en `environment.yml`/`requirements.txt`, de modo que el agente puede ejecutarse de forma consistente en entornos aislados. +La raíz del repositorio incluye una configuración Docker con Python 3.10, los paquetes de sistema clave (incluido Tesseract para OCR) y todas las dependencias de Python definidas en `requirements.txt`, de modo que el agente puede ejecutarse de forma consistente en entornos aislados. A continuación tienes las instrucciones para correr nuestro agente con un contenedor. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot Monta con `-v` los directorios que deban persistir fuera del contenedor (por ejemplo carpetas de datos o caché) y ajusta puertos u otros parámetros según tu despliegue. La imagen trae dependencias del sistema para OCR (`tesseract`) y clientes HTTP habituales, de modo que el agente pueda trabajar con archivos y APIs de red dentro del contenedor. -Por defecto, la imagen usa Python 3.10 y empaqueta las dependencias de Python de `environment.yml`/`requirements.txt`, así que `python -m app.main` funciona sin más. +Por defecto, la imagen usa Python 3.10 y empaqueta las dependencias de Python de `requirements.txt`, así que `python -m app.main` funciona sin más. --- diff --git a/README.fr.md b/README.fr.md index 11c86451..a86581e5 100644 --- a/README.fr.md +++ b/README.fr.md @@ -177,7 +177,7 @@ Pour un dépannage plus approfondi, voir [INSTALLATION_FIX.md](INSTALLATION_FIX. --- ## 🐳 Lancer dans un conteneur -La racine du dépôt contient une configuration Docker avec Python 3.10, les paquets système essentiels (dont Tesseract pour l'OCR) et toutes les dépendances Python définies dans `environment.yml`/`requirements.txt`, afin que l'agent tourne de manière cohérente dans des environnements isolés. +La racine du dépôt contient une configuration Docker avec Python 3.10, les paquets système essentiels (dont Tesseract pour l'OCR) et toutes les dépendances Python définies dans `requirements.txt`, afin que l'agent tourne de manière cohérente dans des environnements isolés. Voici les étapes pour lancer notre agent dans un conteneur. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot Montez avec `-v` les répertoires qui doivent persister en dehors du conteneur (par exemple les dossiers de données ou de cache) et ajustez les ports ou les autres flags en fonction de votre déploiement. L'image embarque les dépendances système nécessaires à l'OCR (`tesseract`) et des clients HTTP courants, pour que l'agent puisse manipuler des fichiers et des APIs réseau directement dans le conteneur. -Par défaut, l'image utilise Python 3.10 et embarque les dépendances Python de `environment.yml`/`requirements.txt`, donc `python -m app.main` fonctionne directement. +Par défaut, l'image utilise Python 3.10 et embarque les dépendances Python de `requirements.txt`, donc `python -m app.main` fonctionne directement. --- diff --git a/README.ja.md b/README.ja.md index 915f7025..d2063c08 100644 --- a/README.ja.md +++ b/README.ja.md @@ -177,7 +177,7 @@ Playwright Chromiumのインストールは任意です。失敗しても: --- ## 🐳 コンテナで実行する -リポジトリのルートには、Python 3.10、主要なシステムパッケージ(OCR用のTesseractを含む)、そして`environment.yml`/`requirements.txt`で定義されたすべてのPython依存関係を含むDocker構成が用意されており、隔離された環境でもエージェントを一貫して動かせます。 +リポジトリのルートには、Python 3.10、主要なシステムパッケージ(OCR用のTesseractを含む)、そして`requirements.txt`で定義されたすべてのPython依存関係を含むDocker構成が用意されており、隔離された環境でもエージェントを一貫して動かせます。 以下は、コンテナでエージェントを動かすための手順です。 @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot コンテナ外に永続化したいディレクトリ(データやキャッシュなど)は`-v`でマウントし、ポートやその他のフラグもデプロイ要件に応じて調整してください。コンテナにはOCR用(`tesseract`)や一般的なHTTPクライアントなどのシステム依存が同梱されているので、ファイル操作やネットワークAPIをコンテナ内でそのまま扱えます。 -既定ではPython 3.10を使い、`environment.yml`/`requirements.txt`のPython依存関係を取り込んでいるので、`python -m app.main`がすぐに動きます。 +既定ではPython 3.10を使い、`requirements.txt`のPython依存関係を取り込んでいるので、`python -m app.main`がすぐに動きます。 --- diff --git a/README.ko.md b/README.ko.md index 2746c4a4..ff9d9165 100644 --- a/README.ko.md +++ b/README.ko.md @@ -177,7 +177,7 @@ Playwright Chromium 설치는 선택 사항입니다. 실패하더라도: --- ## 🐳 컨테이너로 실행 -저장소 루트에는 Python 3.10, 주요 시스템 패키지(OCR을 위한 Tesseract 포함), 그리고 `environment.yml`/`requirements.txt`에 정의된 모든 Python 의존성을 포함하는 Docker 구성이 들어 있어, 격리된 환경에서도 에이전트를 일관되게 실행할 수 있습니다. +저장소 루트에는 Python 3.10, 주요 시스템 패키지(OCR을 위한 Tesseract 포함), 그리고 `requirements.txt`에 정의된 모든 Python 의존성을 포함하는 Docker 구성이 들어 있어, 격리된 환경에서도 에이전트를 일관되게 실행할 수 있습니다. 다음은 컨테이너로 에이전트를 실행하는 방법입니다. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot 컨테이너 바깥에 유지되어야 할 디렉터리(데이터, 캐시 등)는 `-v`로 마운트하고, 포트나 추가 플래그는 배포 환경에 맞춰 조정하세요. 이미지에는 OCR(`tesseract`)에 필요한 시스템 의존성과 흔히 쓰이는 HTTP 클라이언트가 포함되어 있어, 에이전트가 컨테이너 안에서도 파일과 네트워크 API를 다룰 수 있습니다. -이미지는 기본적으로 Python 3.10을 사용하며 `environment.yml`/`requirements.txt`의 Python 의존성을 함께 패키징해 두었기 때문에, `python -m app.main`이 곧바로 동작합니다. +이미지는 기본적으로 Python 3.10을 사용하며 `requirements.txt`의 Python 의존성을 함께 패키징해 두었기 때문에, `python -m app.main`이 곧바로 동작합니다. --- diff --git a/README.md b/README.md index 0114c80e..5aa2af02 100644 --- a/README.md +++ b/README.md @@ -177,7 +177,7 @@ For detailed troubleshooting, see [INSTALLATION_FIX.md](INSTALLATION_FIX.md). --- ## 🐳 Run with Container -The repository root included a Docker configuration with Python 3.10, key system packages (including Tesseract for OCR), and all Python dependencies defined in `environment.yml`/`requirements.txt` so the agent can run consistently in isolated environments. +The repository root included a Docker configuration with Python 3.10, key system packages (including Tesseract for OCR), and all Python dependencies defined in `requirements.txt` so the agent can run consistently in isolated environments. Below are the setup instruction of running our agent with container. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot Mount any directories that should persist outside the container (such as data or cache folders) using `-v`, and adjust ports or additional flags as needed for your deployment. The container ships with system dependencies for OCR (`tesseract`) and common HTTP clients so the agent can work with files and network APIs inside the container. -By default the image uses Python 3.10 and bundles the Python dependencies from `environment.yml`/`requirements.txt`, so `python -m app.main` works out of the box. +By default the image uses Python 3.10 and bundles the Python dependencies from `requirements.txt`, so `python -m app.main` works out of the box. --- diff --git a/README.pt-BR.md b/README.pt-BR.md index aa24e3ac..5c291235 100644 --- a/README.pt-BR.md +++ b/README.pt-BR.md @@ -177,7 +177,7 @@ Para uma solução de problemas mais detalhada, veja [INSTALLATION_FIX.md](INSTA --- ## 🐳 Rodar com container -A raiz do repositório inclui uma configuração Docker com Python 3.10, pacotes de sistema essenciais (incluindo Tesseract para OCR) e todas as dependências Python definidas em `environment.yml`/`requirements.txt`, para que o agente rode de forma consistente em ambientes isolados. +A raiz do repositório inclui uma configuração Docker com Python 3.10, pacotes de sistema essenciais (incluindo Tesseract para OCR) e todas as dependências Python definidas em `requirements.txt`, para que o agente rode de forma consistente em ambientes isolados. Abaixo estão as instruções para rodar nosso agente em container. @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot Monte com `-v` os diretórios que precisam persistir fora do container (por exemplo, pastas de dados ou cache) e ajuste portas ou outras flags conforme seu deploy. A imagem traz dependências de sistema para OCR (`tesseract`) e clientes HTTP comuns, para o agente trabalhar com arquivos e APIs de rede dentro do container. -Por padrão, a imagem usa Python 3.10 e empacota as dependências Python de `environment.yml`/`requirements.txt`, então `python -m app.main` funciona de cara. +Por padrão, a imagem usa Python 3.10 e empacota as dependências Python de `requirements.txt`, então `python -m app.main` funciona de cara. --- diff --git a/README.zh-TW.md b/README.zh-TW.md index d2fcdcc0..ec5dff2e 100644 --- a/README.zh-TW.md +++ b/README.zh-TW.md @@ -177,7 +177,7 @@ Playwright Chromium 的安裝為選用項目。即使失敗: --- ## 🐳 使用容器執行 -儲存庫根目錄包含一份 Docker 設定,內含 Python 3.10、關鍵系統套件(含用於 OCR 的 Tesseract),以及 `environment.yml`/`requirements.txt` 中定義的所有 Python 相依套件,讓 Agent 在隔離環境中也能穩定運作。 +儲存庫根目錄包含一份 Docker 設定,內含 Python 3.10、關鍵系統套件(含用於 OCR 的 Tesseract),以及 `requirements.txt` 中定義的所有 Python 相依套件,讓 Agent 在隔離環境中也能穩定運作。 以下是使用容器執行 Agent 的步驟。 @@ -205,7 +205,7 @@ docker run --rm -it --env-file .env craftbot 透過 `-v` 掛載需要持久化到容器外的目錄(例如資料或快取資料夾),並依部署需求調整 port 或其他參數。映像檔內建了 OCR(`tesseract`)所需的系統套件以及常見的 HTTP 客戶端,讓 Agent 可以直接在容器中處理檔案和網路 API。 -映像檔預設使用 Python 3.10,並打包好 `environment.yml`/`requirements.txt` 中的相依套件,所以 `python -m app.main` 可以直接運作。 +映像檔預設使用 Python 3.10,並打包好 `requirements.txt` 中的相依套件,所以 `python -m app.main` 可以直接運作。 --- diff --git a/app/runtime_preflight.py b/app/runtime_preflight.py index 26b0254b..27fe6651 100644 --- a/app/runtime_preflight.py +++ b/app/runtime_preflight.py @@ -73,6 +73,9 @@ def _runtime_import_command( ) -> Tuple[List[str], str]: script = _runtime_import_script(checks) if use_conda and env_name: + # `conda run` rejects arguments containing newlines (AssertionError, + # then blocks on its "send error report?" prompt) — collapse the + # script to a single-line exec() so the probe actually runs. return ( [ conda_command, @@ -81,7 +84,7 @@ def _runtime_import_command( env_name, "python", "-c", - script, + f"exec({script!r})", ], f"conda environment '{env_name}'", ) diff --git a/environment.yml b/environment.yml index 51fdc147..5b949c98 100644 --- a/environment.yml +++ b/environment.yml @@ -2,19 +2,16 @@ name: craftbot channels: - conda-forge - defaults +# Conda-level runtime only: interpreter, system binaries and pins pip can't +# express. Python packages are NOT listed here — see the pip section below. dependencies: - python=3.10.19 - pip=26.0.1 - - requests=2.32.5 - - pyyaml=6.0.3 - - loguru=0.7.3 - - nest-asyncio=1.6.0 - - pymongo=4.16.0 - - tzlocal=5.3.1 - - pillow=12.1.1 - - pytesseract=0.3.13 + # tesseract binary (pytesseract's backend) — conda-only, no pip wheel. - tesseract=5.5.2 - - aiohttp=3.13.3 + # conda-forge's tesseract build links libcurl.dll but doesn't declare it — + # without this, tesseract.exe dies with 0xC0000135 (DLL not found) on Windows. + - libcurl # PINNED: openssl 3.6.3 / 3.5.7 regress the Windows cert-store load # (ssl.SSLError ASN1: NOT_ENOUGH_DATA in _load_windows_store_certs, crashes # aiohttp at import). Broke 2026-06-22 and AGAIN 2026-08-19 when a nodejs @@ -24,36 +21,9 @@ dependencies: # Agent App builds: the agent-app CLI is TypeScript run by Node's native type # stripping — needs Node >= 24 (older majors ERR_UNKNOWN_FILE_EXTENSION). - nodejs>=24 - - beautifulsoup4=4.14.3 - - chardet=5.2.0 - - lxml=6.0.2 - - scikit-learn=1.7.2 + # Every Python package comes from requirements.txt — the single source for + # pip mode, conda mode, Docker and the release build. Only add a package to + # this file if pip cannot provide it (interpreter, system binaries, pins + # that protect the interpreter itself like openssl above). - pip: - - croniter - - openai==2.21.0 - - google-genai==1.0.0 - - anthropic==0.83.0 - - chromadb==1.5.1 - - tiktoken==0.12.0 - - langgraph==1.0.9 - - neo4j==6.1.0 - - mss==10.1.0 - - httpx==0.28.1 - - trafilatura==2.0.0 - - markdown2==2.5.4 - - python-docx==1.2.0 - - fake-useragent==2.2.0 - - fpdf2==2.8.6 - - googlesearch-python==1.3.0 - - pyautogui==0.9.54 - - pygetwindow==0.0.9 - - python3-xlib==0.15 - - tenacity==9.1.4 - - docling==2.74.0 - - gradio_client==2.1.0 - - python-dotenv==1.2.1 - - watchdog==6.0.0 - - telethon==1.42.0 - - playwright==1.58.0 - - qrcode==8.2 - - sentence-transformers==6.0.0 + - -r requirements.txt diff --git a/requirements.txt b/requirements.txt index c844e9f0..f94a5f73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,6 @@ +# Single source of truth for CraftBot's Python dependencies - used by pip mode +# (install.py), conda mode (environment.yml pulls this file in via `-r`), +# the Dockerfile and the release build. Add/bump packages HERE only. requests pyyaml loguru diff --git a/tests/test_run_dependency_check.py b/tests/test_run_dependency_check.py index 66fca347..a3325320 100644 --- a/tests/test_run_dependency_check.py +++ b/tests/test_run_dependency_check.py @@ -69,6 +69,21 @@ def fake_run(cmd, capture_output, text, timeout): assert "unexpected probe output" in output +def test_conda_probe_command_is_single_line_and_runs(): + # `conda run` refuses newline-containing args; the probe must be one line + # and still execute the full multi-line script. + cmd, _ = runtime_preflight._runtime_import_command( + True, "craftbot", {"json": "json", "nope": "no_such_module_xyz"}, "conda" + ) + assert not any("\n" in arg for arg in cmd) + + result = subprocess.run( + [sys.executable, "-c", cmd[-1]], text=True, capture_output=True + ) + assert result.returncode == 0, result.stderr + assert '__CRAFTBOT_MISSING_RUNTIME_IMPORTS__["nope"]' in result.stdout + + def test_app_main_runs_preflight_before_agent_core_import(): code = textwrap.dedent( """