Skip to main content

Lightrun for Python

Lightrun is a developer-native observabity platform. It's a way to add logs, inspect the state of the current execution (in a familiar, debugger-like view), and extract any type of code-level metric on the fly - without redeploying, restarting or even stopping the running application.

Check out our docs to learn more.

Getting Started

To get started with Lightrun you'll need three things:

  1. A Lightrun Account - you can get one here.
  2. A Lightrun Plugin - you'll have instructions to download it once you create an account, but you can also check them out here.
  3. A Lightrun Agent - which is this very PyPI package! It's the thing that actually does the magic.

Once you've signed up for an account and downloaded the plugin, you can install the agent in your application.

Installing the Lightrun Agent - Directly

In order to install the Lightrun Python Agent please follow these steps:

  1. Install the python agent by running python -m pip install lightrun.

  2. Add the following code to the beginning of your main function:

try:
    import lightrun

    lightrun.enable(company_key="<COMPANY_SECRET>")
except ImportError as e:
    print("Error importing Lightrun: ", e)

You will have a <COMPANY-SECRET> auto-generated for you during the onboarding process, right after signing up for an account.

  1. Run the application as you normally would, i.e. python app.py.

You should see the application's agent popping up in the Lightrun Plugin's sidebar - you can now add logs, snapshots and metrics to your application.

Providing Credentials Via Program Arguments

You can optionally choose to provide the <COMPANY-SECRET> as program argument. To do so, run your application in the following way:

python -m lightrun --company_key='<COMAPNY-SECRET>' -- app.py

Notice - The method above won't work well with applications based on gunicorn or any other multiprocessing libraries, as the debugger won't attach to the spawned sub-processes. Please use the import method instead.

Installing the Lightrun Agent - Django

In order to run a Django web server with the Lightrun agent please follow these steps:

  1. In the application folder, install the python agent by running python -m pip install lightrun
  2. Add the following code to your manage.py file and run your Django application as you did normally before:
try:
    if os.environ.get("RUN_MAIN") or "--noreload" in sys.argv:
        import lightrun

        lightrun.enable(company_key="<COMAPNY-SECRET>")
except ImportError as e:
    print("Error importing Lightrun: ", e)

Installing the Lightrun Agent - Flask

In order to run a Flask web app with the Lightrun agent please follow these steps:

  1. In the application folder, install the python agent by running python -m pip install lightrun
  2. Add the following code to your application's main init.py or app.py (the import shouldn't be added to a specific routed method, but to the main file code instead):
try:
    import lightrun

    lightrun.enable(company_key="<COMAPNY-SECRET>")
except ImportError as e:
    print("Error importing Lightrun: ", e)


# Example route
@app.route("/")
def hello_world():
    return "<p>Hello world!</p>"

Installing the Lightrun Agent - Apache Airflow

In order to run Lightrun for Python with Apache Airflow you'll need to decide which step of the DAG you'd like to debug. Choose one (or more) steps and:

  1. Find a place in your system that has access to the same Python interpreter that is used by Airflow, and install the python agent by running python -m pip install lightrun.
  2. In an Airflow DAG file, add the following decorator above the operators you'd like to use Lightrun with:
@lightrun_airflow_task()
def operator_name():
    # Operator code

Debugging Airflow Multi-step DAGs with Lightrun's Free Tier

Please note that the Lightrun free tier limits usage to one agent per user. In practice, note this means that each operator can be debugged individually, but you cannot debug multiple operators simultaneously.

Metadata

Release files for lightrun 1.96.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for lightrun 1.96.0
File
lightrun-1.96.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
lightrun-1.96.0-cp312-cp312-musllinux_1_1_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.1+ x86-64 Details
lightrun-1.96.0-cp312-cp312-manylinux2010_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.12+ x86-64 Details
lightrun-1.96.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
lightrun-1.96.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
lightrun-1.96.0-cp311-cp311-musllinux_1_1_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.1+ x86-64 Details
lightrun-1.96.0-cp311-cp311-manylinux2010_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.12+ x86-64 Details
lightrun-1.96.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
lightrun-1.96.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
lightrun-1.96.0-cp310-cp310-musllinux_1_1_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.1+ x86-64 Details
lightrun-1.96.0-cp310-cp310-manylinux2010_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.12+ x86-64 Details
lightrun-1.96.0-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 1.8 MB

Release files / lightrun-1.96.0-cp312-cp312-win_amd64.whl

Download URL lightrun-1.96.0-cp312-cp312-win_amd64.whl
Size 126.7 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d1c4b46b089d4e335f694d20a03121d8dc509e283d091ff50de22d87f68e8410
BLAKE2b-256 checksum
How to use checksums
67d4c0d5c49e9337d600357a4e69c1617b9d0e80818650f8fc456bf85dc25eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp312-cp312-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.0-cp312-cp312-musllinux_1_1_x86_64.whl
Size 149.9 kB
Tags CPython 3.12 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
1ecbc2fe4bf8527c24d773d5992997ea32c2d26de031ccf7eab93778d55bbeac
BLAKE2b-256 checksum
How to use checksums
861104dd33634dbce500db05c5cb87b91f325760a5863d6dd8b57a7efa4659ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp312-cp312-manylinux2010_x86_64.whl

Download URL lightrun-1.96.0-cp312-cp312-manylinux2010_x86_64.whl
Size 146.1 kB
Tags CPython 3.12 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
96b1a15f74420a0b1896ace1564f0a6ea6e77655d61220f71b22454b25812f5c
BLAKE2b-256 checksum
How to use checksums
e07986df10bc43751911ef07a73f8b98458a77dadbea6c55a337f464885bf8ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL lightrun-1.96.0-cp312-cp312-macosx_11_0_arm64.whl
Size 116.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
32922a27f5be3ec9de2600d7f9f5b4fe14afe3eef29b265f28427433f7fa7f08
BLAKE2b-256 checksum
How to use checksums
bb4a82d7865d807351ac095f59f790f85079a5a5f22b96e44b9bc24a0f2e6b2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp311-cp311-win_amd64.whl

Download URL lightrun-1.96.0-cp311-cp311-win_amd64.whl
Size 135.5 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8abac136f01b7cf495d26b6f5da0dfc33f4d54aef73c30b2e936d5e427d84e85
BLAKE2b-256 checksum
How to use checksums
baa1a036868e4899561c187201cc7f01de372ea1106f2178bfa431e89d520d5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp311-cp311-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.0-cp311-cp311-musllinux_1_1_x86_64.whl
Size 176.7 kB
Tags CPython 3.11 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
d1f6674407cfbb10ee4b88e0076957e3bb24b8bd5bb46dc4021c0de07169e7f1
BLAKE2b-256 checksum
How to use checksums
8cd0fab19ada2c4fbe096a121677a33a1105f3d5d06ea159784f152a7d8dbee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp311-cp311-manylinux2010_x86_64.whl

Download URL lightrun-1.96.0-cp311-cp311-manylinux2010_x86_64.whl
Size 168.8 kB
Tags CPython 3.11 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
4c407931434cedc63d85fdbd3ff9ba744b62994e1d8079f3d4f0c3b20614fff6
BLAKE2b-256 checksum
How to use checksums
dd4e1d4e5742f864d9f4e8aeb49fc362b45d1cd3621567bd9f738366cfbf7ded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL lightrun-1.96.0-cp311-cp311-macosx_11_0_arm64.whl
Size 135.4 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
15bcf87abd239170058efea23bb5e621d421f8ec47c3005ab004330e9f2e2149
BLAKE2b-256 checksum
How to use checksums
59daf3c4c1ef186bfb9afb8b839e7bcb9fa18ce5eeea07a59975207d1f72a0d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp310-cp310-win_amd64.whl

Download URL lightrun-1.96.0-cp310-cp310-win_amd64.whl
Size 131.7 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
af547d6cf55460d5b1a02c3ac482571805746be86867bc5dc66d2d6aa1f8ce76
BLAKE2b-256 checksum
How to use checksums
e8265b7ac0d0fd1f36ec3ca903c2d49077908867994f54089a6aa3db0f883d75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp310-cp310-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.0-cp310-cp310-musllinux_1_1_x86_64.whl
Size 171.5 kB
Tags CPython 3.10 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
6e062da707a13ec02d92cc8e9e901d575583c840450c488755d8f2e3798b1c83
BLAKE2b-256 checksum
How to use checksums
3db0b2c2a860227298d93e0a078bcb3171b20742b8204cefb55889a90fc1a884
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp310-cp310-manylinux2010_x86_64.whl

Download URL lightrun-1.96.0-cp310-cp310-manylinux2010_x86_64.whl
Size 164.4 kB
Tags CPython 3.10 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
5262508f22cb749751406e82421cca0c198232fe565deea67cc6b4fb8711050e
BLAKE2b-256 checksum
How to use checksums
a360f9f9b4956875958ae043e16ee51459e6d1d29705a4c842892fb2d51b5d3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.0-cp310-cp310-macosx_11_0_arm64.whl

Download URL lightrun-1.96.0-cp310-cp310-macosx_11_0_arm64.whl
Size 130.8 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a954cf9a69b3a3d655ee5dff314e8189aead03928947d1eb881cdd8aacc67c8b
BLAKE2b-256 checksum
How to use checksums
c8db7694d22a9da9600c0b3fa0bca591bc1d8d03872a13b8fec38bf82e7c85aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Security for lightrun 1.96.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.

Release history Release notifications | RSS feed

This release

1.96.0 This release

12 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page