azure-functions 2.0 readiness¶
This document is the canonical tracker for the azure-functions dependency cap
in azure-functions-validation (and, by extension, the wider Azure Functions
Python DX Toolkit). It records why the cap exists, what has to be
verified before it is lifted, and how to detect a break against a candidate
azure-functions 2.x release.
Status: cap partially lifted, split by interpreter. This package now ships
azure-functions>=1.17,<2.0.0on Python < 3.13 andazure-functions>=1.17,<3.0.0on Python >= 3.13, so 2.x is already installable by users on 3.13+.azure-functions2.x declaresRequires-Python >=3.13, which is why the split exists.Because 2.x is installable today, the
azure-functions 2.x compat (Py 3.13)lane is now wired intoci-requiredand gates merges. It was advisory only while the cap held at<2.0.0.Real-Azure certification of the 2.x path remains outstanding. See
tests/test_worker_compat_2x_spike.pyfor the opt-in spike.
Why the cap exists¶
@validate_http replaces the user's handler with a wrapper whose visible
signature is a single req positional plus a hidden **_kw catch-all. The
Azure Functions Python worker (azure_functions_worker, specifically
index_function_app / loader.py) does not call the handler through a
stable public API — it introspects the registered callable to index it and to
build its binding map. WorkerCompat
(src/azure_functions_validation/decorator.py) exists solely to make our
wrapper survive that introspection.
Because these are worker-internal, introspection-based contracts rather than
documented public APIs, a major azure-functions release (2.0) is the most
likely place for them to change. The cap is conservative on purpose: we would
rather block an untested major than ship a silently non-registering decorator
(the failure mode is an app that deploys "successfully" but exposes zero
functions).
The five worker-internal behaviors we depend on¶
WorkerCompat.apply() shims each of these. If azure-functions 2.x preserves
all five (or WorkerCompat is updated to match 2.x), the cap can be lifted.
-
co_argcount/co_varnamestrigger-param discovery. The worker inspects the code object of the registered callable to locate the HTTP trigger parameter. A*args/**kwargs-only wrapper hasco_argcount == 0and is silently skipped, producing an empty function list on the deployed app. We declare a realreqpositional (co_argcount == 1). See_make_wrapperdocstring. -
__signature__override to hide**_kw. The worker readsinspect.signature()and rejects params "declared in Python but not in the function definition." An exposed**_kwraisesFunctionLoadError: ... {'_kw'}at load time. We setwrapper.__signature__to exposereqplus the passthrough binding params only. SeeWorkerCompat._override_signature. -
No
__wrapped__.functools.update_wrappersets__wrapped__ = func, and some worker builds follow it back to the original handler, seeco_argcount > 1, and fail to register. We copy onlySAFE_IDENTITY_ATTRSviacopy_identity_attrsand deliberately never set__wrapped__. SeeWorkerCompat._copy_safe_metadata. -
get_type_hints-based binding resolution against handler globals. The worker resolves binding annotations withget_type_hintsagainst the handler's module globals. Our wrapper lives in a different module, so we pre-resolve passthrough annotations to concrete type objects at decoration time (handles PEP 563from __future__ import annotationsstring annotations). SeeWorkerCompat._resolve_passthrough_annotations. -
reqleft unannotated. Withreq: typing.Anythe worker raisesbinding req has invalid non-type annotation; with no annotation it falls back toHttpRequesttype inference, which is what we want. We set__annotations__to the passthrough binding types only, neverreq. SeeWorkerCompat._set_annotations.
Cap-lift conditions¶
The <2.0.0 cap may be lifted to (e.g.) <3.0.0 when all of the following
hold:
- [ ] A released (non-prerelease)
azure-functions2.x is available on PyPI. - [ ] The opt-in spike (
tests/test_worker_compat_2x_spike.py) passes against that 2.x with zero newRuntimeWarning/DeprecationWarningfrom@validate_http. - [ ] A real Azure deployment (the release-certification e2e in
e2e-azure.yml) registers@validate_httphandlers and serves them — i.e. the deployed function list is non-empty and requests validate as expected. - [ ] If any of the five behaviors changed,
WorkerCompatis updated and its unit tests (tests/test_decorator.py::TestReqContextWorkerIndexingand neighbors) still lock the exposed-signature invariants.
Lifting the cap is a coordinated fleet action: the same cap lives in every DX Toolkit library (see below), and they should move together to avoid a resolver split in downstream apps.
Fleet cap inventory¶
Caps are no longer uniform. Four packages split the cap by interpreter, because
azure-functions 2.x requires Python >= 3.13; the rest hold a flat <2.0.0.
Lower bounds differ for historical reasons. Verified against each published
pyproject.toml:
| Package | Cap |
|---|---|
| azure-functions-validation | >=1.17,<2.0.0 (py<3.13) / >=1.17,<3.0.0 (py>=3.13) |
| azure-functions-openapi | >=1.21.0,<2.0.0 (py<3.13) / >=1.21.0,<3.0.0 (py>=3.13) |
| azure-functions-db | >=1.22.0,<2.0.0 (py<3.13) / >=1.22.0,<3.0.0 (py>=3.13) |
| azure-functions-langgraph | >=1.17,<2.0.0 (py<3.13) / >=1.17,<3.0.0 (py>=3.13) |
| azure-functions-scaffold | >=1.23.0,<2.0.0 |
| azure-functions-logging | no azure-functions dependency |
| azure-functions-doctor | no azure-functions dependency |
The upper bound is the load-bearing part. Lower bounds vary by the minimum feature each package needs and are not part of the 2.0 readiness contract.
How to run the spike¶
The spike is off by default — it is excluded from normal CI (-m 'not e2e
and not compat2x') and additionally gated on an environment variable so a bare
pytest -m compat2x does not accidentally reinstall azure-functions in a
developer's working environment:
# In a throwaway virtualenv — the spike may install a 2.x/prerelease build.
export AZFUNC_2X_SPIKE=1
pip install --pre --upgrade 'azure-functions>=2.0.0.dev0' # or a real 2.x when released
pytest -m compat2x -o addopts='' tests/test_worker_compat_2x_spike.py
If the spike passes cleanly, capture the azure-functions version and attach it
to the tracking issue as evidence toward the cap-lift checklist above.
CI proof lane (issue #351)¶
The spike also runs automatically as the azure-functions 2.x compat (Py 3.13)
job in .github/workflows/ci-test.yml (modeled on langgraph d433b63). That
job builds the wheel, installs it, overrides the <2.0.0 cap with
azure-functions>=2,<3, and runs the compat2x spike against the
wheel-installed package with AZFUNC_2X_SPIKE=1 and -o pythonpath=.
Gating decision — visible signal, not a merge blocker. The lane runs on
every non-docs PR so 2.x worker/loader regressions surface early, but it is
deliberately not wired into the ci-required aggregation check. Worker
compatibility is existential, yet the runtime cap stays <2.0.0 until 2.x is
certified on real Azure via e2e-azure.yml; making the lane blocking before
that certification would gate merges on an uncertified runtime (and on the
availability of a 2.x build on PyPI). Promote it to a required status check via
branch protection at the same time the cap is lifted.
A single representative 3.13 lane is used intentionally — not a version matrix —
to keep CI cost bounded, since 2.x declares Requires-Python >=3.13.