{"id":1164,"library":"fastcore","title":"fastcore","description":"fastcore is a Python library that 'supercharges' Python for fastai development, but is useful independently. It extends Python with features inspired by other languages like multiple dispatch from Julia, mixins from Ruby, and utilities for functional programming and parallel processing. It aims to eliminate boilerplate and add useful functionality for common tasks, with frequent patch releases.","status":"active","version":"1.12.34","language":"python","source_language":"en","source_url":"https://github.com/AnswerDotAI/fastcore/","tags":["utility","development","fastai","functional programming","extensions","boilerplate reduction"],"install":[{"cmd":"pip install fastcore","lang":"bash","label":"PyPI"},{"cmd":"conda install fastcore -c fastai","lang":"bash","label":"Conda (recommended)"}],"dependencies":[],"imports":[{"note":"This is the recommended way to import fastcore for convenience, as the library is designed to allow safe `import *` by defining `__all__` in its modules.","symbol":"fastcore.all","correct":"from fastcore.all import *"},{"note":"The `typedispatch` system is being replaced by `plum-dispatch`. Users should migrate to `plum` for multiple dispatch functionality.","wrong":"from fastcore.dispatch import typedispatch","symbol":"typedispatch","correct":"from plum import dispatch"}],"quickstart":{"code":"import time\nfrom fastcore.all import *\n\n# L: An enhanced list-like object with many utility methods\nl_data = L(range(10)).shuffle()\nprint(f\"Original L: {l_data}\")\nprint(f\"Filtered (>=5): {l_data.filter(ge(5))}\") # 'ge' is an operator function from fastcore.all\n\n# parallel: Easily run functions in parallel\ndef slow_square(x):\n    time.sleep(0.01) # Simulate some work\n    return x*x\n\nresults = parallel(slow_square, l_data, n_workers=2)\nprint(f\"Parallel squared results: {results}\")\n\n# store_attr and basic_repr: Reduce boilerplate in classes\nclass MyClass:\n    def __init__(self, a, b=10):\n        store_attr() # Automatically stores 'a' and 'b' as self.a, self.b\n\n    __repr__ = basic_repr('a,b') # Generates a clean __repr__\n\nobj = MyClass(5, b=20)\nprint(f\"MyClass instance: {obj}\")","lang":"python","description":"This quickstart demonstrates key `fastcore` utilities: the `L` collection for enhanced list operations, the `parallel` function for easy multiprocessing, and `store_attr` and `basic_repr` for reducing class boilerplate."},"warnings":[{"fix":"Install `plum-dispatch` (`pip install plum-dispatch`) and update imports from `fastcore.dispatch` to `plum` (e.g., `from plum import dispatch`). If using `TypeDispatch` classes, switch to `plum.Function`.","message":"The multiple dispatch system (`@typedispatch`, `TypeDispatch`) in `fastcore.dispatch` is being replaced by the `plum-dispatch` library. Code relying on fastcore's internal dispatch system will need to be updated.","severity":"breaking","affected_versions":"Versions where Plum integration began (check fastcore.fast.ai documentation for specifics)."},{"fix":"For potentially costly or side-effecting default values, use the standard Python conditional expression `b if a is None else a` directly, or ensure that `b` is pre-computed or a simple literal.","message":"The `fastcore.all.ifnone(a, b)` function eagerly evaluates both `a` and `b`. This differs from Python's standard `b if a is None else a` conditional expression, which short-circuits and only evaluates `b` if `a` is `None`. This can lead to unexpected side effects or performance issues if `b` is a complex or side-effecting operation.","severity":"gotcha","affected_versions":"All versions."}],"env_vars":null,"search_vec":"'add':48 'aim':43 'boilerpl':46,64 'common':52 'develop':12,59 'dispatch':28 'elimin':45 'extend':18 'extens':63 'fastai':11,60 'fastcor':1,2 'featur':21 'frequent':55 'function':37,50,61 'independ':16 'inspir':22 'julia':30 'languag':25 'librari':6 'like':26 'mixin':31 'multipl':27 'parallel':40 'patch':56 'process':41 'program':38,62 'python':5,9,19 'reduct':65 'releas':57 'rubi':33 'supercharg':8 'task':53 'use':15,49 'util':35,58","created_at":"2026-04-05T14:30:52.312712+00:00","updated_at":"2026-04-16T14:57:18.316570+00:00","problems":[{"fix":"Install the library using pip: `pip install fastcore` or if you use Anaconda: `conda install fastcore -c fastai`.","cause":"The `fastcore` library is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'fastcore'"},{"fix":"Update `fastcore` to the latest version: `pip install -U fastcore`. If you need specific utilities, consider using `from fastcore.all import *` to bring common utilities into your namespace, or `from fastcore import utils` if you intend to use `fastcore.utils` directly, assuming it's available in your version.","cause":"This usually indicates an outdated `fastcore` installation where submodules might not be correctly exposed, or an attempt to access internal modules that are not directly available as top-level attributes in older versions or specific environments. Modern `fastcore` typically uses `fastcore.all` for convenience.","error":"AttributeError: module 'fastcore' has no attribute 'utils'"},{"fix":"You have two main options: 1) Downgrade `fastcore` to a version prior to 1.8.0, for example: `pip install fastcore<1.8.0` (or specifically `pip install fastcore==1.7.29` as suggested in some contexts). 2) Update the dependent library (e.g., `fastai` or `tsai`) to a version that is compatible with the newer `fastcore` and `fasttransform` structure, or refactor your code to use `fasttransform` if you were directly importing from `fastcore.dispatch`.","cause":"This error occurs in `fastcore` versions 1.8.0 and above because the `dispatch` module (or parts of it) was moved to a new `fasttransform` package, introducing a breaking change for dependent libraries like `fastai` or `tsai` that might be using older import paths.","error":"ImportError: Could not import '__path__' from fastcore.dispatch - this module has been moved to the fasttransform package."},{"fix":"Avoid using `from fastai.vision.all import *` if you need to use the built-in `all()` function. Instead, import specific functions you need, or explicitly refer to the built-in `all()` using `import builtins` and then `builtins.all()`. Alternatively, if you wish to use the `fastcore` / `fastai` `all` function, ensure you are calling it with the correct arguments as defined by the library.","cause":"When `from fastai.vision.all import *` (or similar `from fastcore.all import *`) is used, it can shadow Python's built-in `all()` function, replacing it with a module object. Consequently, attempts to call the built-in `all()` will result in this error.","error":"TypeError: 'module' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.2.16","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/AnswerDotAI/fastcore","docs":"https://fastcore.fast.ai/","changelog":null,"pypi":"https://pypi.org/project/fastcore/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["web-framework","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}