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 both in your environment:
LENS_PROJECT_KEY=your-project-key-from-lens-cloud
LENS_CLOUD_URL=https://app.lensapp.eu
The project key links events to the right project; the cloud URL is where they are sent. With both set, every event goes to Lens Cloud (and to the desktop app too, if it is running). You can also configure it in code:
lens.configure(cloud_url="https://app.lensapp.eu", key="your-project-key")
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.1.0.tar.gz.
File metadata
- Download URL: lens_debug-1.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f128aa0c2e7e38f331345352b9d9d35a3a013d3628fbf30e0e3da8274b6893
|
|
| MD5 |
5f4c54bef075f3db507bf3866ae7acb8
|
|
| BLAKE2b-256 |
543135ef21f4d851544bf10b52b5112d82503db7d00c296de1ceb8d9da1f7b0c
|
Provenance
The following attestation bundles were made for lens_debug-1.1.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.1.0.tar.gz -
Subject digest:
13f128aa0c2e7e38f331345352b9d9d35a3a013d3628fbf30e0e3da8274b6893 - Sigstore transparency entry: 1954733780
- Sigstore integration time:
-
Permalink:
lensapp-eu/lens-python@1634f4f401d11669153112f24c175454dfa66eb3 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/lensapp-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1634f4f401d11669153112f24c175454dfa66eb3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file lens_debug-1.1.0-py3-none-any.whl.
File metadata
- Download URL: lens_debug-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.9 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 |
96388cdf15907ce2722aee8cecae901f86e8da62f2992087dc829f3fa95f31c0
|
|
| MD5 |
ff52315571df73e8a5d5f00f633ba2c3
|
|
| BLAKE2b-256 |
369b23394573ce9a96ed0f65614940daa93877b4bf86f58e62741bda37bb24f3
|
Provenance
The following attestation bundles were made for lens_debug-1.1.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.1.0-py3-none-any.whl -
Subject digest:
96388cdf15907ce2722aee8cecae901f86e8da62f2992087dc829f3fa95f31c0 - Sigstore transparency entry: 1954734023
- Sigstore integration time:
-
Permalink:
lensapp-eu/lens-python@1634f4f401d11669153112f24c175454dfa66eb3 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/lensapp-eu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1634f4f401d11669153112f24c175454dfa66eb3 -
Trigger Event:
release
-
Statement type: