Files
mem0ai--mem0/cli/python/development.md
T
wehub-resource-sync 555e282cc4
ci / changelog_check (push) Waiting to run
ci / check_changes (push) Waiting to run
ci / build_mem0 (3.10) (push) Blocked by required conditions
ci / build_mem0 (3.11) (push) Blocked by required conditions
ci / build_mem0 (3.12) (push) Blocked by required conditions
CLI Node CI / lint (push) Waiting to run
CLI Node CI / test (20) (push) Waiting to run
CLI Node CI / test (22) (push) Waiting to run
CLI Node CI / build (push) Waiting to run
CLI Python CI / lint (push) Waiting to run
CLI Python CI / test (3.10) (push) Waiting to run
CLI Python CI / test (3.11) (push) Waiting to run
CLI Python CI / test (3.12) (push) Waiting to run
CLI Python CI / build (push) Waiting to run
openclaw checks / lint (push) Waiting to run
openclaw checks / test (20) (push) Waiting to run
openclaw checks / test (22) (push) Waiting to run
openclaw checks / build (push) Waiting to run
opencode-plugin checks / build (push) Waiting to run
pi-agent-plugin checks / lint (push) Waiting to run
pi-agent-plugin checks / test (20) (push) Waiting to run
pi-agent-plugin checks / test (22) (push) Waiting to run
pi-agent-plugin checks / build (push) Waiting to run
TypeScript SDK CI / check_changes (push) Waiting to run
TypeScript SDK CI / changelog_check (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / build_ts_sdk (22) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (20) (push) Blocked by required conditions
TypeScript SDK CI / integration_ts_sdk (22) (push) Blocked by required conditions
chore: import upstream snapshot with attribution
2026-07-13 13:03:45 +08:00

2.2 KiB

Development

Prerequisites

  • Python 3.10+
  • make (optional — you can use plain Python commands instead)

All commands below should be run from the python/ directory:

cd python

Setup

All make targets automatically create a virtual environment (.venv/) and install the required dependencies — no manual setup needed.

# Install the CLI in editable mode
make install

# Install with dev tools (tests + linting)
make dev

Using Python directly

python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip

# Install in editable mode
pip install -e .

# With dev tools
pip install -e ".[dev]"

Make targets

Target Description
make install Create venv and install the CLI (editable mode)
make dev Create venv and install CLI + dev dependencies
make test Run all tests (installs dev deps if needed)
make lint Run linter and format check
make format Auto-fix lint issues and format code
make build Build distribution packages
make clean Remove dist/
make publish Build and publish to PyPI
make publish-test Build and publish to Test PyPI
make shell Open a new shell with the venv activated

Run tests

# Using Make
make test

# Using Python directly
pytest

# Run a specific test file
pytest tests/test_cli_integration.py

# Run a single test
pytest -k test_help

Run the CLI

# Using Make — drop into an activated shell
make shell
mem0 --help

# Using Python directly (with venv activated)
source .venv/bin/activate
mem0 --help
mem0 version

# Or run without activating
.venv/bin/mem0 --help

Lint

# Using Make
make lint      # check only
make format    # auto-fix

# Using Python directly (with venv activated)
ruff check .
ruff format .

Optional extras

OSS integration

pip install -e ".[oss]"