chore: align dev and demo setup environments (#10920)

## 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.
This commit is contained in:
Ashpreet
2026-10-09 22:13:18 +01:00
committed by GitHub
parent ff9b86d5be
commit c15c55ea7d
5 changed files with 42 additions and 75 deletions
+4 -4
View File
@@ -43,12 +43,12 @@ This project uses two virtual environments:
| Environment | Purpose | Setup |
|-------------|---------|-------|
| `.venv/` | Development: tests, formatting, validation | `./scripts/dev_setup.sh` |
| `.venvs/demo/` | Cookbooks: has all demo dependencies | `./scripts/demo_setup.sh` |
| `.venv/` | Development and cookbooks: demo dependencies, tests, formatting, validation | `./scripts/dev_setup.sh` |
| `.venvs/demo/` | Dedicated demos: same dependencies, separate environment | `./scripts/demo_setup.sh` |
**Use `.venv`** for development tasks (`pytest`, `./scripts/format.sh`, `./scripts/validate.sh`).
**Use `.venv`** for development tasks (`pytest`, `./scripts/format.sh`, `./scripts/validate.sh`) and day-to-day cookbook work.
**Use `.venvs/demo`** for running cookbook examples.
**Use `.venvs/demo`** for running demos in a separate environment. The cookbook commands below use this environment and also work with `.venv/bin/python`.
---
+8
View File
@@ -50,6 +50,14 @@ _These guidelines are enforced automatically by our [PR Lint workflow](.github/w
> From here on you have to use `uv pip install` to install missing packages
On Unix, `dev_setup.sh` installs local editable `agnoctl[dev]` and `agno[demo]`
into `.venv`, including development tools and demo dependencies for cookbook work.
Use `./scripts/demo_setup.sh` for a separate `.venvs/demo` environment with the
same dependencies, then activate it with `source .venvs/demo/bin/activate`.
Both scripts use Python 3.12 and recreate only their target environment on each
run; deactivate any active environment first. Individual cookbooks may require
additional dependencies, credentials, or services.
## Formatting and validation
Ensure your code meets our quality standards by running the appropriate formatting and validation script before submitting a pull request:
-45
View File
@@ -1,45 +0,0 @@
#!/bin/bash
############################################################################
# Agno Setup for running cookbooks
# - Create a virtual environment and install libraries in editable mode.
# - Please deactivate the existing virtual environment before running.
# Usage: ./scripts/cookbook_setup.sh
############################################################################
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "${CURR_DIR}")"
AGNO_DIR="${REPO_ROOT}/libs/agno"
source "${CURR_DIR}/_utils.sh"
VENV_DIR="${REPO_ROOT}/agnoenv"
PYTHON_VERSION=$(python3 --version)
print_heading "Development setup..."
print_heading "Removing virtual env"
print_info "rm -rf ${VENV_DIR}"
rm -rf ${VENV_DIR}
print_heading "Creating virtual env"
print_info "Creating python3 venv: ${VENV_DIR}"
python3 -m venv "${VENV_DIR}"
# Activate the venv
source "${VENV_DIR}/bin/activate"
print_info "Installing base python packages"
pip3 install --upgrade pip pip-tools twine build
print_heading "Installing requirements.txt"
pip install --no-deps \
-r ${AGNO_DIR}/requirements.txt
print_heading "Installing agno with [dev] extras"
pip install --editable "${AGNO_DIR}[dev]"
print_heading "pip list"
pip list
print_heading "Development setup complete"
print_heading "Activate venv using: source ${VENV_DIR}/bin/activate"
+15 -12
View File
@@ -4,12 +4,15 @@
#
# Agno Demo Environment Setup
#
# Creates .venvs/demo with local editable agnoctl and agno[demo],
# separate from the day-to-day development environment in .venv.
#
# Usage: ./scripts/demo_setup.sh
# Run: python cookbook/01_demo/run.py
#
############################################################################
set -e
set -euo pipefail
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "${CURR_DIR}")"
@@ -38,7 +41,7 @@ echo -e " ${DIM}Demo Setup${NC}"
echo ""
# Preflight
if [[ -n "$VIRTUAL_ENV" ]]; then
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
echo " Deactivate your current venv first."
exit 1
fi
@@ -61,20 +64,20 @@ 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 and agno[demo] in editable mode...${NC}"
echo -e " ${DIM}> uv pip install -e libs/agnoctl -e libs/agno[demo]${NC}"
VIRTUAL_ENV="${VENV_DIR}" uv pip install -e "${AGNOCTL_DIR}" -e "${AGNO_DIR}[demo]" --quiet
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
# Copy activation command to clipboard
ACTIVATE_CMD="source .venvs/demo/bin/activate"
CLIPBOARD_MSG=""
if command -v pbcopy &> /dev/null; then
echo -n "${ACTIVATE_CMD}" | pbcopy
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
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
echo -n "${ACTIVATE_CMD}" | xclip -selection clipboard
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
else
CLIPBOARD_MSG=""
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 ""
+15 -14
View File
@@ -5,15 +5,15 @@
# Agno Development Setup
#
# Creates .venv with agnoctl and agno installed in editable mode,
# with everything the core dev loop needs: unit + integration tests,
# ./scripts/format.sh and ./scripts/validate.sh.
# 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 -e
set -euo pipefail
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(dirname "${CURR_DIR}")"
@@ -42,7 +42,7 @@ echo -e " ${DIM}Development Setup${NC}"
echo ""
# Preflight
if [[ -n "$VIRTUAL_ENV" ]]; then
if [[ -n "${VIRTUAL_ENV:-}" ]]; then
echo " Deactivate your current venv first."
exit 1
fi
@@ -65,26 +65,27 @@ 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[dev] in editable mode...${NC}"
echo -e " ${DIM}> uv pip install -e libs/agnoctl[dev] -e libs/agno[dev]${NC}"
VIRTUAL_ENV="${VENV_DIR}" uv pip install -e "${AGNOCTL_DIR}[dev]" -e "${AGNO_DIR}[dev]" --quiet
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
# Copy activation command to clipboard
ACTIVATE_CMD="source .venv/bin/activate"
CLIPBOARD_MSG=""
if command -v pbcopy &> /dev/null; then
echo -n "${ACTIVATE_CMD}" | pbcopy
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
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
echo -n "${ACTIVATE_CMD}" | xclip -selection clipboard
CLIPBOARD_MSG="(Copied to clipboard. Just paste and hit enter.)"
else
CLIPBOARD_MSG=""
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 ""