Development Setup
This guide walks you through setting up a local development environment for working on the Memori codebase. Follow these steps to clone the repository, install dependencies, and run the test suite.
Want a zero-setup option? The Memori Cloud at app.memorilabs.ai.
Prerequisites
Before you begin, make sure you have the following installed on your system:
- Python 3.10 or higher — Memori requires Python 3.10+. Check your version with
python --version. - git — For cloning the repository and managing branches.
- pip — Python's package manager (usually included with Python).
Clone the Repository
Start by forking the repository on GitHub, then clone your fork locally:
git clone https://github.com/YOUR_USERNAME/Memori.git
cd Memori
If you plan to submit a pull request, make sure to keep your fork synced with the upstream repository:
git remote add upstream https://github.com/MemoriLabs/Memori.git
git fetch upstream
Install Dependencies
It is recommended to use a virtual environment to avoid conflicts with other Python projects:
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
Once your virtual environment is active, install Memori with development dependencies:
pip install -e ".[dev]"
This installs Memori in editable mode (-e) so that changes you make to the source code are immediately reflected without reinstalling. The [dev] extra includes testing and linting tools.
If the project uses a requirements-dev.txt file instead, install with:
pip install -e .
pip install -r requirements-dev.txt
Running Tests
Memori uses pytest for its test suite. Run all tests from the project root:
pytest
To run tests with verbose output:
pytest -v
To run a specific test file or test function:
# Run all tests in a specific file
pytest tests/test_openai.py
# Run a specific test function
pytest tests/test_openai.py::test_sync_completion
To run tests with coverage reporting:
pytest --cov=memori --cov-report=term-missing
Local Development Workflow
Here is a typical workflow for making changes to Memori:
-
Create a branch for your feature or fix:
git checkout -b feat/my-new-feature -
Make your changes — Edit the source code in the
memori/directory. -
Write tests — Add or update tests in the
tests/directory to cover your changes. -
Run the tests to make sure nothing is broken:
pytest -
Check code style — The project uses Ruff for linting and formatting:
# Lint ruff check . # Format ruff format --check . -
Commit your changes with a descriptive message:
git add . git commit -m "feat: add support for Redis storage backend" -
Push to your fork and open a pull request:
git push origin feat/my-new-feature
Project Structure
Here is a high-level overview of the Memori repository structure:
| Directory | Purpose |
|---|---|
memori/ | Core library source code |
tests/ | Test suite (pytest) |
docs/ | Documentation source files |
examples/ | Example scripts and usage demos |
The core integration logic for each LLM provider typically lives in separate modules within the memori/ directory. When adding support for a new provider, look at existing integrations (such as OpenAI or Anthropic) as templates.