Lens - send debug payloads to the Lens desktop app and Lens Cloud
Project description
Lens for Python
Send debug payloads to the Lens desktop app and Lens Cloud from any Python project (Django, Flask, FastAPI or plain scripts). No dependencies, just the standard library.
Install
pip install lens-debug
Use
from lens_debug import lens
lens("hello", user) # send any values
lens([1, 2, 3]).label("my array") # add a label
lens("careful").red() # colour the entry
lens.clear() # clear the Lens window
Colours: red, green, blue, orange, purple, gray.
Lens Cloud (optional)
To send events straight to Lens Cloud, no desktop app required, set one environment variable:
LENS_PROJECT_KEY=your-project-key-from-lens-cloud
With a key set, events go to Lens Cloud at https://app.lensapp.eu by default. Set LENS_CLOUD_URL
only to point at a self-hosted or local cloud (e.g. http://localhost:3000). You can also configure
it in code:
lens.configure(key="your-project-key") # cloud_url defaults to https://app.lensapp.eu
Channels
Lens sends to two channels, independently toggleable (default on):
LENS_LOCAL=false # disable the desktop app -> cloud only
LENS_CLOUD=false # disable the cloud -> desktop app only
Or in code: lens.configure(local=False) / lens.configure(cloud=False).
Each event also carries context (Python version, OS, hostname and detected framework) which shows up as tags in Lens Cloud.
Caught exceptions
try:
risky()
except Exception as err:
lens.exception(err)
The exception (with its stack trace) shows up in Lens and can be picked up by the built-in "Summarize errors" AI button.
Configuration
Lens listens on 127.0.0.1:23600 by default. Override it in code or via environment variables:
lens.configure(host="127.0.0.1", port=23600)
export LENS_HOST=127.0.0.1
export LENS_PORT=23600
Safety
Debugging never blocks or crashes your program: every payload is sent on a daemon thread and all transmission errors are swallowed silently. If the Lens app is not running, calls are simply no-ops.
MIT licensed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lens_debug-1.2.0.tar.gz.
File metadata
- Download URL: lens_debug-1.2.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00c98faf9e7981d294ef43e683b6defe5ed12b1a376d567089bdb88bbf3a0081
|
|
| MD5 |
14fab56f45929893cb64ce71ac71888c
|
|
| BLAKE2b-256 |
9c399407bf00e627f11f71e14622a146f82e57b588914018263fdde51e3eb1ef
|
Provenance
The following attestation bundles were made for lens_debug-1.2.0.tar.gz:
Publisher:
release.yml on lensapp-eu/lens-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lens_debug-1.2.0.tar.gz -
Subject digest:
00c98faf9e7981d294ef43e683b6defe5ed12b1a376d567089bdb88bbf3a0081 - Sigstore transparency entry: 1958719023
- Sigstore integration time:
-
Permalink:
lensapp-eu/lens-python@4adc5a4b88acb75ca86762ac4f464adf29d26b79 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/lensapp-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4adc5a4b88acb75ca86762ac4f464adf29d26b79 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lens_debug-1.2.0-py3-none-any.whl.
File metadata
- Download URL: lens_debug-1.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b53e11dbb561b9af45bb26f1afe054238a9659a32a6d5720eeea517a55e00bf
|
|
| MD5 |
bba62a38928a594a53b462842275d43f
|
|
| BLAKE2b-256 |
f788acbdf89c69e081e669c45c946514070080f51cd581fc80f83b84d261660c
|
Provenance
The following attestation bundles were made for lens_debug-1.2.0-py3-none-any.whl:
Publisher:
release.yml on lensapp-eu/lens-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lens_debug-1.2.0-py3-none-any.whl -
Subject digest:
5b53e11dbb561b9af45bb26f1afe054238a9659a32a6d5720eeea517a55e00bf - Sigstore transparency entry: 1958719100
- Sigstore integration time:
-
Permalink:
lensapp-eu/lens-python@4adc5a4b88acb75ca86762ac4f464adf29d26b79 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/lensapp-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4adc5a4b88acb75ca86762ac4f464adf29d26b79 -
Trigger Event:
release
-
Statement type: