migrate to uv (#634)
This commit is contained in:
parent
c29893d972
commit
a7ca777af5
19 changed files with 5347 additions and 7055 deletions
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
|
|
@ -9,3 +9,11 @@ updates:
|
||||||
directory: "/" # Location of package manifests
|
directory: "/" # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "weekly"
|
interval: "weekly"
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/server" # Location of server package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
- package-ecosystem: "pip"
|
||||||
|
directory: "/mcp_server" # Location of server package manifests
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
17
.github/workflows/release-graphiti-core.yml
vendored
17
.github/workflows/release-graphiti-core.yml
vendored
|
|
@ -4,9 +4,6 @@ on:
|
||||||
push:
|
push:
|
||||||
tags: ["v*.*.*"]
|
tags: ["v*.*.*"]
|
||||||
|
|
||||||
env:
|
|
||||||
POETRY_VERSION: "2.1.2"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -18,21 +15,23 @@ jobs:
|
||||||
url: https://pypi.org/p/zep-cloud
|
url: https://pypi.org/p/zep-cloud
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install poetry
|
|
||||||
run: pipx install poetry==$POETRY_VERSION
|
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python 3.10
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
cache: "poetry"
|
- name: Install uv
|
||||||
|
uses: astral-sh/setup-uv@v3
|
||||||
|
with:
|
||||||
|
version: "latest"
|
||||||
- name: Compare pyproject version with tag
|
- name: Compare pyproject version with tag
|
||||||
run: |
|
run: |
|
||||||
TAG_VERSION=${GITHUB_REF#refs/tags/}
|
TAG_VERSION=${GITHUB_REF#refs/tags/}
|
||||||
if [ "$TAG_VERSION" != "v$(poetry version --short)" ]; then
|
PROJECT_VERSION=$(uv run python -c "import tomllib; print('v' + tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
|
||||||
echo "Tag version $TAG_VERSION does not match the project version $(poetry version --short)"
|
if [ "$TAG_VERSION" != "$PROJECT_VERSION" ]; then
|
||||||
|
echo "Tag version $TAG_VERSION does not match the project version $PROJECT_VERSION"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
- name: Build project for distribution
|
- name: Build project for distribution
|
||||||
run: poetry build
|
run: uv build
|
||||||
- name: Publish package distributions to PyPI
|
- name: Publish package distributions to PyPI
|
||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
|
|
||||||
17
.github/workflows/typecheck.yml
vendored
17
.github/workflows/typecheck.yml
vendored
|
|
@ -17,20 +17,17 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- name: Install Poetry
|
- name: Install uv
|
||||||
uses: snok/install-poetry@v1
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
version: 2.1.2
|
version: "latest"
|
||||||
virtualenvs-create: true
|
|
||||||
virtualenvs-in-project: true
|
|
||||||
installer-parallel: true
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: poetry install --no-interaction --with dev
|
run: uv sync --extra dev
|
||||||
- name: Run MyPy for graphiti-core
|
- name: Run MyPy for graphiti-core
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
poetry run mypy ./graphiti_core --show-column-numbers --show-error-codes | sed -E '
|
uv run mypy ./graphiti_core --show-column-numbers --show-error-codes | sed -E '
|
||||||
s/^(.*):([0-9]+):([0-9]+): (error|warning): (.+) \[(.+)\]/::error file=\1,line=\2,endLine=\2,col=\3,title=\6::\5/;
|
s/^(.*):([0-9]+):([0-9]+): (error|warning): (.+) \[(.+)\]/::error file=\1,line=\2,endLine=\2,col=\3,title=\6::\5/;
|
||||||
s/^(.*):([0-9]+):([0-9]+): note: (.+)/::notice file=\1,line=\2,endLine=\2,col=\3,title=Note::\4/;
|
s/^(.*):([0-9]+):([0-9]+): note: (.+)/::notice file=\1,line=\2,endLine=\2,col=\3,title=Note::\4/;
|
||||||
'
|
'
|
||||||
|
|
@ -38,13 +35,13 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd server
|
cd server
|
||||||
poetry install --no-interaction --with dev
|
uv sync --extra dev
|
||||||
- name: Run MyPy for graph-service
|
- name: Run MyPy for graph-service
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd server
|
cd server
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
poetry run mypy . --show-column-numbers --show-error-codes | sed -E '
|
uv run mypy . --show-column-numbers --show-error-codes | sed -E '
|
||||||
s/^(.*):([0-9]+):([0-9]+): (error|warning): (.+) \[(.+)\]/::error file=\1,line=\2,endLine=\2,col=\3,title=\6::\5/;
|
s/^(.*):([0-9]+):([0-9]+): (error|warning): (.+) \[(.+)\]/::error file=\1,line=\2,endLine=\2,col=\3,title=\6::\5/;
|
||||||
s/^(.*):([0-9]+):([0-9]+): note: (.+)/::notice file=\1,line=\2,endLine=\2,col=\3,title=Note::\4/;
|
s/^(.*):([0-9]+):([0-9]+): note: (.+)/::notice file=\1,line=\2,endLine=\2,col=\3,title=Note::\4/;
|
||||||
'
|
'
|
||||||
|
|
|
||||||
18
.github/workflows/unit_tests.yml
vendored
18
.github/workflows/unit_tests.yml
vendored
|
|
@ -17,22 +17,14 @@ jobs:
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
- name: Load cached Poetry installation
|
- name: Install uv
|
||||||
uses: actions/cache@v4
|
uses: astral-sh/setup-uv@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.local
|
version: "latest"
|
||||||
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
|
|
||||||
- name: Install Poetry
|
|
||||||
uses: snok/install-poetry@v1
|
|
||||||
with:
|
|
||||||
version: 2.1.2
|
|
||||||
virtualenvs-create: true
|
|
||||||
virtualenvs-in-project: true
|
|
||||||
installer-parallel: true
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: poetry install --no-interaction --no-root
|
run: uv sync --extra dev
|
||||||
- name: Run non-integration tests
|
- name: Run non-integration tests
|
||||||
env:
|
env:
|
||||||
PYTHONPATH: ${{ github.workspace }}
|
PYTHONPATH: ${{ github.workspace }}
|
||||||
run: |
|
run: |
|
||||||
poetry run pytest -m "not integration"
|
uv run pytest -m "not integration"
|
||||||
|
|
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
|
|
@ -95,12 +95,11 @@ ipython_config.py
|
||||||
# install all needed dependencies.
|
# install all needed dependencies.
|
||||||
#Pipfile.lock
|
#Pipfile.lock
|
||||||
|
|
||||||
# poetry
|
# uv
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
# It is generally recommended to include uv.lock in version control.
|
||||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
# This ensures reproducibility across different environments.
|
||||||
# commonly ignored for libraries.
|
# https://docs.astral.sh/uv/concepts/projects/#lockfile
|
||||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
# uv.lock
|
||||||
#poetry.lock
|
|
||||||
|
|
||||||
# pdm
|
# pdm
|
||||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||||
|
|
|
||||||
100
CONTRIBUTING.md
100
CONTRIBUTING.md
|
|
@ -20,11 +20,11 @@ For **feature requests**, tell us the story of what you're trying to accomplish.
|
||||||
|
|
||||||
For **bug reports**, we need enough context to reproduce the problem. Use the [GitHub issue tracker](https://github.com/getzep/graphiti/issues) and include:
|
For **bug reports**, we need enough context to reproduce the problem. Use the [GitHub issue tracker](https://github.com/getzep/graphiti/issues) and include:
|
||||||
|
|
||||||
- A clear title that summarizes the specific problem
|
- A clear title that summarizes the specific problem
|
||||||
- What you were trying to do when you encountered the bug
|
- What you were trying to do when you encountered the bug
|
||||||
- What you expected to happen
|
- What you expected to happen
|
||||||
- What actually happened
|
- What actually happened
|
||||||
- A code sample or test case that demonstrates the issue
|
- A code sample or test case that demonstrates the issue
|
||||||
|
|
||||||
### Share Your Use Cases
|
### Share Your Use Cases
|
||||||
|
|
||||||
|
|
@ -46,78 +46,78 @@ Once you've found an issue tagged with "good first issue" or "help wanted," or p
|
||||||
|
|
||||||
1. Fork the repository on GitHub.
|
1. Fork the repository on GitHub.
|
||||||
2. Clone your fork locally:
|
2. Clone your fork locally:
|
||||||
```
|
```
|
||||||
git clone https://github.com/getzep/graphiti
|
git clone https://github.com/getzep/graphiti
|
||||||
cd graphiti
|
cd graphiti
|
||||||
```
|
```
|
||||||
3. Set up your development environment:
|
3. Set up your development environment:
|
||||||
|
|
||||||
- Ensure you have Python 3.10+ installed.
|
- Ensure you have Python 3.10+ installed.
|
||||||
- Install Poetry: https://python-poetry.org/docs/#installation
|
- Install uv: https://docs.astral.sh/uv/getting-started/installation/
|
||||||
- Install project dependencies:
|
- Install project dependencies:
|
||||||
```
|
```
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
- To run integration tests, set the appropriate environment variables
|
- To run integration tests, set the appropriate environment variables
|
||||||
|
|
||||||
```
|
```
|
||||||
export TEST_OPENAI_API_KEY=...
|
export TEST_OPENAI_API_KEY=...
|
||||||
export TEST_OPENAI_MODEL=...
|
export TEST_OPENAI_MODEL=...
|
||||||
export TEST_ANTHROPIC_API_KEY=...
|
export TEST_ANTHROPIC_API_KEY=...
|
||||||
|
|
||||||
# For Neo4j
|
# For Neo4j
|
||||||
export TEST_URI=neo4j://...
|
export TEST_URI=neo4j://...
|
||||||
export TEST_USER=...
|
export TEST_USER=...
|
||||||
export TEST_PASSWORD=...
|
export TEST_PASSWORD=...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Making Changes
|
## Making Changes
|
||||||
|
|
||||||
1. Create a new branch for your changes:
|
1. Create a new branch for your changes:
|
||||||
```
|
```
|
||||||
git checkout -b your-branch-name
|
git checkout -b your-branch-name
|
||||||
```
|
```
|
||||||
2. Make your changes in the codebase.
|
2. Make your changes in the codebase.
|
||||||
3. Write or update tests as necessary.
|
3. Write or update tests as necessary.
|
||||||
4. Run the tests to ensure they pass:
|
4. Run the tests to ensure they pass:
|
||||||
```
|
```
|
||||||
make test
|
make test
|
||||||
```
|
```
|
||||||
5. Format your code:
|
5. Format your code:
|
||||||
```
|
```
|
||||||
make format
|
make format
|
||||||
```
|
```
|
||||||
6. Run linting checks:
|
6. Run linting checks:
|
||||||
```
|
```
|
||||||
make lint
|
make lint
|
||||||
```
|
```
|
||||||
|
|
||||||
## Submitting Changes
|
## Submitting Changes
|
||||||
|
|
||||||
1. Commit your changes:
|
1. Commit your changes:
|
||||||
```
|
```
|
||||||
git commit -m "Your detailed commit message"
|
git commit -m "Your detailed commit message"
|
||||||
```
|
```
|
||||||
2. Push to your fork:
|
2. Push to your fork:
|
||||||
```
|
```
|
||||||
git push origin your-branch-name
|
git push origin your-branch-name
|
||||||
```
|
```
|
||||||
3. Submit a pull request through the GitHub website to https://github.com/getzep/graphiti.
|
3. Submit a pull request through the GitHub website to https://github.com/getzep/graphiti.
|
||||||
|
|
||||||
## Pull Request Guidelines
|
## Pull Request Guidelines
|
||||||
|
|
||||||
- Provide a clear title and description of your changes.
|
- Provide a clear title and description of your changes.
|
||||||
- Include any relevant issue numbers in the PR description.
|
- Include any relevant issue numbers in the PR description.
|
||||||
- Ensure all tests pass and there are no linting errors.
|
- Ensure all tests pass and there are no linting errors.
|
||||||
- Update documentation if you're changing functionality.
|
- Update documentation if you're changing functionality.
|
||||||
|
|
||||||
## Code Style and Quality
|
## Code Style and Quality
|
||||||
|
|
||||||
We use several tools to maintain code quality:
|
We use several tools to maintain code quality:
|
||||||
|
|
||||||
- Ruff for linting and formatting
|
- Ruff for linting and formatting
|
||||||
- Mypy for static type checking
|
- Mypy for static type checking
|
||||||
- Pytest for testing
|
- Pytest for testing
|
||||||
|
|
||||||
Before submitting a pull request, please run:
|
Before submitting a pull request, please run:
|
||||||
|
|
||||||
|
|
|
||||||
90
Dockerfile
90
Dockerfile
|
|
@ -1,43 +1,87 @@
|
||||||
# Build stage
|
# syntax=docker/dockerfile:1.9
|
||||||
FROM python:3.12-slim as builder
|
FROM python:3.12-slim as builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies for building
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
gcc \
|
gcc \
|
||||||
|
curl \
|
||||||
|
ca-certificates \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install Poetry
|
# Install uv using the installer script
|
||||||
RUN pip install --no-cache-dir poetry
|
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
||||||
|
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
||||||
|
ENV PATH="/root/.local/bin:$PATH"
|
||||||
|
|
||||||
# Copy only the files needed for installation
|
# Configure uv for optimal Docker usage
|
||||||
COPY ./pyproject.toml ./poetry.lock* ./README.md /app/
|
ENV UV_COMPILE_BYTECODE=1 \
|
||||||
COPY ./graphiti_core /app/graphiti_core
|
UV_LINK_MODE=copy \
|
||||||
COPY ./server/pyproject.toml ./server/poetry.lock* /app/server/
|
UV_PYTHON_DOWNLOADS=never
|
||||||
|
|
||||||
RUN poetry config virtualenvs.create false
|
# Copy and build main graphiti-core project
|
||||||
|
COPY ./pyproject.toml ./README.md ./
|
||||||
|
COPY ./graphiti_core ./graphiti_core
|
||||||
|
|
||||||
# Install the local package
|
# Build graphiti-core wheel
|
||||||
RUN poetry build && pip install dist/*.whl
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv build
|
||||||
|
|
||||||
# Install server dependencies
|
# Install the built wheel to make it available for server
|
||||||
WORKDIR /app/server
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
RUN poetry install --no-interaction --no-ansi --only main --no-root
|
pip install dist/*.whl
|
||||||
|
|
||||||
|
# Runtime stage - build the server here
|
||||||
FROM python:3.12-slim
|
FROM python:3.12-slim
|
||||||
|
|
||||||
# Copy only the necessary files from the builder stage
|
# Install uv using the installer script
|
||||||
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
COPY --from=builder /usr/local/bin /usr/local/bin
|
curl \
|
||||||
|
ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create the app directory and copy server files
|
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
||||||
|
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
||||||
|
ENV PATH="/root/.local/bin:$PATH"
|
||||||
|
|
||||||
|
# Configure uv for runtime
|
||||||
|
ENV UV_COMPILE_BYTECODE=1 \
|
||||||
|
UV_LINK_MODE=copy \
|
||||||
|
UV_PYTHON_DOWNLOADS=never
|
||||||
|
|
||||||
|
# Create non-root user
|
||||||
|
RUN groupadd -r app && useradd -r -d /app -g app app
|
||||||
|
|
||||||
|
# Copy graphiti-core wheel from builder
|
||||||
|
COPY --from=builder /app/dist/*.whl /tmp/
|
||||||
|
|
||||||
|
# Install graphiti-core wheel first
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv pip install --system /tmp/*.whl
|
||||||
|
|
||||||
|
# Set up the server application
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./server /app
|
COPY ./server/pyproject.toml ./server/README.md ./server/uv.lock ./
|
||||||
|
COPY ./server/graph_service ./graph_service
|
||||||
|
|
||||||
|
# Install server dependencies and application
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv sync --frozen --no-dev
|
||||||
|
|
||||||
|
# Change ownership to app user
|
||||||
|
RUN chown -R app:app /app
|
||||||
|
|
||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV PYTHONUNBUFFERED=1
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
ENV PORT=8000
|
PATH="/app/.venv/bin:$PATH"
|
||||||
# Command to run the application
|
|
||||||
|
|
||||||
CMD uvicorn graph_service.main:app --host 0.0.0.0 --port $PORT
|
# Switch to non-root user
|
||||||
|
USER app
|
||||||
|
|
||||||
|
# Set port
|
||||||
|
ENV PORT=8000
|
||||||
|
EXPOSE $PORT
|
||||||
|
|
||||||
|
# Use uv run for execution
|
||||||
|
CMD ["uv", "run", "uvicorn", "graph_service.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
10
Makefile
10
Makefile
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
# Define variables
|
# Define variables
|
||||||
PYTHON = python3
|
PYTHON = python3
|
||||||
POETRY = poetry
|
UV = uv
|
||||||
PYTEST = $(POETRY) run pytest
|
PYTEST = $(UV) run pytest
|
||||||
RUFF = $(POETRY) run ruff
|
RUFF = $(UV) run ruff
|
||||||
MYPY = $(POETRY) run mypy
|
MYPY = $(UV) run mypy
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all: format lint test
|
all: format lint test
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
install:
|
install:
|
||||||
$(POETRY) install --with dev
|
$(UV) sync --extra dev
|
||||||
|
|
||||||
# Format code
|
# Format code
|
||||||
format:
|
format:
|
||||||
|
|
|
||||||
12
README.md
12
README.md
|
|
@ -128,7 +128,7 @@ pip install graphiti-core
|
||||||
or
|
or
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry add graphiti-core
|
uv add graphiti-core
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also install optional LLM providers as extras:
|
You can also install optional LLM providers as extras:
|
||||||
|
|
@ -261,11 +261,11 @@ Graphiti supports Google's Gemini models for both LLM inference and embeddings.
|
||||||
Install Graphiti:
|
Install Graphiti:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry add "graphiti-core[google-genai]"
|
uv add "graphiti-core[google-genai]"
|
||||||
|
|
||||||
# or
|
# or
|
||||||
|
|
||||||
uv add "graphiti-core[google-genai]"
|
pip install "graphiti-core[google-genai]"
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
@ -302,10 +302,9 @@ graphiti = Graphiti(
|
||||||
|
|
||||||
Graphiti supports Ollama for running local LLMs and embedding models via Ollama's OpenAI-compatible API. This is ideal for privacy-focused applications or when you want to avoid API costs.
|
Graphiti supports Ollama for running local LLMs and embedding models via Ollama's OpenAI-compatible API. This is ideal for privacy-focused applications or when you want to avoid API costs.
|
||||||
|
|
||||||
|
|
||||||
Install the models:
|
Install the models:
|
||||||
ollama pull deepseek-r1:7b # LLM
|
ollama pull deepseek-r1:7b # LLM
|
||||||
ollama pull nomic-embed-text # embeddings
|
ollama pull nomic-embed-text # embeddings
|
||||||
|
|
||||||
```python
|
```python
|
||||||
from graphiti_core import Graphiti
|
from graphiti_core import Graphiti
|
||||||
|
|
@ -346,7 +345,6 @@ graphiti = Graphiti(
|
||||||
|
|
||||||
Ensure Ollama is running (`ollama serve`) and that you have pulled the models you want to use.
|
Ensure Ollama is running (`ollama serve`) and that you have pulled the models you want to use.
|
||||||
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- [Guides and API documentation](https://help.getzep.com/graphiti).
|
- [Guides and API documentation](https://help.getzep.com/graphiti).
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
graph:
|
graph:
|
||||||
image: graphiti-service:${GITHUB_SHA}
|
image: graphiti-service:${GITHUB_SHA}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
graph:
|
graph:
|
||||||
build:
|
build:
|
||||||
|
|
@ -22,21 +20,25 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
- OPENAI_API_KEY=${OPENAI_API_KEY}
|
||||||
- NEO4J_URI=bolt://neo4j:${NEO4J_PORT}
|
- NEO4J_URI=bolt://neo4j:${NEO4J_PORT:-7687}
|
||||||
- NEO4J_USER=${NEO4J_USER}
|
- NEO4J_USER=${NEO4J_USER}
|
||||||
- NEO4J_PASSWORD=${NEO4J_PASSWORD}
|
- NEO4J_PASSWORD=${NEO4J_PASSWORD}
|
||||||
- PORT=8000
|
- PORT=8000
|
||||||
neo4j:
|
neo4j:
|
||||||
image: neo4j:5.26.2
|
image: neo4j:5.26.2
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: wget "http://localhost:${NEO4J_PORT}" || exit 1
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"wget -qO- http://localhost:${NEO4J_PORT:-7474} || exit 1",
|
||||||
|
]
|
||||||
interval: 1s
|
interval: 1s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 20
|
retries: 10
|
||||||
start_period: 3s
|
start_period: 3s
|
||||||
ports:
|
ports:
|
||||||
- "7474:7474" # HTTP
|
- "7474:7474" # HTTP
|
||||||
- "${NEO4J_PORT}:${NEO4J_PORT}" # Bolt
|
- "${NEO4J_PORT:-7687}:${NEO4J_PORT:-7687}" # Bolt
|
||||||
volumes:
|
volumes:
|
||||||
- neo4j_data:/data
|
- neo4j_data:/data
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,49 @@
|
||||||
FROM python:3.11-slim
|
# syntax=docker/dockerfile:1.9
|
||||||
|
FROM python:3.12-slim
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install uv for package management
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y curl && \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
curl -LsSf https://astral.sh/uv/install.sh | sh && \
|
curl \
|
||||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install uv using the installer script
|
||||||
|
ADD https://astral.sh/uv/install.sh /uv-installer.sh
|
||||||
|
RUN sh /uv-installer.sh && rm /uv-installer.sh
|
||||||
|
|
||||||
# Add uv to PATH
|
# Add uv to PATH
|
||||||
ENV PATH="/root/.local/bin:${PATH}"
|
ENV PATH="/root/.local/bin:${PATH}"
|
||||||
|
|
||||||
ENV MCP_SERVER_HOST="0.0.0.0"
|
# Configure uv for optimal Docker usage
|
||||||
|
ENV UV_COMPILE_BYTECODE=1 \
|
||||||
|
UV_LINK_MODE=copy \
|
||||||
|
UV_PYTHON_DOWNLOADS=never \
|
||||||
|
MCP_SERVER_HOST="0.0.0.0" \
|
||||||
|
PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
# Copy pyproject.toml and install dependencies
|
# Create non-root user
|
||||||
COPY pyproject.toml .
|
RUN groupadd -r app && useradd -r -d /app -g app app
|
||||||
RUN uv sync
|
|
||||||
|
# Copy project files for dependency installation (better caching)
|
||||||
|
COPY pyproject.toml uv.lock ./
|
||||||
|
|
||||||
|
# Install dependencies first (better layer caching)
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
uv sync --frozen --no-dev
|
||||||
|
|
||||||
# Copy application code
|
# Copy application code
|
||||||
COPY graphiti_mcp_server.py .
|
COPY graphiti_mcp_server.py ./
|
||||||
|
|
||||||
|
# Change ownership to app user
|
||||||
|
RUN chown -R app:app /app
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
USER app
|
||||||
|
|
||||||
|
# Expose port
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
|
|
||||||
# Set environment variables
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
# Command to run the application
|
# Command to run the application
|
||||||
CMD ["uv", "run", "graphiti_mcp_server.py"]
|
CMD ["uv", "run", "graphiti_mcp_server.py"]
|
||||||
|
|
|
||||||
5410
poetry.lock
generated
5410
poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,7 +10,6 @@ authors = [
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
requires-python = ">=3.10,<4"
|
requires-python = ">=3.10,<4"
|
||||||
packages = [{ include = "graphiti_core", from = "." }]
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pydantic>=2.11.5",
|
"pydantic>=2.11.5",
|
||||||
"neo4j>=5.26.0",
|
"neo4j>=5.26.0",
|
||||||
|
|
@ -29,34 +28,31 @@ Repository = "https://github.com/getzep/graphiti"
|
||||||
anthropic = ["anthropic>=0.49.0"]
|
anthropic = ["anthropic>=0.49.0"]
|
||||||
groq = ["groq>=0.2.0"]
|
groq = ["groq>=0.2.0"]
|
||||||
google-genai = ["google-genai>=1.8.0"]
|
google-genai = ["google-genai>=1.8.0"]
|
||||||
falkord-db = ["falkordb (>=1.1.2,<2.0.0)"]
|
falkord-db = ["falkordb>=1.1.2,<2.0.0"]
|
||||||
|
dev = [
|
||||||
[tool.poetry.group.dev.dependencies]
|
"mypy>=1.11.1",
|
||||||
mypy = ">=1.11.1"
|
"groq>=0.2.0",
|
||||||
groq = ">=0.2.0"
|
"anthropic>=0.49.0",
|
||||||
anthropic = ">=0.49.0"
|
"google-genai>=1.8.0",
|
||||||
google-genai = ">=1.8.0"
|
"ipykernel>=6.29.5",
|
||||||
ipykernel = ">=6.29.5"
|
"jupyterlab>=4.2.4",
|
||||||
jupyterlab = ">=4.2.4"
|
"diskcache-stubs>=5.6.3.6.20240818",
|
||||||
diskcache-stubs = ">=5.6.3.6.20240818"
|
"langgraph>=0.2.15",
|
||||||
langgraph = ">=0.2.15"
|
"langchain-anthropic>=0.2.4",
|
||||||
langchain-anthropic = ">=0.2.4"
|
"langsmith>=0.1.108",
|
||||||
langsmith = ">=0.1.108"
|
"langchain-openai>=0.2.6",
|
||||||
langchain-openai = ">=0.2.6"
|
"sentence-transformers>=3.2.1",
|
||||||
sentence-transformers = ">=3.2.1"
|
"transformers>=4.45.2",
|
||||||
transformers = ">=4.45.2"
|
"voyageai>=0.2.3",
|
||||||
voyageai = ">=0.2.3"
|
"pytest>=8.3.3",
|
||||||
pytest = ">=8.3.3"
|
"pytest-asyncio>=0.24.0",
|
||||||
pytest-asyncio = ">=0.24.0"
|
"pytest-xdist>=3.6.1",
|
||||||
pytest-xdist = ">=3.6.1"
|
"ruff>=0.7.1",
|
||||||
ruff = ">=0.7.1"
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["hatchling"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
[tool.poetry]
|
|
||||||
requires-poetry = ">=2.0"
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
pythonpath = ["."]
|
pythonpath = ["."]
|
||||||
|
|
@ -86,8 +82,13 @@ quote-style = "single"
|
||||||
indent-style = "space"
|
indent-style = "space"
|
||||||
docstring-code-format = true
|
docstring-code-format = true
|
||||||
|
|
||||||
[mypy-falkordb]
|
[tool.mypy]
|
||||||
|
packages = ["graphiti_core"]
|
||||||
|
|
||||||
|
[[tool.mypy.overrides]]
|
||||||
|
module = "falkordb"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
||||||
[mypy-falkordb.asyncio]
|
[[tool.mypy.overrides]]
|
||||||
|
module = "falkordb.asyncio"
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,17 @@
|
||||||
|
|
||||||
# Define variables
|
# Define variables
|
||||||
PYTHON = python3
|
PYTHON = python3
|
||||||
POETRY = poetry
|
UV = uv
|
||||||
PYTEST = $(POETRY) run pytest
|
PYTEST = $(UV) run pytest
|
||||||
RUFF = $(POETRY) run ruff
|
RUFF = $(UV) run ruff
|
||||||
MYPY = $(POETRY) run mypy
|
MYPY = $(UV) run mypy
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all: format lint test
|
all: format lint test
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
install:
|
install:
|
||||||
$(POETRY) install --with dev
|
$(UV) sync --extra dev
|
||||||
|
|
||||||
# Format code
|
# Format code
|
||||||
format:
|
format:
|
||||||
|
|
|
||||||
1442
server/poetry.lock
generated
1442
server/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,33 +1,38 @@
|
||||||
[tool.poetry]
|
[project]
|
||||||
name = "graph-service"
|
name = "graph-service"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
description = "Zep Graph service implementing Graphiti package"
|
description = "Zep Graph service implementing Graphiti package"
|
||||||
authors = ["Paul Paliychuk <paul@getzep.com>"]
|
authors = [
|
||||||
|
{ "name" = "Paul Paliychuk", "email" = "paul@getzep.com" },
|
||||||
|
]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
packages = [{ include = "graph_service" }]
|
requires-python = ">=3.10"
|
||||||
|
dependencies = [
|
||||||
|
"fastapi>=0.115.0",
|
||||||
|
"graphiti-core",
|
||||||
|
"pydantic-settings>=2.4.0",
|
||||||
|
"uvicorn>=0.30.6",
|
||||||
|
"httpx>=0.28.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[project.optional-dependencies]
|
||||||
[tool.poetry.dependencies]
|
dev = [
|
||||||
python = "^3.10"
|
"pydantic>=2.8.2",
|
||||||
fastapi = "^0.115.0"
|
"mypy>=1.11.1",
|
||||||
graphiti-core = { path = "../" }
|
"pytest>=8.3.2",
|
||||||
pydantic-settings = "^2.4.0"
|
"python-dotenv>=1.0.1",
|
||||||
uvicorn = "^0.30.6"
|
"pytest-asyncio>=0.24.0",
|
||||||
httpx = "^0.28.1"
|
"pytest-xdist>=3.6.1",
|
||||||
|
"ruff>=0.6.2",
|
||||||
[tool.poetry.group.dev.dependencies]
|
"fastapi-cli>=0.0.5",
|
||||||
pydantic = "^2.8.2"
|
]
|
||||||
mypy = "^1.11.1"
|
|
||||||
pytest = "^8.3.2"
|
|
||||||
python-dotenv = "^1.0.1"
|
|
||||||
pytest-asyncio = "^0.24.0"
|
|
||||||
pytest-xdist = "^3.6.1"
|
|
||||||
ruff = "^0.6.2"
|
|
||||||
fastapi-cli = "^0.0.5"
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["hatchling"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "hatchling.build"
|
||||||
|
|
||||||
|
[tool.hatch.build.targets.wheel]
|
||||||
|
packages = ["graph_service"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
pythonpath = ["."]
|
pythonpath = ["."]
|
||||||
|
|
|
||||||
1159
server/uv.lock
generated
Normal file
1159
server/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue