Skip to content

Commit 6d69a95

Browse files
authored
Python version support (neo4j#67)
* Use tox for automated testing between python versions * Resolve mypy errors * Update poetry to use matrix's python version * Remove Python 3.8 support * Readded python 3.8 * Removed tox.ini for python version iterating * Reverted to new type hints but added import __future__ annotations * Use different python versions for PR unit test workflow * Add missing imports for __future__.annotations * Update CHANGELOG
1 parent 16a1644 commit 6d69a95

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+388
-228
lines changed

.github/workflows/pr-e2e-tests.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: 'Neo4j-GenAI PR E2E Tests'
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened, ready_for_review]
6+
branches:
7+
- main
68

79
concurrency:
810
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
@@ -13,6 +15,7 @@ jobs:
1315
runs-on: ubuntu-latest
1416
strategy:
1517
matrix:
18+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
1619
neo4j-version:
1720
- 5
1821
neo4j-edition:
@@ -47,18 +50,24 @@ jobs:
4750
steps:
4851
- name: Check out repository code
4952
uses: actions/checkout@v4
53+
- name: Set up Python ${{ matrix.python-version }}
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: ${{ matrix.python-version }}
5057
- name: Install Poetry
5158
uses: snok/install-poetry@v1
5259
with:
5360
virtualenvs-create: true
5461
virtualenvs-in-project: true
5562
installer-parallel: true
63+
- name: Set Python version for Poetry
64+
run: poetry env use python${{ matrix.python-version }}
5665
- name: Load cached venv
5766
id: cached-poetry-dependencies
5867
uses: actions/cache@v4
5968
with:
6069
path: .venv
61-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
70+
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
6271
- name: Install dependencies
6372
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
6473
run: poetry install --no-interaction --no-root

.github/workflows/pr.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,30 @@ on: pull_request
44
jobs:
55
test:
66
runs-on: ubuntu-latest
7+
strategy:
8+
matrix:
9+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
710
steps:
811
- name: Check out repository code
912
uses: actions/checkout@v4
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: ${{ matrix.python-version }}
1017
- name: Install Poetry
1118
uses: snok/install-poetry@v1
1219
with:
1320
virtualenvs-create: true
1421
virtualenvs-in-project: true
1522
installer-parallel: true
23+
- name: Set Python version for Poetry
24+
run: poetry env use python${{ matrix.python-version }}
1625
- name: Load cached venv
1726
id: cached-poetry-dependencies
1827
uses: actions/cache@v4
1928
with:
2029
path: .venv
21-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
30+
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
2231
- name: Install dependencies
2332
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
2433
run: poetry install --no-interaction --no-root

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Introduced the GraphRAG object, enabling a full RAG (Retrieval-Augmented Generation) pipeline with context retrieval, prompt formatting, and answer generation.
1111
- Added PromptTemplate and RagTemplate for customizable prompt generation.
1212
- Added LLMInterface with implementation for OpenAI LLM.
13+
- Updated project configuration to support multiple Python versions (3.8 to 3.12) in CI workflows.
1314

1415
### Changed
1516
- Refactored import paths for retrievers to neo4j_genai.retrievers.

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def setup(app):
9797
"te": typing,
9898
# Type alias that's only defined and imported if `typing.TYPE_CHECKING`
9999
# is `True`.
100-
"_TAuth": "typing.Tuple[typing.Any, typing.Any] | Auth | None",
100+
"_TAuth": "typing.tuple[typing.Any, typing.Any] | Auth | None",
101101
}
102102

103103
# Theme options are theme-specific and customize the look and feel of a theme

examples/hybrid_cypher_search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
from neo4j import GraphDatabase
23

34
from random import random

examples/hybrid_search.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
from neo4j import GraphDatabase
23

34
from random import random

examples/similarity_search_for_text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
from neo4j import GraphDatabase
23
from neo4j_genai.retrievers import VectorRetriever
34

examples/vector_cypher_retrieval.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
from neo4j import GraphDatabase
23
from neo4j_genai.retrievers import VectorCypherRetriever
34

examples/vector_search_with_filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
from neo4j import GraphDatabase
23
from neo4j_genai.retrievers import VectorRetriever
34

poetry.lock

Lines changed: 297 additions & 200 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)