Skip to content

Commit 5941cd7

Browse files
authored
workspace-python-packages-ag-2934 (#191)
Changes: - Add Python Libraries docs
1 parent 7920b9a commit 5941cd7

File tree

2 files changed

+130
-3
lines changed

2 files changed

+130
-3
lines changed

mint.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@
353353
"workspaces/workspace-management/development-app",
354354
"workspaces/workspace-management/production-app",
355355
"workspaces/workspace-management/install",
356+
"workspaces/workspace-management/python-packages",
356357
"workspaces/workspace-management/secrets",
357358
"workspaces/workspace-management/env-vars",
358359
"workspaces/workspace-management/database-tables",
@@ -928,9 +929,7 @@
928929
"pages": [
929930
{
930931
"group": "Agent UI",
931-
"pages": [
932-
"agent-ui/introduction"
933-
]
932+
"pages": ["agent-ui/introduction"]
934933
}
935934
]
936935
},
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
title: Add Python Libraries
3+
---
4+
5+
Agno templates are setup to manage dependencies using a [pyproject.toml](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata) file, **which is used to generate the `requirements.txt` file using [uv](https://github.com/astral-sh/uv) or [pip-tools](https://pip-tools.readthedocs.io/en/latest/).**
6+
7+
Adding or Updating a python library is a 2 step process:
8+
9+
1. Add library to the `pyproject.toml` file
10+
2. Auto-Generate the `requirements.txt` file
11+
12+
<Warning>
13+
14+
We highly recommend auto-generating the `requirements.txt` file using this process.
15+
16+
</Warning>
17+
18+
## Update pyproject.toml
19+
20+
- Open the `pyproject.toml` file
21+
- Add new libraries to the dependencies section.
22+
23+
## Generate requirements
24+
25+
After updating the `dependencies` in the `pyproject.toml` file, auto-generate the `requirements.txt` file using a helper script or running `pip-compile` directly.
26+
27+
<CodeGroup>
28+
29+
```bash terminal
30+
./scripts/generate-requirements.sh
31+
```
32+
33+
```bash pip compile
34+
pip-compile \
35+
--no-annotate \
36+
--pip-args "--no-cache-dir" \
37+
-o requirements.txt pyproject.toml
38+
```
39+
40+
</CodeGroup>
41+
42+
If you'd like to upgrade all python libraries to their latest version, run:
43+
44+
<CodeGroup>
45+
46+
```bash terminal
47+
./scripts/generate-requirements.sh upgrade
48+
```
49+
50+
```bash pip compile
51+
pip-compile \
52+
--upgrade \
53+
--no-annotate \
54+
--pip-args "--no-cache-dir" \
55+
-o requirements.txt pyproject.toml
56+
```
57+
58+
</CodeGroup>
59+
60+
## Rebuild Images
61+
62+
After updating the `requirements.txt` file, rebuild your images.
63+
64+
### Rebuild dev images
65+
66+
<CodeGroup>
67+
68+
```bash terminal
69+
ag ws up --env dev --infra docker --type image
70+
```
71+
72+
```bash short options
73+
ag ws up -e dev -i docker -t image
74+
```
75+
76+
</CodeGroup>
77+
78+
### Rebuild production images
79+
80+
<Note>
81+
82+
Remember to [authenticate with ECR](workspaces/workspace-management/production-app#ecr-images) if needed.
83+
84+
</Note>
85+
86+
<CodeGroup>
87+
88+
```bash terminal
89+
ag ws up --env prd --infra aws --type image
90+
```
91+
92+
```bash short options
93+
ag ws up -e prd -i aws -t image
94+
```
95+
96+
</CodeGroup>
97+
98+
## Recreate Resources
99+
100+
After rebuilding images, recreate the resources.
101+
102+
### Recreate dev containers
103+
104+
<CodeGroup>
105+
106+
```bash terminal
107+
ag ws restart --env dev --infra docker --type container
108+
```
109+
110+
```bash short options
111+
ag ws restart -e dev -c docker -t container
112+
```
113+
114+
</CodeGroup>
115+
116+
### Update ECS services
117+
118+
<CodeGroup>
119+
120+
```bash terminal
121+
ag ws patch --env prd --infra aws --name service
122+
```
123+
124+
```bash short options
125+
ag ws patch -e prd -i aws -n service
126+
```
127+
128+
</CodeGroup>

0 commit comments

Comments
 (0)