Telepath is a Python library designed for exchanging data between Python and JavaScript. It enables Python objects to be packed into primitive types suitable for frontend consumption, typically within a web context. The current version is 0.3.1. Releases are infrequent, usually tied to specific feature additions or compatibility updates, particularly concerning Django versions.
pip install telepathVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a custom Python object, create a Telepath adapter for it, register the adapter, and then pack an instance of the object into a JavaScript-compatible format. It also shows how to generate the necessary JavaScript context for the frontend to unpack the data using the companion `telepath-unpack.js` library.
Upgrade your Python environment to 3.8+ and Django to 3.2+, or restrict your `telepath` dependency to `<0.3.1`.
Ensure `telepath-unpack.js` is loaded in your HTML, typically via a `<script>` tag, before attempting to unpack data on the frontend.
Embed the output of `context.as_script_tag()` in the `<head>` or at the start of `<body>` of your HTML page.
Refactor custom object packing logic to use the `telepath.Adapter` class and `register()` function for clearer and more maintainable code.
No dependency data recorded yet.