-
Notifications
You must be signed in to change notification settings - Fork 91
Fix AppWorld setup via Python entrypoints #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,11 +37,11 @@ conda run -n appworld pip install -r "$SCRIPT_DIR/requirements.txt" | |
|
|
||
| # 5. 初始化 appworld | ||
| echo "📁 初始化 appworld..." | ||
| conda run -n appworld appworld install | ||
| conda run -n appworld python -c $'from appworld.install import install_package\ninstall_package()\n' | ||
|
|
||
| # 6. 下载数据 | ||
| echo "📦 下载数据(失败则使用备用下载)..." | ||
| if ! conda run -n appworld appworld download data; then | ||
| if ! conda run -n appworld python -c $'import os\nfrom appworld import update_root\nfrom appworld.download import download_data\nroot = os.environ.get("APPWORLD_ROOT") or "."\nupdate_root(root)\ndownload_data()\n'; then | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This inline Python script is quite long, which harms readability and makes it hard to maintain. For multi-line scripts inside a shell script, using a I recommend refactoring this if ! conda run -n appworld python <<'EOF'
import os
from appworld import update_root
from appworld.download import download_data
root = os.environ.get("APPWORLD_ROOT") or "."
update_root(root)
download_data()
EOF
thenThis makes the Python code much easier to read and edit. |
||
| echo "⚠️ 自动下载失败,尝试从备用地址获取数据..." | ||
| wget -O "$APPWORLD_ROOT/appworld_data.zip" "https://dail-wlcb.oss-accelerate.aliyuncs.com/eric.czq/appworld_data.zip" | ||
| mkdir -p /tmp/unziptemp | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better readability and to avoid the
$'...'bashism, you could use a single-line Python command with a semicolon for this short script. This makes the command more straightforward.