Skip to content

Commit 5e292f6

Browse files
committed
Use dependency-groups for dev dependencies
1 parent 5a15cf6 commit 5e292f6

File tree

8 files changed

+63
-23
lines changed

8 files changed

+63
-23
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ Remember that many community members have become regular contributors and some a
5555

5656
### Setting up the Development Environment
5757
* Install Python 3.10+
58-
* Install the requirements
58+
* Install the requirements (needs pip 25.1+)
5959
```bash
60-
$ python3 -m pip install -U pip
61-
$ python3 -m pip install -Ur requirements-dev.txt
60+
# recommended to use a virtual environment
61+
$ python3 -m venv .venv
62+
$ source .venv/bin/activate
63+
# make sure pip is up to date
64+
$ pip install -U pip
65+
# install all development dependencies and driver
66+
$ pip install -U --group dev -e .
6267
```
6368
* Install pre-commit hooks to notice mistakes before the CI does it for you ;)
6469
```bash

bin/target_driver.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -e
33

44
version="$1"; shift
55

6-
sed -i "s/\"\(neo4j *== *\).*\"/\"\1$version\"/" pyproject.toml
6+
sed -i "s/\"\(neo4j *\([\[0-9a-zA-Z, \]\+]\)\? *== *\).*\"/\"\1$version\"/" pyproject.toml
77
sed -i "s/\(version *= *\)\"[0-9]\+\.[0-9]\+\.[0-9]\+\(.*\)\"/\1\"$version.0\"/" pyproject.toml
88

99
cd driver

changelog.d/44.dev.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Use dependency groups in `pyproject.toml` for development dependencies<ISSUES_LIST>.

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,38 @@ pyarrow = ["neo4j[pyarrow]"]
6161
requires = ["maturin ~= 1.9.0"]
6262
build-backend = "maturin"
6363

64+
[dependency-groups]
65+
# To install all development dependencies as well as the driver with all optional dependencies,
66+
# run `pip install --group dev -e .` inside repository root folder.
67+
dev = [
68+
# dev tools
69+
{include-group = "dep-project-dependencies"},
70+
{include-group = "tox"},
71+
{include-group = "precommit"},
72+
{include-group = "test"},
73+
{include-group = "packaging"},
74+
]
75+
tox = [
76+
"tox >= 4.25.0",
77+
]
78+
precommit = [
79+
"pre-commit >= 4.2.0",
80+
"isort >= 6.0.1",
81+
]
82+
test = [
83+
"pytest >= 8.3.5",
84+
"pytest-benchmark >= 5.1.0",
85+
]
86+
packaging = [
87+
"maturin ~= 1.9.0",
88+
"build",
89+
]
90+
91+
# single dependencies and other include-groups (not really meant to be installed as a group, but to avoid duplication)
92+
dep-project-dependencies = [
93+
"neo4j[numpy,pandas,pyarrow] == 5.28.1",
94+
]
95+
6496
[tool.maturin]
6597
features = ["pyo3/extension-module", "pyo3/generate-import-lib"]
6698
module-name = "neo4j._codec.packstream._rust"

requirements-dev.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

testkit/build.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,17 @@
1919

2020
if __name__ == "__main__":
2121
run_python(["-m", "pip", "install", "-U", "pip"])
22-
run_python(["-m", "pip", "install", "-Ur", "requirements-dev.txt"])
22+
run_python(["-m", "pip", "install", "-U", "--group", "packaging"])
23+
run_python(["-m", "build", "."])
24+
run_python(
25+
[
26+
"-m",
27+
"pip",
28+
"install",
29+
"-U",
30+
"--group",
31+
"driver/pyproject.toml:testkit",
32+
"-e",
33+
".",
34+
]
35+
)

tox.ini

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
envlist = py{310,311,312,313}-{test}
33

44
[testenv]
5-
deps = -r requirements-dev.txt
5+
dependency_groups =
6+
test
7+
extras =
8+
numpy
9+
pandas
10+
pyarrow
611
commands =
712
test: python -m pytest -v --benchmark-skip {posargs} tests

0 commit comments

Comments
 (0)