Thank you for your interest in contributing to Memori!
This repository contains:
memori/- Python SDKmemori-ts/- TypeScript SDK (including BYODB via Rust native bindings)
We use uv for fast dependency management and Docker for integration testing. You can develop locally or use our Docker environment.
- Python 3.10+ (3.12 recommended)
- uv - Fast Python package installer
- Docker and Docker Compose (for integration tests)
- Make
- Node.js 20+
- npm
Both SDKs share the Rust core (core/).
Install Rust (rustup, cargo) when you are:
- changing code in
core/ - working on
core/bindings/python - working on
core/bindings/nodeor TypeScript BYODB native flows
If you are only changing pure Python SDK code (outside Rust/bindings), Rust is not required.
Linux/Mac:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"# Clone the repository
git clone https://github.com/MemoriLabs/Memori.git
cd Memori
# Install dependencies
uv sync
# Install pre-commit hooks
uv run pre-commit install
# Run unit tests
uv run pytest# Clone the repository
git clone https://github.com/MemoriLabs/Memori.git
cd Memori
# Python deps
uv sync
uv run pre-commit install
# TypeScript deps
cd memori-ts && npm ci && cd ..
# Node native-binding deps (needed for sync-native)
cd core/bindings/node && npm ci && cd ../..# Copy the example environment file
cp .env.example .env
# Edit .env and add your API keys (optional for unit tests)
# Required for integration tests: OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY
# Start the environment
make dev-upThis will:
- Build the Docker container with Python 3.12
- Install all dependencies with uv
- Start PostgreSQL, MySQL, and MongoDB for integration tests
- Start Mongo Express (web UI for MongoDB at http://localhost:8081)
# Run unit tests
uv run pytest
# Format code
uv run ruff format .
# Check linting
uv run ruff check .
# Run with coverage
uv run pytest --cov=memori
# Run security scans
uv run bandit -r memori -ll -ii
uv run pip-audit --require-hashes --disable-pip || true# Enter the development container
make dev-shell
# Run unit tests (fast, no external dependencies)
make test
# Initialize database schemas
make init-postgres # PostgreSQL
make init-mysql # MySQL
make init-oceanbase # OceanBase
make init-mongodb # MongoDB
make init-sqlite # SQLite
# Run a specific integration test script
make run-integration FILE=tests/llm/clients/oss/openai/async.py
# Format code
make format
# Check linting
make lint
# Run security scans
make security
# Stop the environment
make dev-down
# Clean up everything (containers, volumes, cache)
make cleancd memori-ts
# Install Node dependencies
npm ci
# Unit tests (native module is mocked; Rust not required)
npm test
# Lint + type/build checks
npm run lint
npm run buildcd memori-ts
# Build Rust N-API bindings and sync artifacts into memori-ts/src/native and dist/native
npm run sync-native
# Native + TypeScript build (used by examples)
npm run build:devNotes:
sync-nativeis the explicit native step for TypeScript BYODB.- Rust is required for
sync-native/build:dev, but not for regular unit tests. - For short-lived BYODB scripts, call
await mem.augmentation.wait()before exit to ensure all background writes complete.
We use pytest with coverage reporting and pytest-mock for mocking.
Unit tests use mocks and run without external dependencies:
# Local
uv run pytest
# Docker
make testIntegration tests require:
- Database instances (PostgreSQL, MySQL, MongoDB, or SQLite)
- LLM API keys (OpenAI, Anthropic, Google)
# Set API keys in .env first
# OPENAI_API_KEY=sk-...
# ANTHROPIC_API_KEY=sk-ant-...
# GOOGLE_API_KEY=...
# Initialize database schema
make init-postgres # or init-mysql, init-oceanbase, init-mongodb, init-sqlite
# Run integration test scripts
make run-integration FILE=tests/llm/clients/oss/openai/sync.pyWe maintain high test coverage. Coverage reports are generated automatically:
- Terminal output (summary)
- HTML report in
htmlcov/ - XML report in
coverage.xml
View HTML coverage:
open htmlcov/index.html # macOS
xdg-open htmlcov/index.html # LinuxLinux/Mac:
# If curl command fails, try pip instead
pip install uv
# Verify installation
uv --versionWindows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# Verify
uv --versionError: No solution found
# Clear cache and retry
uv cache clean
uv sync
# Check Python version (must be 3.10+)
python --versionError: Permission denied
# Fix directory ownership (Linux/Mac)
sudo chown -R $USER ~/.cache/uv
sudo chown -R $USER .venv
# OR reinstall uv in user-writable location
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows — fix cache permissions
icacls .venv /grant %USERNAME%:FError: Cannot connect to Docker daemon
# Linux
sudo systemctl start docker
# Mac/Windows — open Docker Desktop app first
# Verify Docker is running
docker psError: Port already in use
# Windows
netstat -ano | findstr :8081
# Linux/Mac
lsof -i :8081
# Then stop that process or change port in docker-compose.ymlError: Ruff formatting issues
# Auto-fix formatting
uv run ruff format .
# Auto-fix linting
uv run ruff check --fix .
# Retry commit
git commit -m "your message"Error: pre-commit command not found
# Reinstall hooks
uv run pre-commit install
# Run manually
uv run pre-commit run --all-filesError: cargo not found
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Reload terminal then verify
rustc --version
cargo --versionError: Rust version too old
# Update Rust
rustup update stableError: Module not found
# Reinstall dependencies
uv sync
# Always run pytest via uv
uv run pytestError: API key missing
(integration tests only — not needed for unit tests)
# Only needed when running integration tests:
cp .env.example .env
# Add keys:
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...
# Then run integration tests:
make run-integration FILE=tests/llm/clients/oss/openai/sync.pyError: npm ci fails
# Check Node version (must be 20+)
node --version
# Clear cache and retry
npm cache clean --force
cd memori-ts && npm ciError: Native module not found
# Build Rust bindings first
cd memori-ts
npm run sync-native- Search existing issues for your error
- Open a new issue with:
- Your OS and Python version (
python --version) - Full error message
- Steps you already tried
- Your OS and Python version (
📦 Memori/
├── 📂 memori/ # Python SDK source
│ ├── 📂 llm/ # LLM provider integrations
│ ├── 📂 memory/ # Memory system
│ ├── 📂 storage/ # Storage adapters
│ ├── 📂 api/ # API client
│ ├── 🐍 __init__.py # Main class & public API
│ └── 🏷️ py.typed # PEP 561 marker
├── 📂 tests/
│ ├── 📂 build/ # DB initialization scripts
│ ├── 📂 llm/ # LLM tests
│ ├── 📂 memory/ # Memory tests
│ └── 📂 storage/ # Storage tests
├── 🐍 conftest.py # Pytest fixtures
├── ⚙️ pyproject.toml # Project metadata
├── 🔒 uv.lock # Locked dependencies
└── 📝 CHANGELOG.md # Version history
We use Ruff for linting and formatting (configured in pyproject.toml):
# Format code
uv run ruff format . # or: make format
# Check linting
uv run ruff check . # or: make lint
# Auto-fix issues
uv run ruff check --fix .
# Run security scans (Bandit + pip-audit)
uv run bandit -r memori -ll -ii
uv run pip-audit --require-hashes --disable-pip || trueWe use pre-commit to automatically format and lint code:
# Install hooks (one-time setup)
uv run pre-commit install
# Run manually
uv run pre-commit run --all-files- Follow PEP 8 standards
- Line length: 88 characters (Black-compatible)
- Python 3.10+ syntax (use modern type hints)
- All public APIs must have type hints
- Lean, simple code preferred over complex solutions (KISS, YAGNI)
- Minimize unnecessary comments - code should be self-documenting
- Fork and branch: Create a feature branch from
main - Write tests: Add/update tests for your changes
- Pass all checks: Ensure tests, linting, and formatting pass
- Update docs: Update README or docs if adding features
- Changelog: Add entry to CHANGELOG.md under "Unreleased"
- Atomic commits: Keep commits focused and well-described
If your PR touches memori-ts/, run and verify:
cd memori-ts
npm test
npm run lint
npm run build- OpenAI (sync/async, streaming)
- Anthropic Claude (sync/async, streaming)
- Google Gemini (sync/async, streaming)
- AWS Bedrock
- Agno
- LangChain
- PostgreSQL (via psycopg2, psycopg3)
- MySQL / MariaDB (via pymysql)
- MongoDB (via pymongo)
- Oracle (via cx_Oracle, python-oracledb)
- SQLite (stdlib)
- CockroachDB
- Neon, Supabase (PostgreSQL-compatible)
- Django ORM
- DB-API 2.0 compatible connections
Memori provides CLI commands for managing your account and quota:
The CLI uses exported environment variables first, then fills missing values from a .env file in the directory where you run the command.
# Check your API quota
python3 -m memori quota
# Sign up for Memori Advanced Augmentation
python3 -m memori sign-up <email_address>These commands help you:
- Monitor your memory quota and usage
- Sign up for increased limits (always free for developers)
- Obtain API keys for Advanced Augmentation features
- Docker files (Dockerfile, docker-compose.yml, Makefile) are for development only
- They are NOT included in the PyPI package
- The SDK has minimal runtime dependencies - fully self-contained
- Development dependencies (LLM clients, database drivers) are in
[dependency-groups]

