# catalogue

> Super lightweight function registries for your library

- **URL**: https://www.freshcrate.ai/projects/catalogue
- **Author**: Explosion
- **Category**: RAG & Memory
- **Latest version**: `2.0.10` (2026-04-21)
- **License**: MIT
- **Source**: https://github.com/explosion/catalogue
- **Language**: Python
- **GitHub**: 181 stars, 21 forks
- **Registry**: pypi (`catalogue`)
- **Tags**: `pypi`

## Description

<a href="https://explosion.ai"><img src="https://explosion.ai/assets/img/logo.svg" width="125" height="125" align="right" /></a>

# catalogue: Super lightweight function registries for your library

`catalogue` is a tiny, zero-dependencies library that makes it easy to **add
function (or object) registries** to your code. Function registries are helpful
when you have objects that need to be both easily serializable and fully
customizable. Instead of passing a function into your object, you pass in an
identifier name, which the object can use to lookup the function from the
registry. This makes the object easy to serialize, because the name is a simple
string. If you instead saved the function, you'd have to use Pickle for
serialization, which has many drawbacks.

[![tests](https://github.com/explosion/catalogue/actions/workflows/tests.yml/badge.svg)](https://github.com/explosion/catalogue/actions/workflows/tests.yml)
[![Current Release Version](https://img.shields.io/github/v/release/explosion/catalogue.svg?style=flat-square&include_prereleases&logo=github)](https://github.com/explosion/catalogue/releases)
[![pypi Version](https://img.shields.io/pypi/v/catalogue.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/catalogue/)
[![conda Version](https://img.shields.io/conda/vn/conda-forge/catalogue.svg?style=flat-square&logo=conda-forge&logoColor=white)](https://anaconda.org/conda-forge/catalogue)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/ambv/black)

## ⏳ Installation

```bash
pip install catalogue
```

```bash
conda install -c conda-forge catalogue
```

> ⚠️ **Important note:** `catalogue` v2.0+ is only compatible with Python 3.6+.
> For Python 2.7+ compatibility, use `catalogue` v1.x.

## 👩‍💻 Usage

Let's imagine you're developing a Python package that needs to load data
somewhere. You've already implemented some loader functions for the most common
data types, but you want to allow the user to easily add their own. Using
`catalogue.create` you can create a new registry under the namespace
`your_package` &rarr; `loaders`.

```python
# YOUR PACKAGE
import catalogue

loaders = catalogue.create("your_package", "loaders")
```

This gives you a `loaders.register` decorator that your users can import and
decorate their custom loader functions with.

```python
# USER CODE
from your_package import loaders

@loaders.register("custom_loader")
def custom_loader(data):
    # Load something here...
    return data
```

The decorated function will be registered automatically and in your package,
you'll be able to access all loaders by calling `loaders.get_all`.

```python
# YOUR PACKAGE
def load_data(data, loader_id):
    print("All loaders:", loaders.get_all()) # {"custom_loader": <custom_loader>}
    loader = loaders.get(loader_id)
    return loader(data)
```

The user can now refer to their custom loader using only its string name
(`"custom_loader"`) and your application will know what to do and will use their
custom function.

```python
# USER CODE
from your_package import load_data

load_data(data, loader_id="custom_loader")
```

## ❓ FAQ

#### But can't the user just pass in the `custom_loader` function directly?

Sure, that's the more classic callback approach. Instead of a string ID,
`load_data` could also take a function, in which case you wouldn't need a
package like this. `catalogue` helps you when you need to produce a serializable
record of which functions were passed in. For instance, you might want to write
a log message, or save a config to load back your object later. With
`catalogue`, your functions can be parameterized by strings, so logging and
serialization remains easy – while still giving you full extensibility.

#### How do I make sure all of the registration decorators have run?

Decorators normally run when modules are imported. Relying on this side-effect
can sometimes lead to confusion, especially if there's no other reason the
module would be imported. One solution is to use
[entry points](https://packaging.python.org/specifications/entry-points/).

For instance, in [spaCy](https://spacy.io) we're starting to use function
registries to make the pipeline components much more customizable. Let's say one
user, Jo, develops a better tagging model using new machine learning research.
End-users of Jo's package should be able to write
`spacy.load("jo_tagging_model")`. They shouldn't need to remember to write
`import jos_tagged_model` first, just to run the function registries as a
side-effect. With entry points, the registration happens at install time – so
you don't need to rely on the import side-effects.

## 🎛 API

### <kbd>function</kbd> `catalogue.create`

Create a new registry for a given namespace. Returns a setter function that can
be used as a decorator or called with a name and `func` keyword argument. If
`entry_points=True` is set, the registry will check for
[Python entry points](https

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `2.0.10` | 2026-04-21 | Low | Imported from PyPI (2.0.10) |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |
| `v2.0.10` | 2023-09-25 | Low | - Package and test suite updates for Python 3.12 (#66). |

## Dependency audit

- **Score**: 72/100
- **Total deps**: 4
- **Resolved**: 0
- **Unresolved**: 4
- **License conflicts**: 0
- **Warnings**: 4
- **Scanned**: 2026-06-01

## Citation

- HTML: https://www.freshcrate.ai/projects/catalogue
- Markdown: https://www.freshcrate.ai/projects/catalogue.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/catalogue/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
