mem0/docs/contributing/development.mdx

93 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

2025-03-04 15:47:38 +05:30
---
title: Development
description: "Guide to contributing code to Mem0, covering the fork and clone workflow, PR submission, and code quality checks."
2025-03-04 15:47:38 +05:30
icon: "code"
---
# Development Contributions
We strive to make contributions **easy, collaborative, and enjoyable**. Follow the steps below to ensure a smooth contribution process.
## Submitting Your Contribution through PR
To contribute, follow these steps:
1. **Fork & Clone** the repository: [Mem0 on GitHub](https://github.com/mem0ai/mem0)
2. **Create a Feature Branch**: Use a dedicated branch for your changes, e.g., `feature/my-new-feature`
3. **Implement Changes**: If adding a feature or fixing a bug, ensure to:
- Write necessary **tests**
- Add **documentation, docstrings, and runnable examples**
4. **Code Quality Checks**:
- Run **linting** to catch style issues
- Ensure **all tests pass**
2025-09-30 08:41:36 -07:00
5. **Submit a Pull Request**
2025-03-04 15:47:38 +05:30
For detailed guidance on pull requests, refer to [GitHub's documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
---
2025-09-30 08:41:36 -07:00
## Dependency Management
2025-03-04 15:47:38 +05:30
We use `hatch` as our package manager. Install it by following the [official instructions](https://hatch.pypa.io/latest/install/).
2025-03-04 15:47:38 +05:30
2025-09-30 08:41:36 -07:00
**Do NOT use `pip` or `conda` for dependency management.** Instead, follow these steps in order:
2025-03-04 15:47:38 +05:30
```bash
# 1. Install base dependencies
make install
2025-09-30 08:41:36 -07:00
# 2. Activate virtual environment (this will install dependencies)
hatch shell # For default environment
hatch -e dev_py_3_11 shell # For dev_py_3_11 (differences are mentioned in pyproject.toml)
2025-03-04 15:47:38 +05:30
# 3. Install all optional dependencies
make install_all
2025-03-04 15:47:38 +05:30
```
---
2025-09-30 08:41:36 -07:00
## Development Standards
2025-03-04 15:47:38 +05:30
2025-09-30 08:41:36 -07:00
### Pre-commit Hooks
2025-03-04 15:47:38 +05:30
Ensure `pre-commit` is installed before contributing:
```bash
pre-commit install
```
2025-09-30 08:41:36 -07:00
### Linting with `ruff`
2025-03-04 15:47:38 +05:30
Run the linter and fix any reported issues before submitting your PR:
```bash
make lint
```
2025-09-30 08:41:36 -07:00
### Code Formatting
2025-03-04 15:47:38 +05:30
To maintain a consistent code style, format your code:
2025-03-04 15:47:38 +05:30
```bash
make format
```
2025-09-30 08:41:36 -07:00
### Testing with `pytest`
2025-03-04 15:47:38 +05:30
Run tests to verify functionality before submitting your PR:
```bash
make test
```
2025-09-30 08:41:36 -07:00
**Note:** Some dependencies have been removed from the main dependencies to reduce package size. Run `make install_all` to install necessary dependencies before running tests.
2025-03-04 15:47:38 +05:30
---
2025-09-30 08:41:36 -07:00
## Release Process
2025-03-04 15:47:38 +05:30
Currently, releases are handled manually. We aim for frequent releases, typically when new features or bug fixes are introduced.
---
2025-09-30 08:41:36 -07:00
Thank you for contributing to Mem0!