Skip to content

Commit e2d29d7

Browse files
committed
fixes #850
1 parent 0ed6379 commit e2d29d7

4 files changed

Lines changed: 14 additions & 7 deletions

File tree

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
55

6-
## fastcore v2
7-
8-
In July 2026 we released fastcore v2, which removes or relocates a number of APIs that had accumulated better alternatives. If you use `from fastcore.utils import *` (or `fastcore.all`), most of these changes won’t affect you. The breaking changes: `Param` is gone from `fastcore.script`; use plain type annotations with docments, or `typing.Annotated[type, "help"]`, optionally with a `dict` of argparse arguments for advanced features. [`L`](https://fastcore.fast.ai/foundation.html#l)’s `starmap`, `starfilter`, and the other `star*`/`rstar*` methods are replaced by the [`star`](https://fastcore.fast.ai/foundation.html#star) and [`rstar`](https://fastcore.fast.ai/foundation.html#rstar) function adapters, which compose with every [`L`](https://fastcore.fast.ai/foundation.html#l) method (e.g. `t.map(star(f))`); relatedly, `spread` is replaced by [`star`](https://fastcore.fast.ai/foundation.html#star), and `dspread` is renamed to [`dstar`](https://fastcore.fast.ai/basics.html#dstar). Async helpers now live in the new `fastcore.aio` module: [`run_sync`](https://fastcore.fast.ai/aio.html#run_sync), [`iter_sync`](https://fastcore.fast.ai/aio.html#iter_sync), and [`ctx_sync`](https://fastcore.fast.ai/aio.html#ctx_sync) moved there from `net`, and [`maybe_await`](https://fastcore.fast.ai/aio.html#maybe_await), [`then`](https://fastcore.fast.ai/aio.html#then), [`mapa`](https://fastcore.fast.ai/aio.html#mapa), [`acache`](https://fastcore.fast.ai/aio.html#acache), [`reawaitable`](https://fastcore.fast.ai/aio.html#reawaitable), [`is_async_callable`](https://fastcore.fast.ai/aio.html#is_async_callable), and the other async utilities moved there from `xtras`. [`Config`](https://fastcore.fast.ai/xtras.html#config) and the config file functions moved from `foundation` to `xtras`. `fastcore.net` lost its request builders (`urlrequest`, `urlsend`, `do_request`, `urlcheck`) and `clean_type_str` is gone. `parallel_gen` is removed; the stdlib [`ProcessPoolExecutor`](https://fastcore.fast.ai/parallel.html#processpoolexecutor) `initializer` pattern replaces it (fastai’s `parallel_tokenize` shows the recipe). Python 3.11 or later is now required. If you need the old APIs, pin `fastcore<2`.
6+
> [!NOTE]
7+
>
8+
> ### fastcore v2
9+
>
10+
> In July 2026 we released fastcore v2, which removes or relocates a number of APIs that had accumulated better alternatives. If you use `from fastcore.utils import *` (or `fastcore.all`), most of these changes won’t affect you. The breaking changes: `Param` is gone from `fastcore.script`; use plain type annotations with docments, or `typing.Annotated[type, "help"]`, optionally with a `dict` of argparse arguments for advanced features. [`L`](https://fastcore.fast.ai/foundation.html#l)’s `starmap`, `starfilter`, and the other `star*`/`rstar*` methods are replaced by the [`star`](https://fastcore.fast.ai/foundation.html#star) and [`rstar`](https://fastcore.fast.ai/foundation.html#rstar) function adapters, which compose with every [`L`](https://fastcore.fast.ai/foundation.html#l) method (e.g. `t.map(star(f))`); relatedly, `spread` is replaced by [`star`](https://fastcore.fast.ai/foundation.html#star), and `dspread` is renamed to [`dstar`](https://fastcore.fast.ai/basics.html#dstar). Async helpers now live in the new `fastcore.aio` module: [`run_sync`](https://fastcore.fast.ai/aio.html#run_sync), [`iter_sync`](https://fastcore.fast.ai/aio.html#iter_sync), and [`ctx_sync`](https://fastcore.fast.ai/aio.html#ctx_sync) moved there from `net`, and [`maybe_await`](https://fastcore.fast.ai/aio.html#maybe_await), [`then`](https://fastcore.fast.ai/aio.html#then), [`mapa`](https://fastcore.fast.ai/aio.html#mapa), [`acache`](https://fastcore.fast.ai/aio.html#acache), [`reawaitable`](https://fastcore.fast.ai/aio.html#reawaitable), [`is_async_callable`](https://fastcore.fast.ai/aio.html#is_async_callable), and the other async utilities moved there from `xtras`. [`Config`](https://fastcore.fast.ai/xtras.html#config) and the config file functions moved from `foundation` to `xtras`. `fastcore.net` lost its request builders (`urlrequest`, `urlsend`, `do_request`, `urlcheck`) and `clean_type_str` is gone. `parallel_gen` is removed; the stdlib [`ProcessPoolExecutor`](https://fastcore.fast.ai/parallel.html#processpoolexecutor) `initializer` pattern replaces it (fastai’s `parallel_tokenize` shows the recipe). Python 3.11 or later is now required. If you need the old APIs, pin `fastcore<2`.
911
1012
Python is a powerful, dynamic language. Rather than bake everything into the language, it lets the programmer customize it to make it work for them. `fastcore` uses this flexibility to add to Python features inspired by other languages we’ve loved, mixins from Ruby, and currying, binding, and more from Haskell. It also adds some “missing features” and clean up some rough edges in the Python standard library, such as simplifying parallel processing, and bringing ideas from NumPy over to Python’s `list` type.
1113

fastcore/xtras.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ def mtime_policy(
11531153
if (filepath is None)==(arg is None): raise TypeError('Pass exactly one of `filepath` or `arg`')
11541154
def _expired(mtime, fp):
11551155
current_mtime = getmtime(fp)
1156-
return current_mtime if mtime is None or current_mtime>mtime else None
1156+
return current_mtime if mtime is None or current_mtime!=mtime else None
11571157
if arg is None: return lambda mtime: _expired(mtime, filepath)
11581158
def policy(mtime, args, kwargs): return _expired(mtime, kwargs[arg] if isinstance(arg,str) else args[arg])
11591159
policy.needs_args = True

nbs/03_xtras.ipynb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5291,7 +5291,7 @@
52915291
" if (filepath is None)==(arg is None): raise TypeError('Pass exactly one of `filepath` or `arg`')\n",
52925292
" def _expired(mtime, fp):\n",
52935293
" current_mtime = getmtime(fp)\n",
5294-
" return current_mtime if mtime is None or current_mtime>mtime else None\n",
5294+
" return current_mtime if mtime is None or current_mtime!=mtime else None\n",
52955295
" if arg is None: return lambda mtime: _expired(mtime, filepath)\n",
52965296
" def policy(mtime, args, kwargs): return _expired(mtime, kwargs[arg] if isinstance(arg,str) else args[arg])\n",
52975297
" policy.needs_args = True\n",
@@ -5370,11 +5370,14 @@
53705370
"fp.write_text('b')\n",
53715371
"os.utime(fp, (time()+1,)*2)\n",
53725372
"test_eq(slurp(fp), 'b')\n",
5373+
"fp.write_text('c')\n",
5374+
"os.utime(fp, (time()-1,)*2)\n",
5375+
"test_eq(slurp(fp), 'c')\n",
53735376
"\n",
53745377
"@flexicache(mtime_policy(arg='p'))\n",
53755378
"def slurp2(p=None): return p.read_text()\n",
53765379
"\n",
5377-
"test_eq(slurp2(p=fp), 'b')\n",
5380+
"test_eq(slurp2(p=fp), 'c')\n",
53785381
"fp.unlink()"
53795382
]
53805383
},

nbs/index.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
"id": "4987bac8",
2929
"metadata": {},
3030
"source": [
31+
"::: {.callout-note}\n",
3132
"## fastcore v2\n",
3233
"\n",
33-
"In July 2026 we released fastcore v2, which removes or relocates a number of APIs that had accumulated better alternatives. If you use `from fastcore.utils import *` (or `fastcore.all`), most of these changes won't affect you. The breaking changes: `Param` is gone from `fastcore.script`; use plain type annotations with docments, or `typing.Annotated[type, \"help\"]`, optionally with a `dict` of argparse arguments for advanced features. `L`'s `starmap`, `starfilter`, and the other `star*`/`rstar*` methods are replaced by the `star` and `rstar` function adapters, which compose with every `L` method (e.g. `t.map(star(f))`); relatedly, `spread` is replaced by `star`, and `dspread` is renamed to `dstar`. Async helpers now live in the new `fastcore.aio` module: `run_sync`, `iter_sync`, and `ctx_sync` moved there from `net`, and `maybe_await`, `then`, `mapa`, `acache`, `reawaitable`, `is_async_callable`, and the other async utilities moved there from `xtras`. `Config` and the config file functions moved from `foundation` to `xtras`. `fastcore.net` lost its request builders (`urlrequest`, `urlsend`, `do_request`, `urlcheck`) and `clean_type_str` is gone. `parallel_gen` is removed; the stdlib `ProcessPoolExecutor` `initializer` pattern replaces it (fastai's `parallel_tokenize` shows the recipe). Python 3.11 or later is now required. If you need the old APIs, pin `fastcore<2`."
34+
"In July 2026 we released fastcore v2, which removes or relocates a number of APIs that had accumulated better alternatives. If you use `from fastcore.utils import *` (or `fastcore.all`), most of these changes won't affect you. The breaking changes: `Param` is gone from `fastcore.script`; use plain type annotations with docments, or `typing.Annotated[type, \"help\"]`, optionally with a `dict` of argparse arguments for advanced features. `L`'s `starmap`, `starfilter`, and the other `star*`/`rstar*` methods are replaced by the `star` and `rstar` function adapters, which compose with every `L` method (e.g. `t.map(star(f))`); relatedly, `spread` is replaced by `star`, and `dspread` is renamed to `dstar`. Async helpers now live in the new `fastcore.aio` module: `run_sync`, `iter_sync`, and `ctx_sync` moved there from `net`, and `maybe_await`, `then`, `mapa`, `acache`, `reawaitable`, `is_async_callable`, and the other async utilities moved there from `xtras`. `Config` and the config file functions moved from `foundation` to `xtras`. `fastcore.net` lost its request builders (`urlrequest`, `urlsend`, `do_request`, `urlcheck`) and `clean_type_str` is gone. `parallel_gen` is removed; the stdlib `ProcessPoolExecutor` `initializer` pattern replaces it (fastai's `parallel_tokenize` shows the recipe). Python 3.11 or later is now required. If you need the old APIs, pin `fastcore<2`.\n",
35+
":::"
3436
]
3537
},
3638
{

0 commit comments

Comments
 (0)