Skip to content

Commit 31524bd

Browse files
committed
Update based on the review.
1 parent 4023e36 commit 31524bd

8 files changed

Lines changed: 79 additions & 57 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
python -m pip install --upgrade pip setuptools wheel
3636
sudo -H pip install networkx numpy scipy
3737
- name: Install uv
38-
uses: astral-sh/setup-uv@v4
38+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
3939
with:
4040
version: ${{ env.UV_VERSION }}
4141
- name: Install Memgraph
@@ -143,7 +143,7 @@ jobs:
143143
sudo service neo4j start
144144
sleep 10 # Wait for Neo4j a bit.
145145
- name: Install uv
146-
uses: astral-sh/setup-uv@v4
146+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
147147
with:
148148
version: ${{ env.UV_VERSION }}
149149
- name: Install packages

.github/workflows/build-packages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
python-version: "3.12"
4444

4545
- name: Install uv
46-
uses: astral-sh/setup-uv@v4
46+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
4747
with:
4848
version: "0.11.2"
4949

@@ -83,7 +83,7 @@ jobs:
8383
python-version: ${{ matrix.python-version }}
8484

8585
- name: Install uv
86-
uses: astral-sh/setup-uv@v4
86+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
8787
with:
8888
version: "0.11.2"
8989

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ jobs:
126126
python-version: 3.12
127127

128128
- name: Install uv
129-
uses: astral-sh/setup-uv@v4
129+
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4
130130
with:
131131
version: "0.11.2"
132132

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,24 @@ what extras to install:
8282
uv sync # No extras
8383
8484
uv sync --extra arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats
85-
uv sync --extra dgl # DGL support (also includes torch)
85+
uv sync --extra dgl # Installs torch (DGL must be installed separately, see below)
8686
uv sync --extra docker # Docker support
8787
uv sync --extra tfgnn # TFGNN support
8888
```
8989
90+
The `dgl` and `torch_pyg` extras install PyTorch only. DGL and PyTorch Geometric wheels
91+
must be installed separately due to their custom package indexes:
92+
93+
```bash
94+
# DGL
95+
uv sync --extra dgl
96+
uv pip install dgl -f https://data.dgl.ai/wheels/torch-2.4/repo.html
97+
98+
# PyTorch Geometric
99+
uv sync --extra torch_pyg
100+
uv pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-2.4.0+cpu.html
101+
```
102+
90103
To run the tests, make sure you have an [active Memgraph instance](https://memgraph.com/docs/getting-started), and execute one of the following commands:
91104
92105
```bash

docs/installation.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,25 @@ what extras to install:
7070
uv sync # No extras
7171
7272
uv sync --extra arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats
73-
uv sync --extra dgl # DGL support (also includes torch)
73+
uv sync --extra dgl # Installs torch (DGL must be installed separately, see below)
7474
uv sync --extra dot # DOT graph import support (pydot)
7575
uv sync --extra docker # Docker support
7676
7777
```
7878

79+
The `dgl` and `torch_pyg` extras install PyTorch only. DGL and PyTorch Geometric wheels
80+
must be installed separately due to their custom package indexes:
81+
82+
```bash
83+
# DGL
84+
uv sync --extra dgl
85+
uv pip install dgl -f https://data.dgl.ai/wheels/torch-2.4/repo.html
86+
87+
# PyTorch Geometric
88+
uv sync --extra torch_pyg
89+
uv pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-2.4.0+cpu.html
90+
```
91+
7992
To run the tests, make sure you have an [active Memgraph instance](https://memgraph.com/docs/getting-started/install-memgraph), and execute one of the following commands:
8093

8194
```bash

pyproject.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ readme = "README.md"
66
license = "Apache-2.0"
77
requires-python = ">=3.10"
88
authors = [
9-
{ name = "Katarina Supe", email = "katarina.supe@memgraph.com" },
10-
{ name = "Andi Skrgat", email = "andi.skrgat@memgraph.com" },
11-
{ name = "Josip Mrden", email = "josip.mrden@memgraph.com" },
9+
{ name = "Katarina Supe", email = "katarina.supe@memgraph.io" },
10+
{ name = "Andi Skrgat", email = "andi.skrgat@memgraph.io" },
11+
{ name = "Josip Mrden", email = "josip.mrden@memgraph.io" },
1212
]
1313
dependencies = [
1414
"pymgclient>=1.5.1,<2.0.0",
@@ -20,16 +20,16 @@ dependencies = [
2020
"neo4j>=4.4.3,<6.0.0",
2121
"numpy>=1.26.4,<3.0",
2222
"pandas<=2.2.3",
23-
"tensorflow-macos==2.16.2; platform_machine == 'arm64' or platform_system == 'Darwin'",
24-
"tensorflow==2.16.2; platform_machine != 'arm64' or platform_system != 'Darwin'",
23+
"tensorflow-macos==2.16.2; platform_system == 'Darwin' and platform_machine == 'arm64'",
24+
"tensorflow==2.16.2; platform_system != 'Darwin' or platform_machine != 'arm64'",
2525
]
2626

2727
[project.optional-dependencies]
2828
arrow = ["pyarrow>=16,<17"]
2929
tfgnn = [
3030
"tensorflow-gnn>=1.0.0,<2.0.0",
31-
"tensorflow-macos==2.16.2; platform_machine == 'arm64' or platform_system == 'Darwin'",
32-
"tensorflow==2.16.2; platform_machine != 'arm64' or platform_system != 'Darwin'",
31+
"tensorflow-macos==2.16.2; platform_system == 'Darwin' and platform_machine == 'arm64'",
32+
"tensorflow==2.16.2; platform_system != 'Darwin' or platform_machine != 'arm64'",
3333
"tf-keras>=2.16,<3.0",
3434
]
3535
dgl = ["torch>=2.4,<3.0"]

tests/test_packaging.py

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import os
1516
import subprocess
17+
import sys
1618
import zipfile
1719
import shutil
1820
from pathlib import Path
@@ -21,6 +23,30 @@
2123

2224
ROOT_DIR = Path(__file__).resolve().parents[1]
2325

26+
# Read version and requires-python from pyproject.toml
27+
if sys.version_info >= (3, 11):
28+
import tomllib
29+
else:
30+
try:
31+
import tomllib
32+
except ImportError:
33+
import tomli as tomllib # noqa: F401
34+
35+
with open(ROOT_DIR / "pyproject.toml", "rb") as f:
36+
_pyproject = tomllib.load(f)
37+
38+
PROJECT_NAME = _pyproject["project"]["name"]
39+
PROJECT_VERSION = _pyproject["project"]["version"]
40+
REQUIRES_PYTHON = _pyproject["project"]["requires-python"]
41+
CURRENT_PYTHON = f"{sys.version_info.major}.{sys.version_info.minor}"
42+
43+
44+
def _python_bin(venv_dir: Path) -> Path:
45+
"""Return the platform-appropriate Python binary path inside a venv."""
46+
if os.name == "nt":
47+
return venv_dir / "Scripts" / "python.exe"
48+
return venv_dir / "bin" / "python"
49+
2450

2551
def _uv_available() -> bool:
2652
return shutil.which("uv") is not None
@@ -63,9 +89,9 @@ def test_wheel_metadata(self, tmp_path):
6389
assert len(metadata_files) == 1, f"Expected 1 METADATA file, found: {metadata_files}"
6490
metadata = zf.read(metadata_files[0]).decode("utf-8")
6591

66-
assert "Name: GQLAlchemy" in metadata
67-
assert "Version: 1.8.0" in metadata
68-
assert "Requires-Python: >=3.10" in metadata
92+
assert f"Name: {PROJECT_NAME}" in metadata
93+
assert f"Version: {PROJECT_VERSION}" in metadata
94+
assert f"Requires-Python: {REQUIRES_PYTHON}" in metadata
6995

7096
def test_wheel_contains_package(self, tmp_path):
7197
"""The wheel should include the gqlalchemy package directory."""
@@ -86,6 +112,7 @@ def test_wheel_contains_package(self, tmp_path):
86112
assert len(gqlalchemy_files) > 0, "Wheel does not contain gqlalchemy/ package"
87113
assert any(n == "gqlalchemy/__init__.py" for n in gqlalchemy_files), "Missing gqlalchemy/__init__.py"
88114

115+
@pytest.mark.slow
89116
def test_wheel_install_in_isolated_venv(self, tmp_path):
90117
"""The wheel should install successfully into a fresh venv."""
91118
wheel_dir = tmp_path / "dist"
@@ -103,16 +130,16 @@ def test_wheel_install_in_isolated_venv(self, tmp_path):
103130

104131
wheel_file = next(wheel_dir.glob("*.whl"))
105132

106-
# Create isolated venv + install
133+
# Create isolated venv using the current Python version
107134
subprocess.run(
108-
["uv", "venv", "--python", "3.12", str(venv_dir)],
135+
["uv", "venv", "--python", CURRENT_PYTHON, str(venv_dir)],
109136
capture_output=True,
110137
text=True,
111138
timeout=60,
112139
check=True,
113140
)
114141

115-
python = venv_dir / "bin" / "python"
142+
python = _python_bin(venv_dir)
116143
result = subprocess.run(
117144
["uv", "pip", "install", "--python", str(python), str(wheel_file)],
118145
capture_output=True,
@@ -149,14 +176,14 @@ def _make_venv_and_install_extra(tmp_path, extra, import_check):
149176
wheel_file = next(wheel_dir.glob("*.whl"))
150177

151178
subprocess.run(
152-
["uv", "venv", "--python", "3.12", str(venv_dir)],
179+
["uv", "venv", "--python", CURRENT_PYTHON, str(venv_dir)],
153180
capture_output=True,
154181
text=True,
155182
timeout=60,
156183
check=True,
157184
)
158185

159-
python = str(venv_dir / "bin" / "python")
186+
python = str(_python_bin(venv_dir))
160187

161188
# Install wheel with the extra
162189
result = subprocess.run(

uv.lock

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

0 commit comments

Comments
 (0)