Skip to content

Commit f48c451

Browse files
Python: Simplify Python Poe tasks and unify package selectors (#4722)
* updated automation tasks and commands, with alias for the time being * Restore aggregate test exclusions Preserve the legacy all-tests scope for test --all by excluding lab and devui from the default aggregate sweep, while still allowing explicit package selection. Also ignore hidden/generated test directories such as .mypy_cache during aggregate discovery. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * updated versions in pre-commit --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d3d0100 commit f48c451

60 files changed

Lines changed: 1699 additions & 522 deletions

File tree

Some content is hidden

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

.github/workflows/python-code-quality.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
os: ${{ runner.os }}
7676
env:
7777
UV_CACHE_DIR: /tmp/.uv-cache
78-
- name: Run fmt, lint, pyright in parallel across packages
78+
- name: Run syntax and pyright across packages
7979
run: uv run poe check-packages
8080

8181
samples-markdown:
@@ -104,10 +104,8 @@ jobs:
104104
os: ${{ runner.os }}
105105
env:
106106
UV_CACHE_DIR: /tmp/.uv-cache
107-
- name: Run samples lint
108-
run: uv run poe samples-lint
109-
- name: Run samples syntax check
110-
run: uv run poe samples-syntax
107+
- name: Run samples checks
108+
run: uv run poe check -S
111109
- name: Run markdown code lint
112110
run: uv run poe markdown-code-lint
113111

@@ -140,4 +138,4 @@ jobs:
140138
- name: Run Mypy
141139
env:
142140
GITHUB_BASE_REF: ${{ github.event.pull_request.base.ref || github.base_ref || 'main' }}
143-
run: uv run poe ci-mypy
141+
run: uv run python scripts/workspace_poe_tasks.py ci-mypy

.github/workflows/python-dependency-range-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
id: validate_ranges
3939
# Keep workflow running so we can still publish diagnostics from this run.
4040
continue-on-error: true
41-
run: uv run poe validate-dependency-bounds-project --mode upper --project "*"
41+
run: uv run poe validate-dependency-bounds-project --mode upper --package "*"
4242
working-directory: ./python
4343

4444
- name: Upload dependency range report
@@ -203,7 +203,7 @@ jobs:
203203
cat > "${PR_BODY_FILE}" <<'EOF'
204204
This PR was generated by the dependency range validation workflow.
205205
206-
- Ran `uv run poe validate-dependency-bounds-project --mode upper --project "*"`
206+
- Ran `uv run poe validate-dependency-bounds-project --mode upper --package "*"`
207207
- Updated package dependency bounds
208208
- Refreshed `python/uv.lock` with `uv lock --upgrade`
209209
EOF

.github/workflows/python-integration-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ jobs:
4848
os: ${{ runner.os }}
4949
- name: Test with pytest (unit tests only)
5050
run: >
51-
uv run poe all-tests
51+
uv run poe test -A
5252
-m "not integration"
53-
-n logical --dist worksteal
5453
--timeout=120 --session-timeout=900 --timeout_method thread
5554
--retries 2 --retry-delay 5
5655

.github/workflows/python-merge-tests.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ jobs:
100100
os: ${{ runner.os }}
101101
- name: Test with pytest (unit tests only)
102102
run: >
103-
uv run poe all-tests
103+
uv run poe test -A
104104
-m "not integration"
105-
-n logical --dist worksteal
106105
--timeout=120 --session-timeout=900 --timeout_method thread
107106
--retries 2 --retry-delay 5
108107
working-directory: ./python

.github/workflows/python-test-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
id: python-setup
3333
uses: ./.github/actions/python-setup
3434
with:
35-
python-version: ${{ matrix.python-version }}
35+
python-version: ${{ env.UV_PYTHON }}
3636
os: ${{ runner.os }}
3737
env:
3838
# Configure a constant location for the uv cache
3939
UV_CACHE_DIR: /tmp/.uv-cache
4040
- name: Run all tests with coverage report
41-
run: uv run poe all-tests-cov --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
41+
run: uv run poe test -A -C --cov-report=xml:python-coverage.xml -q --junitxml=pytest.xml
4242
- name: Check coverage threshold
4343
run: python ${{ github.workspace }}/.github/workflows/python-check-coverage.py python-coverage.xml ${{ env.COVERAGE_THRESHOLD }}
4444
- name: Upload coverage report

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
UV_CACHE_DIR: /tmp/.uv-cache
4141
# Unit tests
4242
- name: Run all tests
43-
run: uv run poe all-tests ${{ matrix.python-version == '3.10' && '--ignore-glob=packages/github_copilot/**' || '' }}
43+
run: uv run poe test -A
4444
working-directory: ./python
4545

4646
# Surface failing tests

python/.github/skills/python-code-quality/SKILL.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,43 @@ description: >
1313
All commands run from the `python/` directory:
1414

1515
```bash
16-
# Format code (ruff format, parallel across packages)
17-
uv run poe fmt
18-
19-
# Lint and auto-fix (ruff check, parallel across packages)
20-
uv run poe lint
16+
# Syntax formatting + checks (parallel across packages by default)
17+
uv run poe syntax
18+
uv run poe syntax -P core
19+
uv run poe syntax -F # Format only
20+
uv run poe syntax -C # Check only
21+
uv run poe syntax -S # Samples only
2122

2223
# Type checking
23-
uv run poe pyright # Pyright (parallel across packages)
24-
uv run poe mypy # MyPy (parallel across packages)
24+
uv run poe pyright # Pyright fan-out across packages
25+
uv run poe pyright -P core
26+
uv run poe pyright -A
27+
uv run poe mypy # MyPy fan-out across packages
28+
uv run poe mypy -P core
29+
uv run poe mypy -A
2530
uv run poe typing # Both pyright and mypy
31+
uv run poe typing -P core
32+
uv run poe typing -A
2633

27-
# All package-level checks in parallel (fmt + lint + pyright + mypy)
34+
# All package-level checks in parallel (syntax + pyright)
2835
uv run poe check-packages
2936

3037
# Full check (packages + samples + tests + markdown)
3138
uv run poe check
39+
uv run poe check -P core
3240

3341
# Samples only
34-
uv run poe samples-lint # Ruff lint on samples/
35-
uv run poe samples-syntax # Pyright syntax check on samples/
42+
uv run poe check -S
43+
uv run poe pyright -S
3644

3745
# Markdown code blocks
3846
uv run poe markdown-code-lint
3947
```
4048

4149
## Pre-commit Hooks (prek)
4250

43-
Prek hooks run automatically on commit. They check only changed files and run
44-
package-level checks in parallel for affected packages only.
51+
Prek hooks run automatically on commit. They stay lightweight and only check
52+
changed files.
4553

4654
```bash
4755
# Install hooks
@@ -54,8 +62,10 @@ uv run prek run -a
5462
uv run prek run --last-commit
5563
```
5664

57-
When core package changes, type-checking (mypy, pyright) runs across all packages
58-
since type changes propagate. Format and lint only run in changed packages.
65+
They run changed-package syntax formatting/checking, markdown code lint only
66+
when markdown files change, and sample syntax lint/pyright only when files
67+
under `samples/` change.
68+
They intentionally do not run workspace `pyright` or `mypy` by default.
5969

6070
## Ruff Configuration
6171

@@ -80,6 +90,6 @@ in-process with streaming output.
8090

8191
CI splits into 4 parallel jobs:
8292
1. **Pre-commit hooks** — lightweight hooks (SKIP=poe-check)
83-
2. **Package checks**fmt/lint/pyright via check-packages
84-
3. **Samples & markdown**samples-lint, samples-syntax, markdown-code-lint
93+
2. **Package checks**syntax/pyright via check-packages
94+
3. **Samples & markdown**`check -S` plus `markdown-code-lint`
8595
4. **Mypy** — change-detected mypy checks

python/.github/skills/python-package-management/SKILL.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ uv run poe upgrade-dev-dependencies
4747

4848
# First, run workspace-wide lower/upper compatibility gates
4949
uv run poe validate-dependency-bounds-test
50-
# Defaults to --project "*"; pass a package to scope test mode
51-
uv run poe validate-dependency-bounds-test --project <workspace-package-name>
50+
# Defaults to --package "*"; pass a package to scope test mode
51+
uv run poe validate-dependency-bounds-test --package core
5252

5353
# Then expand bounds for one dependency in the target package
54-
uv run poe validate-dependency-bounds-project --mode both --project <workspace-package-name> --dependency "<dependency-name>"
54+
uv run poe validate-dependency-bounds-project --mode both --package core --dependency "<dependency-name>"
5555

5656
# Repo-wide automation can reuse the same task
57-
uv run poe validate-dependency-bounds-project --mode upper --project "*"
57+
uv run poe validate-dependency-bounds-project --mode upper --package "*"
5858

5959
# Add a dependency to one project and run both validators for that project/dependency
60-
uv run poe add-dependency-and-validate-bounds --project <workspace-package-name> --dependency "<dependency-spec>"
60+
uv run poe add-dependency-and-validate-bounds --package core --dependency "<dependency-spec>"
6161
```
6262

6363
### Dependency Bound Notes
@@ -66,7 +66,7 @@ uv run poe add-dependency-and-validate-bounds --project <workspace-package-name>
6666
- Prerelease (`dev`/`a`/`b`/`rc`) and `<1.0` dependencies should use hard bounds with an explicit upper cap (avoid open-ended ranges).
6767
- For `<1.0` dependencies, prefer the broadest validated range the package can really support. That may be a patch line, a minor line, or multiple minor lines when checks/tests show the broader lane is compatible.
6868
- Prefer supporting multiple majors when practical; if APIs diverge across supported majors, use version-conditional imports/paths.
69-
- For dependency changes, run workspace-wide bound gates first, then `validate-dependency-bounds-project --mode both` for the target package/dependency to keep minimum and maximum constraints current. The same task can also drive repo-wide upper-bound automation by using `--project "*"` and omitting `--dependency`.
69+
- For dependency changes, run workspace-wide bound gates first, then `validate-dependency-bounds-project --mode both` for the target package/dependency to keep minimum and maximum constraints current. The same task can also drive repo-wide upper-bound automation by using `--package "*"` and omitting `--dependency`.
7070
- Prefer targeted lock updates with `uv lock --upgrade-package <dependency-name>` to reduce `uv.lock` merge conflicts.
7171
- Use `add-dependency-and-validate-bounds` for package-scoped dependency additions plus bound validation in one command.
7272
- Use `upgrade-dev-dependencies` for repo-wide dev tooling refreshes; it repins dev dependencies, refreshes `uv.lock`, and reruns `check`, `typing`, and `test`.
@@ -108,12 +108,12 @@ def __getattr__(name: str) -> Any:
108108
Recommended dependency workflow during connector implementation:
109109

110110
1. Add the dependency to the target package:
111-
`uv run poe add-dependency-to-project --project <workspace-package-name> --dependency "<dependency-spec>"`
111+
`uv run poe add-dependency-to-project --package core --dependency "<dependency-spec>"`
112112
2. Implement connector code and tests.
113113
3. Validate dependency bounds for that package/dependency:
114-
`uv run poe validate-dependency-bounds-project --mode both --project <workspace-package-name> --dependency "<dependency-name>"`
114+
`uv run poe validate-dependency-bounds-project --mode both --package core --dependency "<dependency-name>"`
115115
4. If the package has meaningful tests/checks that validate dependency compatibility, you can use the add + validation flow in one command:
116-
`uv run poe add-dependency-and-validate-bounds --project <workspace-package-name> --dependency "<dependency-spec>"`
116+
`uv run poe add-dependency-and-validate-bounds --package core --dependency "<dependency-spec>"`
117117
If compatibility checks are not in place yet, add the dependency first, then implement tests before running bound validation.
118118

119119
### Promotion to Stable

python/.github/skills/python-samples/SKILL.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@ Do **not** add sample-only dependencies to the root `pyproject.toml` dev group.
4141
## Syntax Checking
4242

4343
```bash
44+
# Format + lint samples
45+
uv run poe syntax -S
46+
4447
# Check samples for syntax errors and missing imports
45-
uv run poe samples-syntax
48+
uv run poe pyright -S
4649

47-
# Lint samples
48-
uv run poe samples-lint
50+
# Lint samples only
51+
uv run poe syntax -S -C
4952
```
5053

5154
## Documentation

python/.github/skills/python-testing/SKILL.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,35 @@ We run tests in two stages, for a PR each commit is tested with unit tests only
1717
# Run tests for all packages in parallel
1818
uv run poe test
1919

20-
# Run tests for a specific package
21-
uv run --directory packages/core poe test
20+
# Run tests for a specific workspace package
21+
uv run poe test -P core
2222

23-
# Run all tests in a single pytest invocation (faster, uses pytest-xdist)
24-
uv run poe all-tests
23+
# Run all selected tests in a single pytest invocation
24+
uv run poe test -A
2525

2626
# With coverage
27-
uv run poe all-tests-cov
27+
uv run poe test -A -C
28+
uv run poe test -P core -C
2829

2930
# Run only unit tests (exclude integration tests)
30-
uv run poe all-tests -m "not integration"
31+
uv run poe test -A -m "not integration"
3132

3233
# Run only integration tests
33-
uv run poe all-tests -m integration
34+
uv run poe test -A -m integration
35+
```
36+
37+
Direct package execution still works when you need it:
38+
39+
```bash
40+
uv run --directory packages/core poe test
3441
```
3542

3643
## Test Configuration
3744

3845
- **Async mode**: `asyncio_mode = "auto"` is enabled — do NOT use `@pytest.mark.asyncio`, but do mark tests with `async def` and use `await` for async calls
3946
- **Timeout**: Default 60 seconds per test
4047
- **Import mode**: `importlib` for cross-package isolation
41-
- **Parallelization**: Large packages (core, ag-ui, orchestrations, anthropic) use `pytest-xdist` (`-n auto --dist worksteal`) in their `poe test` task. The `all-tests` task also uses xdist across all packages.
48+
- **Parallelization**: Large packages (core, ag-ui, orchestrations, anthropic) use `pytest-xdist` (`-n auto --dist worksteal`) in their `poe test` task. The aggregate `uv run poe test -A` sweep also uses xdist across the selected packages.
4249

4350
## Test Directory Structure
4451

0 commit comments

Comments
 (0)