Skip to content

Commit c7414fc

Browse files
committed
fix: add env setup instrucs
1 parent c27feb8 commit c7414fc

3 files changed

Lines changed: 81 additions & 4 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Langroid Chat UI Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,48 @@ class EventDrivenAgent(lr.ChatAgent):
189189
### Prerequisites
190190
- Python 3.8+
191191
- Node.js 16+
192-
- Langroid installed (`pip install langroid`)
192+
- UV (recommended) or pip for Python package management
193+
194+
### Environment Setup
195+
196+
#### Using UV (Recommended)
197+
198+
UV is a fast Python package manager that handles virtual environments automatically:
199+
200+
```bash
201+
# Install UV if you haven't already
202+
curl -LsSf https://astral.sh/uv/install.sh | sh
203+
204+
# Navigate to the backend directory
205+
cd backend
206+
207+
# Create virtual environment and install dependencies
208+
uv venv
209+
uv pip install -r requirements.txt
210+
211+
# Install Langroid
212+
uv pip install langroid
213+
```
214+
215+
#### Using pip with venv (Alternative)
216+
217+
```bash
218+
# Navigate to the backend directory
219+
cd backend
220+
221+
# Create virtual environment
222+
python -m venv venv
223+
224+
# Activate virtual environment
225+
# On macOS/Linux:
226+
source venv/bin/activate
227+
# On Windows:
228+
# venv\Scripts\activate
229+
230+
# Install dependencies
231+
pip install -r requirements.txt
232+
pip install langroid
233+
```
193234

194235
### Setup
195236

@@ -216,8 +257,14 @@ If you prefer to run each component separately or if `run.sh` doesn't work on yo
216257
1. **Backend** (in one terminal):
217258
```bash
218259
cd backend
219-
pip install -r requirements.txt
220-
python main.py
260+
261+
# If using UV:
262+
uv run python main.py
263+
264+
# If using venv:
265+
# source venv/bin/activate # On macOS/Linux
266+
# venv\Scripts\activate # On Windows
267+
# python main.py
221268
```
222269

223270
2. **Frontend** (in another terminal):

run.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ sleep 2
1919
# Start backend
2020
echo -e "${BLUE}Starting backend server...${NC}"
2121
cd backend
22-
python main.py &
22+
23+
# Check if UV is available and use it if present
24+
if command -v uv &> /dev/null; then
25+
echo "Using UV to run backend..."
26+
uv run python main.py &
27+
else
28+
echo "UV not found, using Python directly..."
29+
python main.py &
30+
fi
31+
2332
BACKEND_PID=$!
2433
echo "Backend PID: $BACKEND_PID"
2534

0 commit comments

Comments
 (0)