Summary
fastcore calls asyncio.iscoroutinefunction() in two places. Python 3.14 deprecates it and schedules removal for 3.16, so importing fastcore on 3.14 emits a DeprecationWarning, and on 3.16 these call sites will raise AttributeError.
Reproducing
$ python -c "import fastcore.xtras"
.../fastcore/xtras.py:1239: DeprecationWarning: 'asyncio.iscoroutinefunction'
is deprecated and slated for removal in Python 3.16; use
inspect.iscoroutinefunction() instead
return async_wrapper if asyncio.iscoroutinefunction(func) else wrapper
The xtras one fires on import, so it surfaces for anyone importing fastcore (or fasthtml) at all — including in test suites that treat warnings as errors.
Call sites
Since these are nbdev-generated, the fix belongs in the notebooks:
| Generated |
Source |
fastcore/xtras.py:1239 (flexicache) |
nbs/03_xtras.ipynb |
fastcore/parallel.py:162 (parallel_async) |
nbs/03a_parallel.ipynb |
Both are current as of 2.2.22.
Suggested fix
Swap to inspect.iscoroutinefunction, which CPython names as the replacement. I checked the substitution on 3.14.5 against the shapes these call sites see:
| callable |
asyncio. |
inspect. |
async def |
True |
True |
plain def |
False |
False |
functools.partial(async_fn) |
True |
True |
@inspect.markcoroutinefunction |
True |
True |
inspect.iscoroutinefunction has existed since 3.5 and has unwrapped functools.partial since 3.8, so this is safe across the >=3.10 range in settings.ini with no version guard.
One caveat for your judgement: the two differ for callables carrying asyncio's private _is_coroutine marker, which inspect does not consult. That's a private API, so it seems unlikely to matter here, but you'd know better than I would whether anything relies on it.
Environment
fastcore 2.2.13 and 2.2.22 · Python 3.14.5 · macOS and Ubuntu
Summary
fastcorecallsasyncio.iscoroutinefunction()in two places. Python 3.14 deprecates it and schedules removal for 3.16, so importingfastcoreon 3.14 emits aDeprecationWarning, and on 3.16 these call sites will raiseAttributeError.Reproducing
The
xtrasone fires on import, so it surfaces for anyone importingfastcore(orfasthtml) at all — including in test suites that treat warnings as errors.Call sites
Since these are nbdev-generated, the fix belongs in the notebooks:
fastcore/xtras.py:1239(flexicache)nbs/03_xtras.ipynbfastcore/parallel.py:162(parallel_async)nbs/03a_parallel.ipynbBoth are current as of 2.2.22.
Suggested fix
Swap to
inspect.iscoroutinefunction, which CPython names as the replacement. I checked the substitution on 3.14.5 against the shapes these call sites see:asyncio.inspect.async defTrueTruedefFalseFalsefunctools.partial(async_fn)TrueTrue@inspect.markcoroutinefunctionTrueTrueinspect.iscoroutinefunctionhas existed since 3.5 and has unwrappedfunctools.partialsince 3.8, so this is safe across the>=3.10range insettings.iniwith no version guard.One caveat for your judgement: the two differ for callables carrying asyncio's private
_is_coroutinemarker, whichinspectdoes not consult. That's a private API, so it seems unlikely to matter here, but you'd know better than I would whether anything relies on it.Environment
fastcore 2.2.13 and 2.2.22 · Python 3.14.5 · macOS and Ubuntu