mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: chore(python): improve dependency range automation (#4343)
* chore(python): improve dependency range automation - tighten dependency bounds and coding standards guidance\n- add dependency range validation workflow, reporting, and issue automation\n- update related tests and dependency pins for compatibility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * updated text and pyarrow * new lock * fixed workflow * updated deps * fix tiktoken * chore(python): refine dependency validation workflows Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * docs(python): add high-level dependency validation comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * WIP * added additional comments and excludes * added dev dependency handling and workflow and updates to package ranges * added readme and simplified commands * fix markers * chore(python): address dependency review feedback Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Tighten dependency bounds, remove stale overrides, restore Python 3.10 support - Apply dependency bound policy across all packages: stable >=1.0 deps use >=floor,<next_major; pre-1.0/prerelease deps use validated hard-bounded ranges - Remove stale root tool.uv.override-dependencies (uvicorn, websockets, grpcio) - Lower github_copilot requires-python to >=3.10 with github-copilot-sdk gated behind python_version >= 3.11 marker; import raises ImportError on 3.10 - Skip github_copilot pyright/mypy/test tasks on Python <3.11 - Use version-conditional pyrightconfig for samples on Python 3.10 - Add compatibility fix in core responses client for older openai typed dicts - Normalize uv.lock prerelease mode and refresh dev dependencies - Update CODING_STANDARD.md, DEV_SETUP.md, and package management skill docs Closes #902 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * small tweaks * add note in workflow * fix workflows and several versions * fix duplicate --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
67b0282813
commit
50fdcbaf57
+70
-31
@@ -28,22 +28,22 @@ dependencies = [
|
||||
|
||||
[dependency-groups]
|
||||
dev = [
|
||||
"uv>=0.9,<1.0.0",
|
||||
"flit>=3.12.0",
|
||||
"ruff>=0.11.8",
|
||||
"pytest>=8.4.1",
|
||||
"pytest-asyncio>=1.0.0",
|
||||
"pytest-cov>=6.2.1",
|
||||
"pytest-xdist[psutil]>=3.8.0",
|
||||
"pytest-timeout>=2.3.1",
|
||||
"pytest-retry>=1",
|
||||
"mypy>=1.16.1",
|
||||
"pyright>=1.1.402",
|
||||
"uv==0.10.9",
|
||||
"flit==3.12.0",
|
||||
"ruff==0.15.5",
|
||||
"pytest==9.0.2",
|
||||
"pytest-asyncio==1.3.0",
|
||||
"pytest-cov==7.0.0",
|
||||
"pytest-xdist[psutil]==3.8.0",
|
||||
"pytest-timeout==2.4.0",
|
||||
"pytest-retry==1.7.0",
|
||||
"mypy==1.19.1",
|
||||
"pyright==1.1.408",
|
||||
#tasks
|
||||
"poethepoet>=0.36.0",
|
||||
"rich",
|
||||
"tomli",
|
||||
"prek>=0.3.2",
|
||||
"poethepoet==0.42.1",
|
||||
"rich==13.7.1",
|
||||
"tomli==2.4.0",
|
||||
"prek==0.3.4",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
@@ -54,18 +54,6 @@ environments = [
|
||||
"sys_platform == 'linux'",
|
||||
"sys_platform == 'win32'"
|
||||
]
|
||||
override-dependencies = [
|
||||
# A conflict between the dependency of litellm[proxy] < 0.30.0, which is a dependency of agent-lightning
|
||||
# and uvicorn >= 0.34.0, which is a dependency of tau2
|
||||
"uvicorn==0.38.0",
|
||||
# Similar problem with websockets, which is a dependency conflict between litellm[proxy] and mcp
|
||||
"websockets==15.0.1",
|
||||
# grpcio 1.67.x has no Python 3.14 wheels; grpcio 1.76.0+ supports Python 3.14
|
||||
# litellm constrains grpcio<1.68.0 due to resource exhaustion bug (https://github.com/grpc/grpc/issues/38290)
|
||||
# Use version-specific overrides to satisfy both constraints
|
||||
"grpcio>=1.76.0; python_version >= '3.14'",
|
||||
"grpcio>=1.62.3,<1.68.0; python_version < '3.14'",
|
||||
]
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = [ "packages/*" ]
|
||||
@@ -149,8 +137,6 @@ ignore = [
|
||||
"**/tests/**" = ["D", "INP", "TD", "ERA001", "RUF", "S"]
|
||||
"samples/**" = ["D", "INP", "ERA001", "RUF", "S", "T201", "CPY"]
|
||||
"*.ipynb" = ["CPY", "E501"]
|
||||
# RUF070: Assignment before yield is intentional - context manager must exit before yielding
|
||||
"**/agent_framework/_workflows/_workflow.py" = ["RUF070"]
|
||||
|
||||
[tool.ruff.format]
|
||||
docstring-code-format = true
|
||||
@@ -213,7 +199,7 @@ executor.type = "uv"
|
||||
[tool.poe.tasks]
|
||||
markdown-code-lint = "uv run python scripts/check_md_code_blocks.py 'README.md' './packages/**/README.md' './samples/**/*.md' --exclude cookiecutter-agent-framework-lab --exclude tau2 --exclude 'packages/devui/frontend' --exclude context_providers/azure_ai_search"
|
||||
prek-install = "prek install --overwrite"
|
||||
install = "uv sync --all-packages --all-extras --dev -U --prerelease=if-necessary-or-explicit"
|
||||
install = "uv sync --all-packages --all-extras --dev --frozen --prerelease=if-necessary-or-explicit"
|
||||
test = "python scripts/run_tasks_in_packages_if_exists.py test"
|
||||
fmt = "python scripts/run_tasks_in_packages_if_exists.py fmt"
|
||||
format.ref = "fmt"
|
||||
@@ -221,8 +207,9 @@ lint = "python scripts/run_tasks_in_packages_if_exists.py lint"
|
||||
samples-lint = "ruff check samples --fix --exclude samples/autogen-migration,samples/semantic-kernel-migration --ignore E501,ASYNC,B901,TD002"
|
||||
pyright = "python scripts/run_tasks_in_packages_if_exists.py pyright"
|
||||
mypy = "python scripts/run_tasks_in_packages_if_exists.py mypy"
|
||||
samples-syntax = "pyright -p pyrightconfig.samples.json --warnings"
|
||||
typing = "python scripts/run_tasks_in_packages_if_exists.py mypy pyright"
|
||||
samples-syntax.shell = "pyright -p $(python -c \"import sys; print('pyrightconfig.samples.py310.json' if sys.version_info < (3,11) else 'pyrightconfig.samples.json')\") --warnings"
|
||||
samples-syntax.interpreter = "posix"
|
||||
# cleaning
|
||||
clean-dist-packages = "python scripts/run_tasks_in_packages_if_exists.py clean-dist"
|
||||
clean-dist-meta = "rm -rf dist"
|
||||
@@ -287,6 +274,58 @@ sequence = [
|
||||
]
|
||||
args = [{ name = "python", default = "3.13", options = ['-p', '--python'] }]
|
||||
|
||||
[tool.poe.tasks.upgrade-dev-dependency-pins]
|
||||
cmd = "python -m scripts.dependencies.upgrade_dev_dependencies"
|
||||
|
||||
[tool.poe.tasks.upgrade-lockfile]
|
||||
cmd = "uv lock --upgrade"
|
||||
|
||||
[tool.poe.tasks.upgrade-dev-dependencies]
|
||||
sequence = [
|
||||
{ ref = "upgrade-dev-dependency-pins" },
|
||||
{ ref = "upgrade-lockfile" },
|
||||
{ ref = "install" },
|
||||
{ ref = "check" },
|
||||
{ ref = "typing" },
|
||||
{ ref = "test" },
|
||||
]
|
||||
|
||||
[tool.poe.tasks.add-dependency-to-project]
|
||||
cmd = "uv add --package ${project} ${dependency}"
|
||||
args = [
|
||||
{ name = "project", options = ["-p", "--project"] },
|
||||
{ name = "dependency", options = ["-d", "--dependency"] },
|
||||
]
|
||||
|
||||
[tool.poe.tasks.validate-dependency-bounds-test]
|
||||
shell = "python -m scripts.dependencies.validate_dependency_bounds --mode test --package \"$project\""
|
||||
args = [{ name = "project", default = "*", options = ["-p", "--project"] }]
|
||||
|
||||
[tool.poe.tasks.validate-dependency-bounds-project]
|
||||
shell = """
|
||||
command=(python -m scripts.dependencies.validate_dependency_bounds --mode "${mode}" --package "${project}")
|
||||
if [ -n "${dependency}" ]; then
|
||||
command+=(--dependencies "${dependency}")
|
||||
fi
|
||||
"${command[@]}"
|
||||
"""
|
||||
interpreter = "bash"
|
||||
args = [
|
||||
{ name = "mode", default = "both", options = ["-m", "--mode"] },
|
||||
{ name = "project", default = "*", options = ["-p", "--project"] },
|
||||
{ name = "dependency", default = "", options = ["-d", "--dependency"] },
|
||||
]
|
||||
|
||||
[tool.poe.tasks.add-dependency-and-validate-bounds]
|
||||
sequence = [
|
||||
{ ref = "add-dependency-to-project --project ${project} --dependency ${dependency}" },
|
||||
{ ref = "validate-dependency-bounds-project --mode both --project ${project} --dependency ${dependency}" },
|
||||
]
|
||||
args = [
|
||||
{ name = "project", options = ["-p", "--project"] },
|
||||
{ name = "dependency", options = ["-d", "--dependency"] },
|
||||
]
|
||||
|
||||
[tool.poe.tasks.prek-pyright]
|
||||
cmd = "uv run python scripts/run_tasks_in_changed_packages.py pyright --files ${files}"
|
||||
args = [{ name = "files", default = ".", positional = true, multiple = true }]
|
||||
|
||||
Reference in New Issue
Block a user