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 or the Demo notebook.
The tests are run with pytest. In the root directory, execute:
py.test
Metadata
Release files for backcall 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| backcall-0.2.0.tar.gz | 18.0 kB | Without provenance | Details for backcall-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| backcall-0.2.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for backcall-0.2.0-py2.py3-none-any.whl |
Total release size: 29.2 kB
Release files / backcall-0.2.0.tar.gz
| Download URL | backcall-0.2.0.tar.gz |
|---|---|
| Size | 18.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5cbdbf27be5e7cfadb448baf0aa95508f91f2bbc6c6437cd9cd06e2a4c215e1e
|
|
BLAKE2b-256 checksum How to use checksums |
a240764a663805d84deee23043e1426a9175567db89c8b3287b5c2ad9f71aa93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Release files / backcall-0.2.0-py2.py3-none-any.whl
| Download URL | backcall-0.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fbbce6a29f263178a1f7915c1940bde0ec2b2a967566fe1c65c1dfb7422bd255
|
|
BLAKE2b-256 checksum How to use checksums |
4c1cff6546b6c12603d8dd1070aa3c3d273ad4c07f5771689a7b69a550e8c951
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Security for backcall 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.