---
title: "backcall | pypx"
description: "Specifications for callback functions passed in to an API"
canonical_url: "https://pypx.app/packages/backcall"
meta:
  "og:description": "Specifications for callback functions passed in to an API"
  "og:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_backcall%2Cversion_0.2.0%2Csummary_Specifications%2Bfor%2Bcallback%2Bfunctions%2Bpassed%2Bin%2Bto%2Ban%2BAPI%2Clicense_BSD%2BLicense%2Cp_Ii9wYWNrYWdlcy9iYWNrY2FsbCI%2Cs_gGk2744rNOtFYDkt.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "backcall 0.2.0"
  "twitter:image": "https://pypx.app/_og/d/h_630%2Cc_PackageCard%2Cname_backcall%2Cversion_0.2.0%2Csummary_Specifications%2Bfor%2Bcallback%2Bfunctions%2Bpassed%2Bin%2Bto%2Ban%2BAPI%2Clicense_BSD%2BLicense%2Cp_Ii9wYWNrYWdlcy9iYWNrY2FsbCI%2Cs_gGk2744rNOtFYDkt.png"
---

> Index of every page on this site: [llms.txt](https://pypx.app/llms.txt)

# **backcall**

v0.2.0

Specifications for callback functions passed in to an API

11 KBpy2.py3-none-anyBSD License Likely Unmaintained

[**Diff **](https://pypx.app/packages/backcall/diff)

`$ uv add backcall`

\========

# backcall

Specifications for callback functions passed in to an API

If your code lets other people supply callback functions, it's important to specify the function signature you expect, and check that functions support that. Adding extra parameters later would break other peoples code unless you're careful.

backcall provides a way of specifying the callback signature using a prototype function::

from backcall import callback\_prototype

@callback\_prototype def handle\_ping(sender, delay=None): # Specify positional parameters without a default, and keyword # parameters with a default. pass

def register\_ping\_handler(callback): # This checks and adapts the function passed in: callback = handle\_ping.adapt(callback) ping\_callbacks.append(callback)

If the callback takes fewer parameters than your prototype, *backcall* will wrap it in a function that discards the extra arguments. If the callback expects more arguments, a TypeError is thrown when it is registered.

For more details, see the [docs](http://backcall.readthedocs.org/en/latest/) or the [Demo notebook](http://nbviewer.ipython.org/github/takluyver/backcall/blob/master/Demo.ipynb).

The tests are run with [pytest](http://pytest.org/latest/). In the root directory, execute::

py.test

## **Details **

<dl>

<dt>Version</dt>
<dd>0.2.0</dd>

<dt>License</dt>
<dd>BSD License</dd>

<dt>Maintainer</dt>
<dd>Thomas Kluyver</dd></dl>

## **Links**

- [Homepage](https://github.com/takluyver/backcall)
- [View on PyPI](https://pypi.org/project/backcall/)

## **Maintainers **

- Thomas Kluyver · [thomas@kluyver.me.uk](mailto:thomas@kluyver.me.uk)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://pypx.app/#website","@type":"WebSite","description":"The Python Package Index, reimagined. Fast search, dependency insights, download trends, and changelogs — all in one place.","name":"pypx","url":"https://pypx.app/"},{"@id":"https://pypx.app/packages/backcall#webpage","@type":"WebPage","description":"Specifications for callback functions passed in to an API","name":"backcall","url":"https://pypx.app/packages/backcall","isPartOf":{"@id":"https://pypx.app/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://pypx.app/packages/backcall"]}]},{"@id":"https://pypx.app/packages/backcall#/schema/software-application/1","@type":"SoftwareApplication","applicationCategory":"DeveloperApplication","description":"Specifications for callback functions passed in to an API","license":"BSD License","name":"backcall","softwareVersion":"0.2.0"}]}
```

## Sitemap

See the full [sitemap](https://pypx.app/sitemap.md) for all pages.
