Skip to main content

Welcome to fastcore

[!NOTE]

fastcore v2

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.

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 cleans 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.

Here are some tips on using fastcore:

  • Liberal imports: Use from fastcore.module import * freely. The library is designed for safe wildcard imports.
  • Enhanced list operations: Substitute list with L. This provides advanced indexing, method chaining, and additional functionality while maintaining list-like behavior.
  • Extend existing classes: Apply the @patch decorator to add methods to classes, including built-ins, without subclassing.
  • Streamline class initialization: In __init__ methods, use store_attr() to efficiently set multiple attributes, reducing repetitive assignment code.
  • Explicit keyword arguments: Apply the delegates decorator to functions to replace **kwargs with specific parameters, enhancing IDE support and documentation.
  • Optimize parallel execution: Use fastcore’s enhanced ThreadPoolExecutor and ProcessPoolExecutor for simplified concurrent processing.
  • Expressive testing: Prefer fastcore’s testing functions like test_eq, test_ne, test_close for more readable and informative test assertions.
  • Advanced file operations: Use the extended Path class, which adds methods like ls(), read_json(), and others to pathlib.Path.
  • Flexible data structures: Convert between dictionaries and attribute-access objects using dict2obj and obj2dict for more intuitive data handling.
  • Functional programming paradigms: Use tools like compose, maps, and filter_ex to write more functional-style Python code.
  • Documentation: Use docments where possible to document parameters of functions and methods.
  • Time-aware caching: Apply the timed_cache decorator to add time-based expiration to the standard lru_cache functionality.
  • Simplified CLI creation: Use fastcore.script to easily transform Python functions into command-line interfaces.

For example, L is a drop-in replacement for list with extra superpowers:

x = L(1,2,3,4)
test_eq(x[[0,3]], [1,4])               # index with a collection
test_eq(x.map(lambda o:o*2), [2,4,6,8])
test_eq(x.filter(lambda o:o>2), [3,4])
x += [5]
test_eq(x.unique(), [1,2,3,4,5])

Tutorials

Getting started

To install fastcore run: conda install fastcore -c fastai (if you use Anaconda, which we recommend) or pip install fastcore. For an editable install, clone this repo and run: pip install -e ".[dev]". fastcore is tested to work on Ubuntu, macOS and Windows (versions tested are those shown with the -latest suffix here).

fastcore contains many features, including:

  • fastcore.test: Simple testing functions
  • fastcore.foundation: Mixins, delegation, composition, and more
  • fastcore.xtras: Utility functions to help with functional-style programming, parallel processing, and more

To get started, we recommend you read through the fastcore tour.

Contributing

After you clone this repository, please run nbdev_install_hooks in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.

To run the tests in parallel, launch nbdev_test.

Before submitting a PR, check that the local library and notebooks match.

  • If you made a change to the notebooks in one of the exported cells, you can export it to the library with nbdev_prepare.
  • If you made a change to the library, you can export it back to the notebooks with nbdev_update.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastcore-2.2.17.tar.gz (144.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastcore-2.2.17-py3-none-any.whl (151.0 kB view details)

Uploaded Python 3

File details

Details for the file fastcore-2.2.17.tar.gz.

File metadata

  • Download URL: fastcore-2.2.17.tar.gz
  • Upload date:
  • Size: 144.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for fastcore-2.2.17.tar.gz
Algorithm Hash digest
SHA256 3a88a8c92fcc386d224b90a4e650519a7a9765bed027bbcc178b66d4aae4f36b
MD5 6ebcef82c2d64a39c9f778b13061993a
BLAKE2b-256 bbc115769a5a286aef075f1f0209296535e58f7725d966c1e2f11db6ed7e5480

See more details on using hashes here.

File details

Details for the file fastcore-2.2.17-py3-none-any.whl.

File metadata

  • Download URL: fastcore-2.2.17-py3-none-any.whl
  • Upload date:
  • Size: 151.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.15

File hashes

Hashes for fastcore-2.2.17-py3-none-any.whl
Algorithm Hash digest
SHA256 14c2fa6e322a64a0d2d8755170f68ad602fe4c046afc72b32413d2fd37bd5b0b
MD5 d575cb83962989f639444be86bb1eff0
BLAKE2b-256 c3850d048ed91e38765449f3a51e57a6765ea98eab667e7b79b3de7d25abd721

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.22

2 files

2.2.21

2 files

2.2.20

2 files

2.2.19

2 files

2.2.18

2 files

This release

2.2.17 This release

2 files

2.2.16

2 files

2.2.15

2 files

2.2.14

2 files

2.2.13

2 files

2.2.12

2 files

2.2.11

2 files

2.2.10

2 files

2.2.9

2 files

2.2.8

2 files

2.2.7

2 files

2.2.6

2 files

2.2.5

2 files

2.2.4

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.20

2 files

2.1.19

2 files

2.1.18

2 files

2.1.17

2 files

2.1.16

2 files

2.1.15

2 files

2.1.14

2 files

2.1.13

2 files

2.1.12

2 files

2.1.11

2 files

2.1.10

2 files

2.1.9

2 files

2.1.8

2 files

2.1.7

2 files

2.1.6

2 files

2.1.5

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.6

2 files

2.0.5

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.14.5

2 files

1.14.4

2 files

1.14.3

2 files

1.14.2

2 files

1.14.1

2 files

1.13.10

2 files

1.13.9

2 files

1.13.8

2 files

1.13.7

2 files

1.13.6

2 files

1.13.5

2 files

1.13.4

2 files

1.13.3

2 files

1.13.2

2 files

1.13.1

2 files

1.13.0

2 files

1.12.47

2 files

1.12.46

2 files

1.12.45

2 files

1.12.44

2 files

1.12.43

2 files

1.12.42

2 files

1.12.41

2 files

1.12.40

2 files

1.12.39

2 files

1.12.38

2 files

1.12.37

2 files

1.12.36

2 files

1.12.35

2 files

1.12.34

2 files

1.12.33

2 files

1.12.31

2 files

1.12.30

2 files

1.12.29

2 files

1.12.28

2 files

1.12.27

2 files

1.12.26

2 files

1.12.25

2 files

1.12.24

2 files

1.12.23

2 files

1.12.22

2 files

1.12.21

2 files

1.12.20

2 files

1.12.19

2 files

1.12.18

2 files

1.12.17

2 files

1.12.16

2 files

1.12.15

2 files

1.12.14

2 files

1.12.13

2 files

1.12.12

2 files

1.12.11

2 files

1.12.10

2 files

1.12.9

2 files

1.12.8

2 files

1.12.7

2 files

1.12.6

2 files

1.12.5

2 files

1.12.4

2 files

1.12.3

2 files

1.12.2

2 files

1.12.1

2 files

1.11.5

2 files

1.11.4

2 files

1.11.3

2 files

1.11.2

2 files

1.11.1

2 files

1.11.0

2 files

1.10.5

2 files

1.10.4

2 files

1.10.3

2 files

1.10.2

2 files

1.10.0

2 files

1.9.8

2 files

1.9.7

2 files

1.9.6

2 files

1.9.5

2 files

1.9.4

2 files

1.9.3

2 files

1.9.2

2 files

1.9.1

2 files

1.9.0

2 files

1.8.18

2 files

1.8.17

2 files

1.8.16

2 files

1.8.15

2 files

1.8.14

2 files

1.8.13

2 files

1.8.12

2 files

1.8.11

2 files

1.8.10

2 files

1.8.9

2 files

1.8.8

2 files

1.8.7

2 files

1.8.6

2 files

1.8.5

2 files

1.8.4

2 files

1.8.3

2 files

1.8.2

2 files

1.8.1

2 files

1.8.0

2 files

1.7.29

2 files

1.7.28

2 files

1.7.27

2 files

1.7.26

2 files

1.7.25

2 files

1.7.24

2 files

1.7.23

2 files

1.7.22

2 files

1.7.20

2 files

1.7.19

2 files

1.7.18

2 files

1.7.17

2 files

1.7.16

2 files

1.7.15

2 files

1.7.14

2 files

1.7.13

2 files

1.7.12

2 files

1.7.11

2 files

1.7.10

2 files

1.7.9

2 files

1.7.8

2 files

1.7.7

2 files

1.7.6

2 files

1.7.5

2 files

1.7.4

2 files

1.7.3

2 files

1.7.2

2 files

1.7.1

2 files

1.7.0

2 files

1.6.9

2 files

1.6.8

2 files

1.6.7

2 files

1.6.6

2 files

1.6.5

2 files

1.6.4

2 files

1.6.3

2 files

1.6.2

2 files

1.6.1

2 files

1.6.0

2 files

1.5.55

2 files

1.5.54

2 files

1.5.53

2 files

1.5.52

2 files

1.5.51

2 files

1.5.50

2 files

1.5.49

2 files

1.5.48

2 files

1.5.47

2 files

1.5.46

2 files

1.5.45

2 files

1.5.44

2 files

1.5.43

2 files

1.5.42

2 files

1.5.41

2 files

1.5.40

2 files

1.5.39

2 files

1.5.38

2 files

1.5.37

2 files

1.5.35

2 files

1.5.34

2 files

1.5.33

2 files

1.5.32

2 files

1.5.31

2 files

1.5.30

2 files

1.5.29

2 files

1.5.28

2 files

1.5.27

2 files

1.5.26

2 files

1.5.25

2 files

1.5.24

2 files

1.5.23

2 files

1.5.22

2 files

1.5.21

2 files

1.5.20

2 files

1.5.19

2 files

1.5.18

2 files

1.5.17

2 files

1.5.16

2 files

1.5.15

2 files

1.5.14

2 files

1.5.13

2 files

1.5.12

2 files

1.5.11

2 files

1.5.10

2 files

1.5.9

2 files

1.5.8

2 files

1.5.7

2 files

1.5.6

2 files

1.5.5

2 files

1.5.4

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.5

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.29

2 files

1.3.28

2 files

1.3.27

2 files

1.3.26

2 files

1.3.25

2 files

1.3.24

2 files

1.3.23

2 files

1.3.22

2 files

1.3.21

2 files

1.3.20

2 files

1.3.19

2 files

1.3.18

2 files

1.3.17

2 files

1.3.16

2 files

1.3.15

2 files

1.3.14

2 files

1.3.13

2 files

1.3.12

2 files

1.3.11

2 files

1.3.10

2 files

1.3.9

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.3.4

2 files

1.3.3

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

1.0.24

2 files

1.0.23

2 files

1.0.22

2 files

1.0.21

2 files

1.0.20

2 files

1.0.19

2 files

1.0.17

2 files

1.0.16

2 files

1.0.15

2 files

1.0.14

2 files

1.0.13

2 files

1.0.12

2 files

1.0.11

2 files

1.0.10

2 files

1.0.9

2 files

1.0.8

2 files

1.0.7

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.1.38

2 files

0.1.37

2 files

0.1.36

2 files

0.1.35

2 files

0.1.34

2 files

0.1.33

2 files

0.1.32

2 files

0.1.31

2 files

0.1.30

2 files

0.1.29

2 files

0.1.28

2 files

0.1.27

2 files

0.1.26

2 files

0.1.25

2 files

0.1.24

2 files

0.1.23

2 files

0.1.22

2 files

0.1.21

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page