Skip to content

Commit 85d2a83

Browse files
chore: align CI and dev setup through makefile (#256)
1 parent 33f9ee6 commit 85d2a83

22 files changed

+312
-269
lines changed

.github/workflows/python-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
run: |
2626
python -m pip install --upgrade pip
2727
pip install uv
28-
uv sync --only-dev
28+
make sync-dev
2929
3030
- name: Run pre-commit
3131
run: |
32-
uv run pre-commit run --all-files
32+
make pre-commit
3333
3434
service-tests:
3535
name: Service Tests
@@ -53,15 +53,15 @@ jobs:
5353
run: |
5454
python -m pip install --upgrade pip
5555
pip install uv
56-
uv sync --all-extras
56+
make sync
5757
5858
- name: Install agent-memory-client
5959
run: |
6060
uv pip install -e ./agent-memory-client
6161
6262
- name: Run service tests
6363
run: |
64-
uv run pytest --run-api-tests
64+
make test-api
6565
env:
6666
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
6767

@@ -91,12 +91,12 @@ jobs:
9191
run: |
9292
python -m pip install --upgrade pip
9393
pip install uv
94-
uv sync --all-extras
94+
make sync
9595
9696
- name: Install agent-memory-client
9797
run: |
9898
uv pip install -e ./agent-memory-client
9999
100100
- name: Run tests
101101
run: |
102-
uv run pytest
102+
make test

.github/workflows/test-fork-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ jobs:
8989
run: |
9090
python -m pip install --upgrade pip
9191
pip install uv
92-
uv sync --all-extras
92+
make sync
9393
9494
- name: Install agent-memory-client
9595
run: |
9696
uv pip install -e ./agent-memory-client
9797
9898
- name: Run service tests
9999
run: |
100-
uv run pytest --run-api-tests
100+
make test-api
101101
env:
102102
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
103103

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.3.2 # Use the latest version
3+
rev: v0.14.8
44
hooks:
55
# Run the linter
66
- id: ruff

AGENTS.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ Do not use Redis Stack or other earlier versions of Redis.
1010
Get started in a new environment by installing `uv`:
1111
```bash
1212
pip install uv # Install uv (once)
13-
uv venv # Create a virtualenv (once)
14-
uv install --all-extras # Install dependencies
15-
uv sync --all-extras # Sync latest dependencies
13+
make setup # Create .venv, sync deps, install pre-commit hooks
14+
make sync # Sync latest dependencies
1615
```
1716

1817
### Activate the virtual environment
@@ -29,14 +28,15 @@ code basepassing to commit.
2928
Run all tests like this, including tests that require API keys in the
3029
environment:
3130
```bash
32-
uv run pytest --run-api-tests
31+
make test-api
3332
```
3433

3534
### Linting
3635

3736
```bash
38-
uv run ruff check # Run linting
39-
uv run ruff format # Format code
37+
make pre-commit # Run the exact formatting/lint hooks used in CI
38+
make verify # Run full local verification (pre-commit + API tests)
39+
```
4040

4141
### Managing Dependencies
4242
uv add <dependency> # Add a dependency to pyproject.toml and update lock file
@@ -70,8 +70,7 @@ docker-compose down # Stop all services
7070
IMPORTANT: This project uses `pre-commit`. You should run `pre-commit`
7171
before committing:
7272
```bash
73-
uv run pre-commit install # Install the hooks first
74-
uv run pre-commit run --all-files
73+
make pre-commit
7574
```
7675

7776
## Important Architectural Patterns
@@ -130,11 +129,11 @@ Always use RedisVL query types for any search operations. This is a project requ
130129

131130
The project uses `pytest` with `testcontainers` for Redis integration testing:
132131

133-
- `uv run pytest` - Run all tests
134-
- `uv run pytest tests/unit/` - Unit tests only
135-
- `uv run pytest tests/integration/` - Integration tests (require Redis)
136-
- `uv run pytest -v` - Verbose output
137-
- `uv run pytest --cov` - With coverage
132+
- `make test` - Run the standard test suite
133+
- `make test-api` - Run all tests including API-key-dependent tests
134+
- `make test-unit` - Unit tests only
135+
- `make test-integration` - Integration tests (require Redis)
136+
- `make test-cov` - Run tests with coverage
138137

139138
## Project Structure
140139

@@ -246,11 +245,11 @@ ENABLE_NER=true
246245
## Development Workflow
247246

248247
0. **Install uv**: `pip install uv` to get started with uv
249-
1. **Setup**: `uv install` to install dependencies
248+
1. **Setup**: `make setup`
250249
2. **Redis**: Start Redis Stack via `docker-compose up redis`
251250
3. **Development**: Use `DISABLE_AUTH=true` for local testing
252-
4. **Testing**: Run `uv run pytest` before committing
253-
5. **Linting**: Pre-commit hooks handle code formatting
251+
4. **Testing**: Run `make verify` before committing
252+
5. **Linting**: `make pre-commit` matches the CI lint gate exactly
254253
6. **Background Tasks**: Start worker with `uv run agent-memory task-worker`
255254

256255
## Documentation

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help setup sync lint format test test-api pre-commit clean server mcp worker
1+
.PHONY: help setup sync sync-dev lint format test test-api test-unit test-integration test-cov pre-commit verify clean server mcp mcp-sse worker rebuild-index migrate
22

33
help: ## Show this help message
44
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
@@ -7,12 +7,15 @@ help: ## Show this help message
77
setup: ## Initial setup: create virtualenv and install dependencies
88
pip install uv
99
uv venv
10-
uv sync --all-extras
10+
$(MAKE) sync
1111
uv run pre-commit install
1212

1313
sync: ## Sync dependencies from lock file
1414
uv sync --all-extras
1515

16+
sync-dev: ## Sync development dependencies only
17+
uv sync --only-dev
18+
1619
# Code quality
1720
lint: ## Run linting checks (ruff)
1821
uv run ruff check .
@@ -24,11 +27,15 @@ format: ## Format code (ruff)
2427
pre-commit: ## Run all pre-commit hooks
2528
uv run pre-commit run --all-files
2629

30+
verify: ## Run the full local verification flow used by CI (requires OPENAI_API_KEY for API tests)
31+
$(MAKE) pre-commit
32+
$(MAKE) test-api
33+
2734
# Testing
28-
test: ## Run tests (excludes API tests requiring keys)
35+
test: ## Run tests (matches the general CI test job; excludes API-key-dependent tests)
2936
uv run pytest
3037

31-
test-api: ## Run all tests including API tests (requires OPENAI_API_KEY)
38+
test-api: ## Run all tests including API tests (matches the CI service-tests job; requires OPENAI_API_KEY)
3239
uv run pytest --run-api-tests
3340

3441
test-unit: ## Run only unit tests

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,20 +285,23 @@ Working Memory (Session-scoped) → Long-term Memory (Persistent)
285285
## Development
286286

287287
```bash
288-
# Install dependencies
289-
uv sync --all-extras
288+
# Initial setup
289+
make setup
290290

291-
# Run tests
292-
uv run pytest
291+
# Full local verification (matches CI lint + service tests)
292+
make verify
293293

294-
# Format code
295-
uv run ruff format
296-
uv run ruff check
294+
# Or run individual layers
295+
make pre-commit
296+
make test
297+
make test-api
297298

298299
# Start development stack (choose one based on your needs)
299300
docker compose up api redis # Development mode
300301
docker compose up api task-worker redis mcp # Production-like mode
301302
```
303+
304+
`make verify` requires `OPENAI_API_KEY` because it runs `make test-api`.
302305
## License
303306

304307
Apache License 2.0 - see [LICENSE](LICENSE) file for details.

agent-memory-client/tests/test_tool_schemas.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ def test_creation_and_editing_tools_exclude_message_type(self):
198198
memory_type_prop = params["properties"]["memory_type"]
199199
if "enum" in memory_type_prop:
200200
if function_name in restricted_tools:
201-
assert (
202-
"message" not in memory_type_prop["enum"]
203-
), f"Creation/editing tool '{function_name}' should not expose 'message' memory type"
201+
assert "message" not in memory_type_prop["enum"], (
202+
f"Creation/editing tool '{function_name}' should not expose 'message' memory type"
203+
)
204204
elif function_name in allowed_tools:
205205
# These tools are allowed to have message in enum for filtering
206206
pass
@@ -215,9 +215,9 @@ def test_creation_and_editing_tools_exclude_message_type(self):
215215
and function_name in restricted_tools
216216
):
217217
memory_type_prop = items["properties"]["memory_type"]
218-
assert (
219-
"message" not in memory_type_prop["enum"]
220-
), f"Creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
218+
assert "message" not in memory_type_prop["enum"], (
219+
f"Creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
220+
)
221221

222222

223223
class TestAnthropicSchemas:
@@ -292,9 +292,9 @@ def test_anthropic_schemas_exclude_message_type_for_creation(self):
292292
memory_type_prop = params["properties"]["memory_type"]
293293
if "enum" in memory_type_prop:
294294
if function_name in restricted_tools:
295-
assert (
296-
"message" not in memory_type_prop["enum"]
297-
), f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type"
295+
assert "message" not in memory_type_prop["enum"], (
296+
f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type"
297+
)
298298
elif function_name in allowed_tools:
299299
# These tools are allowed to have message in enum for filtering
300300
pass
@@ -309,9 +309,9 @@ def test_anthropic_schemas_exclude_message_type_for_creation(self):
309309
and function_name in restricted_tools
310310
):
311311
memory_type_prop = items["properties"]["memory_type"]
312-
assert (
313-
"message" not in memory_type_prop["enum"]
314-
), f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
312+
assert "message" not in memory_type_prop["enum"], (
313+
f"Anthropic creation/editing tool '{function_name}' should not expose 'message' memory type in nested properties"
314+
)
315315

316316

317317
class TestToolSchemaCustomization:

docs/development.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44

55
Start by creating a virtual environment and installing dependencies with uv:
66
```bash
7-
# Create and activate a virtual environment
8-
uv venv
7+
make setup
98
source .venv/bin/activate
10-
11-
# Install dependencies (including optional groups used in development)
12-
uv sync --all-extras
139
```
1410

1511
Use Docker Compose from the repository root:
@@ -25,22 +21,29 @@ docker compose up api task-worker redis mcp
2521
## Running Tests
2622

2723
```bash
28-
uv run pytest
24+
make test
2925
```
3026

3127
Run API-key-dependent tests as well:
3228

3329
```bash
34-
uv run pytest --run-api-tests
30+
make test-api
3531
```
3632

3733
## Linting and formatting
3834

3935
```bash
40-
uv run ruff check
41-
uv run ruff format
36+
make pre-commit
37+
```
38+
39+
For the full local check used in CI, run:
40+
41+
```bash
42+
make verify
4243
```
4344

45+
`make verify` requires `OPENAI_API_KEY` because it runs the API-key-dependent test suite.
46+
4447
## Contributing
4548

4649
1. Fork the repository

0 commit comments

Comments
 (0)