Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ COPY . .
# Set up venv + install dev deps
RUN uv venv .venv --python=3.10 && \
. .venv/bin/activate && \
uv pip install -e ".[dev]" && \
pip install pre-commit mypy && \
pre-commit install
uv sync --all-extras && \
uv pip install pre-commit mypy && \
uv run pre-commit install

# Keep container alive for development
CMD ["tail", "-f", "/dev/null"]
9 changes: 6 additions & 3 deletions .container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ docker compose exec oasis bash

You’ll now be inside the oasis dev environment.

From here, you can activate your virtual environment (if used) and run tests:
From here, you can activate your virtual environment and run tests:

```bash
# Activate the virtual environment
source .venv/bin/activate

# Any other dev/test command
pytest
pre-commit run --all-files
uv run pytest
uv run pre-commit run --all-files
```

## Save Your Progress
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ jobs:
uses: actions/checkout@v2

- name: Set up Python 3.10.11
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.10.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"

- name: Install pre-commit
- name: Install dependencies
run: |
pip install pre-commit
uv sync --all-extras

- name: Run pre-commit
run: |
pre-commit run --all-files
uv run pre-commit run --all-files

- name: Run tests
env:
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
run: |
pytest
uv run pytest
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ ENV/
env.bak/
venv.bak/

# uv
.python-version
uv.lock

# IDEs and editors
.idea/
.vscode/
Expand Down
20 changes: 7 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -242,29 +242,23 @@ git clone https://github.com/camel-ai/oasis.git
# Change directory into project directory
cd oasis

# Activate oasis virtual environment
poetry shell

# Install oasis from source
poetry install
# Create and activate virtual environment, install dependencies
uv sync --all-extras

# The following command installs a pre-commit hook into the local git repo,
# so every commit gets auto-formatted and linted.
pre-commit install
uv run pre-commit install

# Run oasis's pre-commit before push
pre-commit run --all-files
uv run pre-commit run --all-files

# Run oasis's unit tests
pytest test

# Exit the virtual environment
exit
uv run pytest test
```

These commands will install all the necessary dependencies for running the package, examples, linting, formatting, tests, and coverage.

To verify that everything is set up correctly, run `pytest .` This will ensure that all tests pass successfully. ✅
To verify that everything is set up correctly, run `uv run pytest .` This will ensure that all tests pass successfully. ✅

> \[!TIP\]
> You need to config OPENAI API Keys as environment variables to pass all tests.
Expand All @@ -273,7 +267,7 @@ To verify that everything is set up correctly, run `pytest .` This will ensure t

### Update dependencies

Whenever you add, update, or delete any dependencies in `pyproject.toml`, please run `poetry lock` to synchronize the dependencies with the lock file.
Whenever you add, update, or delete any dependencies in `pyproject.toml`, please run `uv sync` to synchronize the dependencies with the lock file.

### Coverage 📊

Expand Down
19 changes: 14 additions & 5 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
title: 'Quickstart'
description: 'Start using OASIS for social simulations in under 5 minutes'
title: "Quickstart"
description: "Start using OASIS for social simulations in under 5 minutes"
---

## Setup your environment

Learn how to set up OASIS and run your first social simulation.

### Installation

You can install OASIS in two ways:

<AccordionGroup>
Expand All @@ -16,14 +17,18 @@ You can install OASIS in two ways:
pip install camel-oasis
```
</Accordion>
<Accordion icon="github" title="Option 2: Clone the repository">
<Accordion icon="github" title="Option 2: Clone the repository (for development)">
```bash
git clone https://github.com/camel-ai/oasis.git
cd oasis

pip install --upgrade pip setuptools
pip install -e . # This will install dependencies as specified in pyproject.toml
# Install UV if not already installed
pip install uv

# Install dependencies and project in development mode
uv sync --all-extras
```

</Accordion>
</AccordionGroup>

Expand Down Expand Up @@ -54,6 +59,7 @@ OASIS supports different types of LLM backends for running simulations. Choose t
$env:OPENAI_API_KEY="<insert your OpenAI API key>"
$env:OPENAI_API_BASE_URL="<insert your OpenAI API BASE URL>" # Optional: for proxy services
```

</Accordion>
<Accordion icon="face-smile" title="Prepare the user profiles">
If you install with `pip`, download [this file](https://github.com/camel-ai/oasis/blob/main/data/reddit/user_data_36.json) to your own `./data/reddit/user_data_36.json` directory.
Expand Down Expand Up @@ -153,6 +159,7 @@ OASIS supports different types of LLM backends for running simulations. Choose t
asyncio.run(main())
```
This will start a simulation of user interactions in a Reddit-like environment.

</Accordion>
</AccordionGroup>

Expand Down Expand Up @@ -185,6 +192,7 @@ OASIS supports different types of LLM backends for running simulations. Choose t
```bash
curl http://$ip:$port/v1/models
```

</Accordion>
<Accordion icon="play" title="Run a Twitter simulation with local models">
1. Edit or write the `scripts/environment/twitter_simulation.py` file to use your VLLM deployment:
Expand Down Expand Up @@ -299,5 +307,6 @@ OASIS supports different types of LLM backends for running simulations. Choose t
if __name__ == "__main__":
asyncio.run(main())
```

</Accordion>
</AccordionGroup>
8 changes: 4 additions & 4 deletions examples/experiment/user_generation_visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ python generator/reddit/user_generate.py
The Twitter users are further enhanced based on the information we have crawled. The steps to run are as follows:

```bash
pip install -r generator/twitter/requirement.txt
uv pip install -r generator/twitter/requirement.txt

python generator/twitter/gen.py

Expand Down Expand Up @@ -70,7 +70,7 @@ if __name__ == "__main__":
- Step 2:

```bash
pip install matplotlib
uv pip install matplotlib
```

- Step 3:
Expand Down Expand Up @@ -108,7 +108,7 @@ db_files = [
- Step 3:

```bash
pip install aiohttp
uv pip install aiohttp
```

- Step 4:
Expand Down Expand Up @@ -136,7 +136,7 @@ Open the instance and connect.
- Step 2:

```bash
pip install neo4j
uv pip install neo4j
```

- Step 3:
Expand Down
Loading