Skip to content

Commit 2854f2a

Browse files
andystaplesCopilot
andauthored
Centralize development dependencies in pyproject.toml groups (#334)
* Centralize development dependencies in PEP 735 groups Share test tooling between Nox and the official pipeline while preserving runtime dependency resolution from built wheels. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Use Nox native dependency group resolution Resolve shared groups through nox.project helpers instead of upgrading pip in each session. Require the Nox release that introduced the group helper. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 9d5974a commit 2854f2a

12 files changed

Lines changed: 121 additions & 66 deletions

‎.github/copilot-instructions.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ python -m pymarkdown -c .pymarkdown.json scan **/*.md
167167
Install the linter via the dev dependencies:
168168

169169
```bash
170-
python -m pip install -r dev-requirements.txt
170+
python -m pip install --upgrade "pip>=25.1"
171+
python -m pip install --group lint
171172
```
172173

173174
## Building and Testing
@@ -231,7 +232,7 @@ activate or modify the per-app `.venv` directories created by Nox.
231232
- `azure-functions-durable/` — Azure Durable Functions provider source
232233
- `examples/` — example orchestrations (see `examples/README.md`)
233234
- `tests/` — test suite
234-
- `dev-requirements.txt` — development dependencies
235+
- `pyproject.toml` `[dependency-groups]` — development and CI tooling dependencies
235236

236237
## External Dependencies
237238

‎.github/workflows/durabletask-azurefunctions.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
python-version: 3.13
2525
- name: Install dependencies
2626
run: |
27-
python -m pip install --upgrade pip
28-
pip install nox
27+
python -m pip install --upgrade "pip>=25.1"
28+
python -m pip install --group nox
2929
- name: Run lint checks
3030
run: nox -s lint
3131

@@ -47,8 +47,8 @@ jobs:
4747

4848
- name: Install Nox
4949
run: |
50-
python -m pip install --upgrade pip
51-
pip install nox
50+
python -m pip install --upgrade "pip>=25.1"
51+
python -m pip install --group nox
5252
5353
- name: Run unit tests
5454
run: nox -s functions_unit-${{ matrix.python-version }}
@@ -89,8 +89,8 @@ jobs:
8989
9090
- name: Install nox
9191
run: |
92-
python -m pip install --upgrade pip
93-
pip install nox
92+
python -m pip install --upgrade "pip>=25.1"
93+
python -m pip install --group nox
9494
9595
- name: Run end-to-end tests
9696
# nox provisions each sample app's in-app virtual environment (a link to

‎.github/workflows/durabletask-azuremanaged.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
python-version: "3.15"
2525
- name: Install dependencies
2626
run: |
27-
python -m pip install --upgrade pip
28-
pip install nox
27+
python -m pip install --upgrade "pip>=25.1"
28+
python -m pip install --group nox
2929
- name: Run lint checks
3030
run: nox -s lint
3131

@@ -47,8 +47,8 @@ jobs:
4747

4848
- name: Install Nox
4949
run: |
50-
python -m pip install --upgrade pip
51-
pip install nox
50+
python -m pip install --upgrade "pip>=25.1"
51+
python -m pip install --group nox
5252
5353
- name: Run the tests
5454
run: nox -s azuremanaged_tests-${{ matrix.python-version }}

‎.github/workflows/durabletask.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ jobs:
2424
python-version: "3.15"
2525
- name: Install dependencies
2626
run: |
27-
python -m pip install --upgrade pip
28-
pip install nox
27+
python -m pip install --upgrade "pip>=25.1"
28+
python -m pip install --group nox
2929
- name: Run lint checks
3030
run: nox -s lint
3131

@@ -61,8 +61,8 @@ jobs:
6161

6262
- name: Install Nox
6363
run: |
64-
python -m pip install --upgrade pip
65-
pip install nox
64+
python -m pip install --upgrade "pip>=25.1"
65+
python -m pip install --group nox
6666
6767
- name: Pytest unit tests
6868
run: nox -s core_tests-${{ matrix.python-version }}

‎.github/workflows/typecheck.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929

3030
- name: Install packages and dependencies
3131
run: |
32-
python -m pip install --upgrade pip
33-
pip install nox
32+
python -m pip install --upgrade "pip>=25.1"
33+
python -m pip install --group nox
3434
3535
- name: Run pyright (strict, Python 3.11)
3636
run: nox -s typecheck_core
@@ -48,8 +48,8 @@ jobs:
4848

4949
- name: Install packages and dependencies
5050
run: |
51-
python -m pip install --upgrade pip
52-
pip install nox
51+
python -m pip install --upgrade "pip>=25.1"
52+
python -m pip install --group nox
5353
5454
- name: Run pyright (strict, Python 3.13)
5555
run: nox -s typecheck_functions

‎Makefile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
init:
2-
pip3 install -r requirements.txt
2+
python3 -m pip install --upgrade "pip>=25.1"
3+
python3 -m pip install --group dev -e ".[azure-blob-payloads,opentelemetry]" -e ./durabletask-azuremanaged
34

45
test:
56
pytest --verbose

‎dev-requirements.txt‎

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

‎docs/development.md‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,39 @@ The following is more information about how to develop this project.
77
Use Nox to run the representative local correctness checks:
88

99
```sh
10-
python -m pip install -r dev-requirements.txt
10+
python -m pip install --upgrade "pip>=25.1"
11+
python -m pip install --group nox
1112
nox -s ci
1213
```
1314

15+
Development dependencies are defined once in the root `pyproject.toml` under
16+
`[dependency-groups]` (PEP 735). Installing groups directly with pip requires
17+
pip 25.1 or later. Nox uses its built-in group resolver to install each session's
18+
tools without upgrading pip inside the session. The official build uses the
19+
same `build`, `lint`, and `test` groups. Add test-only dependencies to `test`
20+
so local and official test environments stay in sync. Keep runtime dependencies
21+
and public extras in each package's `[project]` metadata, not in tooling groups:
22+
the official build resolves them through built wheels to catch missing
23+
declarations.
24+
25+
For development without Nox, install all tools with `--group dev` and install
26+
the local packages separately. Use Python 3.13 or later for Azure Functions:
27+
28+
```bash
29+
python -m pip install --group dev \
30+
-e ".[azure-blob-payloads,opentelemetry]" \
31+
-e ./durabletask-azuremanaged -e ./azure-functions-durable
32+
```
33+
34+
```powershell
35+
python -m pip install --group dev `
36+
-e ".[azure-blob-payloads,opentelemetry]" `
37+
-e .\durabletask-azuremanaged -e .\azure-functions-durable
38+
```
39+
40+
Sample and Function app `requirements.txt` files remain deployment inputs, not
41+
the source of repository development dependencies.
42+
1443
The `ci` session runs linting, strict type checks, core SDK and Azure Managed
1544
tests on Python 3.11, Azure Functions unit tests on Python 3.13, and Azure
1645
Functions end-to-end tests on Python 3.13. It intentionally runs one
@@ -115,7 +144,8 @@ These commands require `make`. If you're using Windows, you can install `make`
115144
using [Chocolatey](https://chocolatey.org/) or use WSL.
116145

117146
```sh
118-
pip3 install -r dev-requirements.txt
147+
python -m pip install --upgrade "pip>=25.1"
148+
python -m pip install --group protobuf
119149
make gen-proto
120150
```
121151

‎eng/templates/build.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
# that a wheel which accidentally drops a declared dependency surfaces
3232
# the missing dep instead of being silently masked.
3333
- script: |
34-
python -m pip install --upgrade pip
35-
python -m pip install build flake8 pytest pytest-asyncio
34+
python -m pip install --upgrade "pip>=25.1"
35+
python -m pip install --group build --group lint --group test
3636
displayName: "Install build tooling"
3737
3838
# Lint core SDK
@@ -78,7 +78,7 @@ jobs:
7878
# intentional: if a wheel ever accidentally drops a declared
7979
# dependency, this step will surface the missing dependency at install
8080
# or test time instead of being masked by a preinstalled
81-
# requirements.txt. Test-only tools (pytest, pytest-asyncio) are
81+
# development environment. Test-only tools from the shared test group are
8282
# already installed in the "Install build tooling" step above.
8383
#
8484
# >>> MAINTENANCE NOTE <<<

‎noxfile.py‎

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@
5050
DEFAULT_CI_PYTHON = "3.11"
5151

5252

53+
def _install_groups(session: nox.Session, *groups: str) -> None:
54+
"""Install shared tooling without preinstalling SDK runtime dependencies."""
55+
pyproject = nox.project.load_toml(REPO_ROOT / "pyproject.toml")
56+
session.install(*nox.project.dependency_groups(pyproject, *groups))
57+
58+
5359
def _install_packages(session: nox.Session, editable: bool = False) -> None:
5460
"""Install durabletask and the azure-functions-durable provider.
5561
@@ -291,7 +297,7 @@ def _stop_dts_emulator(container_name: str) -> None:
291297
@nox.session
292298
def lint(session: nox.Session) -> None:
293299
"""Run Flake8 and Ruff modernization checks without replacing formatting."""
294-
session.install("flake8", "ruff")
300+
_install_groups(session, "lint")
295301
targets = session.posargs or (
296302
"durabletask",
297303
"durabletask-azuremanaged",
@@ -309,27 +315,19 @@ def lint(session: nox.Session) -> None:
309315
@nox.session(python=["3.11"])
310316
def typecheck_core(session: nox.Session) -> None:
311317
"""Run strict pyright checks for the core and Azure Managed packages."""
312-
session.install("-r", "requirements.txt")
313-
session.install("-r", "examples/requirements.txt")
314-
for requirements in sorted((REPO_ROOT / "examples").glob("*/requirements.txt")):
315-
session.install("-r", str(requirements))
318+
_install_groups(session, "test", "typecheck", "examples")
316319
session.install(
317-
"--force-reinstall",
318-
"--no-deps",
319-
str(REPO_ROOT),
320+
f"{REPO_ROOT}[azure-blob-payloads,opentelemetry]",
320321
str(AZUREMANAGED),
321322
)
322-
session.install(f"{REPO_ROOT}[azure-blob-payloads,opentelemetry]")
323-
session.install("pyright")
324323
session.run("pyright", *session.posargs)
325324

326325

327326
@nox.session(python=["3.13"])
328327
def typecheck_functions(session: nox.Session) -> None:
329328
"""Run strict pyright checks for azure-functions-durable."""
330-
session.install("-r", "requirements.txt")
329+
_install_groups(session, "test", "typecheck")
331330
_install_packages(session, editable=True)
332-
session.install("pyright")
333331
session.run(
334332
"pyright",
335333
"-p",
@@ -341,7 +339,7 @@ def typecheck_functions(session: nox.Session) -> None:
341339
@nox.session(python=["3.13"])
342340
def typecheck_functions_package(session: nox.Session) -> None:
343341
"""Check the installed Functions and core wheels with strict Pyright."""
344-
session.install("build", "pyright")
342+
_install_groups(session, "build", "typecheck")
345343
temp_dir = Path(session.create_tmp())
346344
artifact_dir = temp_dir / "functions-dist"
347345
core_artifact_dir = temp_dir / "core-dist"
@@ -401,7 +399,9 @@ def typecheck_functions_package(session: nox.Session) -> None:
401399
"-c",
402400
"import sys; print(sys.executable)",
403401
silent=True,
404-
).strip()
402+
)
403+
assert python_path is not None
404+
python_path = python_path.strip()
405405
session.run(
406406
"pyright",
407407
"--pythonpath",
@@ -420,8 +420,8 @@ def core_tests(session: nox.Session) -> None:
420420
arguments=("--silent", "--blobPort", "10000"),
421421
)
422422
try:
423-
session.install("-r", "requirements.txt")
424-
session.install("-e", f"{REPO_ROOT}[azure-blob-payloads]", "aiohttp")
423+
_install_groups(session, "test")
424+
session.install("-e", f"{REPO_ROOT}[azure-blob-payloads,opentelemetry]")
425425
arguments = _pytest_arguments("tests/durabletask", session.posargs)
426426
session.run(
427427
"pytest",
@@ -442,8 +442,7 @@ def azuremanaged_tests(session: nox.Session) -> None:
442442
try:
443443
session.env["TASKHUB"] = "default"
444444
session.env["ENDPOINT"] = endpoint
445-
session.install("-r", "requirements.txt")
446-
session.install("-r", "examples/requirements.txt")
445+
_install_groups(session, "test")
447446
session.install(
448447
"-e",
449448
str(REPO_ROOT),
@@ -465,9 +464,8 @@ def azuremanaged_tests(session: nox.Session) -> None:
465464
@nox.session(python=["3.13", "3.14", "3.15"])
466465
def functions_unit(session: nox.Session) -> None:
467466
"""Run the azure-functions-durable unit tests (no func/azurite required)."""
468-
session.install("-r", "requirements.txt")
467+
_install_groups(session, "test")
469468
_install_packages(session, editable=True)
470-
session.install("pytest")
471469
arguments = _pytest_arguments("tests/azure-functions-durable", session.posargs)
472470
session.run(
473471
"pytest", *_pytest_warning_arguments(session), *arguments,
@@ -510,10 +508,9 @@ def functions_e2e(session: nox.Session) -> None:
510508
)
511509
try:
512510
session.env["E2E_PAYLOAD_CONTAINER"] = _new_test_namespace("payloads")
513-
session.install("-r", "requirements.txt")
511+
_install_groups(session, "functions-e2e")
514512
_install_packages(session, editable=True)
515-
session.install("-e", f"{REPO_ROOT}[azure-blob-payloads]", "aiohttp")
516-
session.install("pytest", "opentelemetry-exporter-otlp-proto-grpc")
513+
session.install("-e", f"{REPO_ROOT}[azure-blob-payloads]")
517514
for app in E2E_APPS:
518515
_link_app_venv(session, E2E_APPS_DIR / app)
519516
arguments = _pytest_arguments(

0 commit comments

Comments
 (0)