Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lens_debug-1.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lens_debug-1.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for lens_debug-1.1.0.tar.gz
Algorithm Hash digest
SHA256 13f128aa0c2e7e38f331345352b9d9d35a3a013d3628fbf30e0e3da8274b6893
MD5 5f4c54bef075f3db507bf3866ae7acb8
BLAKE2b-256 543135ef21f4d851544bf10b52b5112d82503db7d00c296de1ceb8d9da1f7b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lens_debug-1.1.0.tar.gz:

Publisher: release.yml on lensapp-eu/lens-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for lens_debug-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96388cdf15907ce2722aee8cecae901f86e8da62f2992087dc829f3fa95f31c0
MD5 ff52315571df73e8a5d5f00f633ba2c3
BLAKE2b-256 369b23394573ce9a96ed0f65614940daa93877b4bf86f58e62741bda37bb24f3

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page