diff --git a/docs/guide/quick-start.mdx b/docs/guide/quick-start.mdx index ed5ec3f1..a4aa35f3 100644 --- a/docs/guide/quick-start.mdx +++ b/docs/guide/quick-start.mdx @@ -5,7 +5,7 @@ description: One-click install and manage CowAgent with scripts The project provides scripts for one-click install, configuration, startup, and management. Script-based deployment is recommended for quick setup. -Supports Linux, macOS, and Windows. Requires Python 3.7-3.12 (3.9 recommended). +Supports Linux, macOS, and Windows. Requires Python 3.7-3.13 (3.9 recommended). ## Install Command diff --git a/docs/ja/guide/quick-start.mdx b/docs/ja/guide/quick-start.mdx index 407f1e21..a24c706d 100644 --- a/docs/ja/guide/quick-start.mdx +++ b/docs/ja/guide/quick-start.mdx @@ -5,7 +5,7 @@ description: スクリプトによるCowAgentのワンクリックインスト 本プロジェクトでは、ワンクリックでのインストール、設定、起動、管理を行うスクリプトを提供しています。素早くセットアップするには、スクリプトによるデプロイを推奨します。 -Linux、macOS、Windowsに対応しています。Python 3.7〜3.12が必要です(3.9を推奨)。 +Linux、macOS、Windowsに対応しています。Python 3.7〜3.13が必要です(3.9を推奨)。 ## インストールコマンド diff --git a/docs/zh/guide/quick-start.mdx b/docs/zh/guide/quick-start.mdx index 964ffe74..735225e2 100644 --- a/docs/zh/guide/quick-start.mdx +++ b/docs/zh/guide/quick-start.mdx @@ -5,7 +5,7 @@ description: 使用脚本一键安装和管理 CowAgent 项目提供了一键安装、配置、启动、管理程序的脚本,推荐使用脚本快速运行。 -支持 Linux、macOS、Windows 操作系统,需安装 Python 3.7 ~ 3.12(推荐 3.9)。 +支持 Linux、macOS、Windows 操作系统,需安装 Python 3.7 ~ 3.13(推荐 3.9)。 ## 安装命令 diff --git a/requirements.txt b/requirements.txt index 24ea9da8..e059cd29 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,6 @@ aiohttp>=3.8.6,<3.10 requests>=2.28.2 chardet>=5.1.0 Pillow -web.py -legacy-cgi; python_version >= "3.13" python-dotenv>=1.0.0 PyYAML>=6.0 croniter>=2.0.0 @@ -32,4 +30,9 @@ python-telegram-bot # slack bot slack_bolt # discord bot -discord.py \ No newline at end of file +discord.py + +# web.py: PyPI 0.62 fails to build on Python 3.13+ (cgi module removed), use GitHub fix instead +web.py; python_version < "3.13" +web.py @ git+https://github.com/webpy/webpy.git ; python_version >= "3.13" +legacy-cgi; python_version >= "3.13" diff --git a/run.sh b/run.sh index cb624ac4..1099eb43 100755 --- a/run.sh +++ b/run.sh @@ -359,39 +359,37 @@ detect_python_command() { FOUND_NEWER_VERSION="" # Try to find Python command in order of preference - for cmd in python3 python python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do + for cmd in python3 python python3.13 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do if command -v $cmd &> /dev/null; then # Check Python version major_version=$($cmd -c 'import sys; print(sys.version_info[0])' 2>/dev/null) minor_version=$($cmd -c 'import sys; print(sys.version_info[1])' 2>/dev/null) if [[ "$major_version" == "3" ]]; then - # Check if version is in supported range (3.7 - 3.12) - if (( minor_version >= 7 && minor_version <= 12 )); then + # Supported range is 3.7+. On 3.13+ web.py is installed from a + # pinned GitHub commit (see requirements.txt), which needs git. + if (( minor_version >= 7 )); then PYTHON_CMD=$cmd PYTHON_VERSION="${major_version}.${minor_version}" break - elif (( minor_version >= 13 )); then - # Found Python 3.13+, but not compatible - if [ -z "$FOUND_NEWER_VERSION" ]; then - FOUND_NEWER_VERSION="${major_version}.${minor_version}" - fi fi fi fi done if [ -z "$PYTHON_CMD" ]; then - echo -e "${YELLOW}Tried: python3, python, python3.12, python3.11, python3.10, python3.9, python3.8, python3.7${NC}" - if [ -n "$FOUND_NEWER_VERSION" ]; then - echo -e "${RED}❌ Found Python $FOUND_NEWER_VERSION, but this project requires Python 3.7-3.12${NC}" - echo -e "${YELLOW}Python 3.13+ has compatibility issues with some dependencies (web.py, cgi module removed)${NC}" - echo -e "${YELLOW}Please install Python 3.7-3.12 (recommend Python 3.12)${NC}" - else - echo -e "${RED}❌ No suitable Python found. Please install Python 3.7-3.12${NC}" - fi + echo -e "${YELLOW}Tried: python3, python, python3.13, python3.12, python3.11, python3.10, python3.9, python3.8, python3.7${NC}" + echo -e "${RED}❌ No suitable Python found. Please install Python 3.7 or newer${NC}" exit 1 fi + + # On 3.13+, web.py is pulled from GitHub via pip, which requires git. + if [[ "$major_version" == "3" ]] && (( minor_version >= 13 )); then + if ! command -v git &> /dev/null; then + echo -e "${YELLOW}⚠️ Python $PYTHON_VERSION detected. Installing web.py from GitHub requires git, which was not found.${NC}" + echo -e "${YELLOW} Please install git, or use Python 3.12 where web.py installs directly from PyPI.${NC}" + fi + fi # Export for global use export PYTHON_CMD