docs: improve CLI dev workflow and prioritize Node.js installation (#4579)
This commit is contained in:
+64
-33
@@ -3,8 +3,7 @@
|
||||
## Prerequisites
|
||||
|
||||
- Python **3.10+**
|
||||
|
||||
## Setup
|
||||
- `make` (optional — you can use plain Python commands instead)
|
||||
|
||||
All commands below should be run from the `python/` directory:
|
||||
|
||||
@@ -12,7 +11,21 @@ All commands below should be run from the `python/` directory:
|
||||
cd python
|
||||
```
|
||||
|
||||
## Install local (editable) + run
|
||||
## Setup
|
||||
|
||||
### Using Make (recommended)
|
||||
|
||||
All `make` targets automatically create a virtual environment (`.venv/`) and install the required dependencies — no manual setup needed.
|
||||
|
||||
```bash
|
||||
# Install the CLI in editable mode
|
||||
make install
|
||||
|
||||
# Install with dev tools (tests + linting)
|
||||
make dev
|
||||
```
|
||||
|
||||
### Using Python directly
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
@@ -22,43 +35,32 @@ python -m pip install -U pip
|
||||
# Install in editable mode
|
||||
pip install -e .
|
||||
|
||||
# Run
|
||||
mem0 --help
|
||||
mem0 version
|
||||
```
|
||||
|
||||
> **After moving to the new directory structure:** If you previously had the CLI installed from the old repo root, you need to re-run `pip install -e .` from inside the `python/` directory to pick up the new location.
|
||||
|
||||
## Run without installing globally
|
||||
|
||||
This still installs the package into your active virtualenv (editable), but you can invoke it via module execution:
|
||||
|
||||
```bash
|
||||
source .venv/bin/activate
|
||||
pip install -e .
|
||||
python -m mem0_cli --help
|
||||
```
|
||||
|
||||
## Optional extras
|
||||
|
||||
### OSS integration extras
|
||||
|
||||
```bash
|
||||
pip install -e ".[oss]"
|
||||
```
|
||||
|
||||
### Dev tools (tests/lint)
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
pip install -e ".[dev]"
|
||||
# Using Make
|
||||
make test
|
||||
|
||||
# Run all tests
|
||||
# Using Python directly
|
||||
pytest
|
||||
|
||||
# Run a specific test file
|
||||
@@ -68,9 +70,38 @@ pytest tests/test_cli_integration.py
|
||||
pytest -k test_help
|
||||
```
|
||||
|
||||
## Run the CLI
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
# Using Make
|
||||
make lint # check only
|
||||
make format # auto-fix
|
||||
|
||||
# Using Python directly (with venv activated)
|
||||
ruff check .
|
||||
ruff format .
|
||||
```
|
||||
|
||||
## Optional extras
|
||||
|
||||
### OSS integration
|
||||
|
||||
```bash
|
||||
pip install -e ".[oss]"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user