mirror of
https://github.com/agno-agi/agno.git
synced 2026-10-11 22:09:58 +00:00
## Summary Local development and cookbook work need the same dependencies as demos. Both Unix setup scripts now install local editable `agnoctl[dev]` and `agno[demo]`, while keeping `.venv` for daily development and `.venvs/demo` for dedicated demos. - Remove `scripts/cookbook_setup.sh`; use `scripts/dev_setup.sh` for cookbook development. - Enable strict shell error handling, explicitly target the environment's Python, and make clipboard failures non-fatal. - Keep short activation commands relative to the repository root and update contributor and agent instructions. ## Type of change - [x] Bug fix - [ ] New feature - [x] Breaking change - [x] Improvement - [ ] Model update - [ ] Other: --- ## Checklist - [x] Code complies with style guidelines - [x] Ran format/validation scripts (`./scripts/format.sh` and `./scripts/validate.sh`) - [x] Self-review completed - [x] Documentation updated (comments, docstrings) - [ ] Examples and guides: Relevant cookbook examples have been included or updated (if applicable) - [ ] Tested in clean environment - [ ] Tests added/updated (if applicable) ### Duplicate and AI-Generated PR Check - [x] I have searched existing [open pull requests](https://github.com/agno-agi/agno/pulls) and confirmed that no other PR already addresses this issue - [x] If a similar PR exists, I have explained below why this PR is a better approach - [x] Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.) --- ## Additional Notes ### Validation - `bash -n scripts/dev_setup.sh scripts/demo_setup.sh` and `git diff --check`: passed. - Isolated shell smoke checks for both retained setup scripts: passed for successful setup, active-environment rejection, missing `uv`, and installation failure. Successful runs also exercised paths with spaces, failing clipboard commands, and preservation of the other environment. - `uv pip install --dry-run --python .venv/bin/python -e 'libs/agnoctl[dev]' -e 'libs/agno[demo]'`: resolved 235 packages successfully. This was a dependency-resolution check, not a fresh install or a live demo run. - `./scripts/format.sh`: passed. Its unrelated formatting edits were reverted to keep this PR focused. - `./scripts/validate.sh`: failed. The latest run reports 32 mypy errors in 10 unchanged framework files in the current local environment, including SQL adapters, public limits, Google model compatibility, Anthropic, and AWS. The earlier run reported six errors. Other checks passed during the latest run after formatting. Draft pending the repository validation gate. No existing development or demo environment was rebuilt. Windows setup scripts are outside this change. Removing the cookbook script requires callers to switch to `./scripts/dev_setup.sh`; any existing `agnoenv` directory is left untouched. Dev setup now installs the larger demo bundle, including for CI jobs that call it. Related PR #8020 only quotes variables in an older version of `dev_setup.sh`. The current base already quotes those installation and removal paths; this PR addresses dependency parity, separate environment roles, script removal, and setup error handling.
96 lines
3.3 KiB
Bash
Executable File
96 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
############################################################################
|
|
#
|
|
# Agno Development Setup
|
|
#
|
|
# Creates .venv with agnoctl and agno installed in editable mode,
|
|
# with the same dependencies as the demo environment for local
|
|
# development and cookbooks, including tests, formatting and validation.
|
|
# Provider-SDK test dependencies live in ./scripts/test_setup.sh.
|
|
#
|
|
# Usage: ./scripts/dev_setup.sh
|
|
#
|
|
############################################################################
|
|
|
|
set -euo pipefail
|
|
|
|
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(dirname "${CURR_DIR}")"
|
|
AGNO_DIR="${REPO_ROOT}/libs/agno"
|
|
AGNOCTL_DIR="${REPO_ROOT}/libs/agnoctl"
|
|
VENV_DIR="${REPO_ROOT}/.venv"
|
|
|
|
# Colors
|
|
ORANGE='\033[38;5;208m'
|
|
DIM='\033[2m'
|
|
BOLD='\033[1m'
|
|
NC='\033[0m'
|
|
|
|
echo ""
|
|
echo -e "${ORANGE}"
|
|
cat << 'BANNER'
|
|
█████╗ ██████╗ ███╗ ██╗ ██████╗
|
|
██╔══██╗██╔════╝ ████╗ ██║██╔═══██╗
|
|
███████║██║ ███╗██╔██╗ ██║██║ ██║
|
|
██╔══██║██║ ██║██║╚██╗██║██║ ██║
|
|
██║ ██║╚██████╔╝██║ ╚████║╚██████╔╝
|
|
╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝
|
|
BANNER
|
|
echo -e "${NC}"
|
|
echo -e " ${DIM}Development Setup${NC}"
|
|
echo ""
|
|
|
|
# Preflight
|
|
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
|
|
echo " Deactivate your current venv first."
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v uv &> /dev/null; then
|
|
echo " uv not found. Install: https://docs.astral.sh/uv/"
|
|
exit 1
|
|
fi
|
|
|
|
# Setup
|
|
echo -e " ${DIM}Removing old environment...${NC}"
|
|
echo -e " ${DIM}> rm -rf ${VENV_DIR}${NC}"
|
|
rm -rf "${VENV_DIR}"
|
|
|
|
echo ""
|
|
echo -e " ${DIM}Creating Python 3.12 venv...${NC}"
|
|
echo -e " ${DIM}> uv venv ${VENV_DIR} --python 3.12${NC}"
|
|
uv venv "${VENV_DIR}" --python 3.12 --quiet
|
|
|
|
# One resolve for both editables: the local agnoctl satisfies agno's
|
|
# agnoctl dependency, so nothing is pulled from PyPI for it.
|
|
echo ""
|
|
echo -e " ${DIM}Installing agnoctl[dev] and agno[demo] in editable mode...${NC}"
|
|
echo -e " ${DIM}> uv pip install -e libs/agnoctl[dev] -e libs/agno[demo]${NC}"
|
|
uv pip install --python "${VENV_DIR}/bin/python" -e "${AGNOCTL_DIR}[dev]" -e "${AGNO_DIR}[demo]" --quiet
|
|
|
|
ACTIVATE_CMD="source .venv/bin/activate"
|
|
CLIPBOARD_MSG=""
|
|
if command -v pbcopy &> /dev/null; then
|
|
if printf '%s' "${ACTIVATE_CMD}" | pbcopy 2>/dev/null; then
|
|
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
|
|
fi
|
|
elif command -v xclip &> /dev/null; then
|
|
if printf '%s' "${ACTIVATE_CMD}" | xclip -selection clipboard 2>/dev/null; then
|
|
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
|
|
fi
|
|
fi
|
|
|
|
echo ""
|
|
echo -e " ${BOLD}Done.${NC}"
|
|
echo ""
|
|
echo -e " ${DIM}Activate:${NC} ${ACTIVATE_CMD}"
|
|
echo -e " ${DIM}Cookbook:${NC} python cookbook/<folder>/<file>.py"
|
|
echo -e " ${DIM}Test:${NC} pytest libs/agno/tests/unit"
|
|
echo -e " ${DIM}Validate:${NC} ./scripts/format.sh && ./scripts/validate.sh"
|
|
echo ""
|
|
if [[ -n "$CLIPBOARD_MSG" ]]; then
|
|
echo -e " ${DIM}${CLIPBOARD_MSG}${NC}"
|
|
echo ""
|
|
fi
|