Skip to content

Commit 9dc520d

Browse files
Ki-SekiCaralHsi
andauthored
build: optimize dependencies management (#120)
* build: optimize dependencies management * build: drop deprecated sections * fix: correct typo and commands * refactor: optimize pyproject.toml * ci: add Python release testing workflow * build: optimize version constraints and optional groups * fix: update patch paths for SentenceChunker and QdrantClient in tests * ci: enhance dependency and building test * docs: update installation instructions * fix: move ruff dependency to test group * fix: specify encoding * fix: refine wheel and sdist installation steps for OS-specific handling * fix: update Windows installation commands to use PowerShell syntax * chore: add comments for clarity in Python tests workflow * fix: report slowest tests * ci: support macos-13 as much as possible * fix: macos-13 testing * chore: add comments * chore: update comments in pyproject.toml * docs: support all platforms * fix: poetry update * fix: move scikit-learn and qdrant-client * docs: clarify optional dependencies --------- Co-authored-by: CaralHsi <[email protected]>
1 parent aa4f1f9 commit 9dc520d

File tree

23 files changed

+1812
-1132
lines changed

23 files changed

+1812
-1132
lines changed

.github/workflows/python-tests.yml

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
os:
2727
- "ubuntu-latest"
2828
- "windows-latest"
29+
- "macos-13"
2930
- "macos-14"
3031
- "macos-15"
3132
# Ref: https://docs.github.com/en/actions/how-tos/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job
@@ -46,13 +47,54 @@ jobs:
4647
with:
4748
python-version: ${{ matrix.python-version }}
4849
cache: 'poetry'
49-
- name: Install dependencies
50+
51+
# Dependency and building tests
52+
- name: Install main dependencies
53+
run: |
54+
poetry install --no-root --no-interaction
55+
- name: Check no top-level optional dependencies
56+
run: |
57+
poetry run python scripts/check_dependencies.py
58+
- name: Build sdist and wheel
59+
run: poetry build
60+
- name: Test wheel installation on Windows
61+
if: startsWith(matrix.os, 'windows')
62+
run: |
63+
Get-ChildItem dist/*.whl | ForEach-Object { pip install $_.FullName }
64+
pip uninstall -y memoryos
65+
- name: Test wheel installation on Linux / Mac
66+
if: ${{ !startsWith(matrix.os, 'windows') }}
67+
run: |
68+
pip install dist/*.whl
69+
pip uninstall -y memoryos
70+
- name: Test sdist installation on Windows
71+
if: startsWith(matrix.os, 'windows')
5072
run: |
51-
poetry install --no-interaction --with dev --with test
52-
- name: Test with ruff
73+
Get-ChildItem dist/*.tar.gz | ForEach-Object { pip install $_.FullName }
74+
pip uninstall -y memoryos
75+
- name: Test sdist installation on Linux / Mac
76+
if: ${{ !startsWith(matrix.os, 'windows') }}
77+
run: |
78+
pip install dist/*.tar.gz
79+
pip uninstall -y memoryos
80+
81+
# Ruff checks
82+
- name: Install test group dependencies
83+
run: |
84+
poetry install --no-interaction --with test
85+
- name: Ruff checks
5386
run: |
5487
poetry run ruff check
5588
poetry run ruff format --check
56-
- name: Test with pytest
89+
90+
# PyTest checks
91+
- name: Install all extra dependencies
92+
# macos-13 doesn't support torch==2.7.1
93+
# So, pytest won't work
94+
if: ${{ !startsWith(matrix.os, 'macos-13') }}
95+
run: |
96+
poetry install --no-interaction --extras all
97+
- name: PyTest unit tests
98+
if: ${{ !startsWith(matrix.os, 'macos-13') }}
5799
run: |
58-
poetry run pytest tests -vv
100+
poetry run pytest tests -vv --durations=10

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: test
22

33
install:
4-
poetry install --with dev --with test
4+
poetry install --extras all --with dev --with test
55
poetry run pre-commit install --install-hooks
66

77
clean:

README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<a href="https://pypi.org/project/MemoryOS">
1818
<img src="https://img.shields.io/pypi/pyversions/MemoryOS.svg" alt="Supported Python versions">
1919
</a>
20+
<a href="https://pypi.org/project/MemoryOS">
21+
<img src="https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey" alt="Supported Platforms">
22+
</a>
2023
<a href="https://memos-docs.openmem.net/home/overview/">
2124
<img src="https://img.shields.io/badge/Documentation-view-blue.svg" alt="Documentation">
2225
</a>
@@ -138,34 +141,37 @@ For more detailed examples, please check out the [`examples`](./examples) direct
138141

139142
## 📦 Installation
140143

141-
> [!WARNING]
142-
> MemOS is compatible with Linux, Windows, and macOS.
143-
>
144-
> However, if you're using macOS, please note that there may be dependency issues that are difficult to resolve.
145-
>
146-
> For example, compatibility with macOS 13 Ventura is currently challenging.
147-
148144
### Install via pip
149145

150146
```bash
151147
pip install MemoryOS
152148
```
153149

154-
### Development Install
150+
### Optional Dependencies
151+
152+
MemOS provides several optional dependency groups for different features. You can install them based on your needs.
153+
154+
| Feature | Package Name |
155+
| --------------------- | ------------------------- |
156+
| Tree Memory | `MemoryOS[tree-mem]` |
157+
| Memory Reader | `MemoryOS[mem-reader]` |
158+
| Memory Scheduler | `MemoryOS[mem-scheduler]` |
155159

156-
To contribute to MemOS, clone the repository and install it in editable mode:
160+
Example installation commands:
157161

158162
```bash
159-
git clone https://github.com/MemTensor/MemOS.git
160-
cd MemOS
161-
make install
163+
pip install MemoryOS[tree-mem]
164+
pip install MemoryOS[tree-mem,mem-reader]
165+
pip install MemoryOS[mem-scheduler]
166+
pip install MemoryOS[tree-mem,mem-reader,mem-scheduler]
162167
```
163168

164-
### Optional Dependencies
169+
### External Dependencies
165170

166171
#### Ollama Support
167172

168173
To use MemOS with [Ollama](https://ollama.com/), first install the Ollama CLI:
174+
169175
```bash
170176
curl -fsSL https://ollama.com/install.sh | sh
171177
```

evaluation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This repository provides tools and scripts for evaluating the LoCoMo dataset usi
1212

1313
2. Install the required dependencies:
1414
```bash
15-
poetry install --with eval
15+
poetry install --extras all --with eval
1616
```
1717

1818
## Configuration

0 commit comments

Comments
 (0)