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.

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

lightrun-1.89.0-cp311-cp311-win_amd64.whl (135.0 kB view details)

Uploaded CPython 3.11Windows x86-64

lightrun-1.89.0-cp311-cp311-musllinux_1_1_x86_64.whl (162.4 kB view details)

Uploaded CPython 3.11musllinux: musl 1.1+ x86-64

lightrun-1.89.0-cp311-cp311-manylinux2010_x86_64.whl (154.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

lightrun-1.89.0-cp311-cp311-macosx_11_0_arm64.whl (126.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lightrun-1.89.0-cp310-cp310-win_amd64.whl (132.3 kB view details)

Uploaded CPython 3.10Windows x86-64

lightrun-1.89.0-cp310-cp310-musllinux_1_1_x86_64.whl (157.5 kB view details)

Uploaded CPython 3.10musllinux: musl 1.1+ x86-64

lightrun-1.89.0-cp310-cp310-manylinux2010_x86_64.whl (150.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

lightrun-1.89.0-cp310-cp310-macosx_11_0_arm64.whl (121.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

lightrun-1.89.0-cp39-cp39-win_amd64.whl (136.5 kB view details)

Uploaded CPython 3.9Windows x86-64

lightrun-1.89.0-cp39-cp39-musllinux_1_1_x86_64.whl (157.5 kB view details)

Uploaded CPython 3.9musllinux: musl 1.1+ x86-64

lightrun-1.89.0-cp39-cp39-manylinux2010_x86_64.whl (150.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.89.0-cp39-cp39-macosx_11_0_arm64.whl (122.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file lightrun-1.89.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.89.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 135.0 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.89.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 0e2cb1a1eaf6c76056e2afae00676ef7b9dc53b19ab75e33579cd0f5b7f62283
MD5 9f1df8488e23c2c18489c5f9f6a8a535
BLAKE2b-256 993913b27c0dfa893d37caf0fcf0b0186c28098e156ad3568d2beb97be35d467

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp311-cp311-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5289fa36ca04a5b197a8ffa485862aa39a6b1ee84da80f110b0a11ea89ce70a2
MD5 6152bcb68089f6cf436a7df559e95d7d
BLAKE2b-256 ed5b7f0f0c1c22ecf194300e03b8674f53fd3132e7161e4ed480fc5c663a53e3

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp311-cp311-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 dd1024ea2989e70ac287c5ec355e9146b2937117671eed3da4acf62cb649acb6
MD5 26408ad280659beef7efc19067ba54f3
BLAKE2b-256 4eb031e30fbbcf25849384da6132a2ceacbb4854a069ca3317b3de6b76b713e0

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9a9c4406642ea1dc8fb767f2de8eb4be721b5afcdb080fc1d42d45e3f87b387
MD5 ba3fee9d14b89adbeaf343f2a5520347
BLAKE2b-256 e2dd7015c9f9a81233647a629f768bba38c2029bf16059798caa4a2640fe16e2

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.89.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 132.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.89.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 70ccee1fe51a4300bf08ac93ed5d71b1c605d6e8ebbd878b0d96e80fb3d49274
MD5 c6a49d679ef86e7ffefbf7aa2d9a3453
BLAKE2b-256 52493529ea1b9c0499d65e3b4781e42cf48552201d2c79b54587eed5842ed575

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp310-cp310-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 28bea53aed137946a4b261aa444a845dbee888639227fb69acef790e64bebf2d
MD5 df475528a70e07cd915ae4d6489760f4
BLAKE2b-256 f770ada2e1ad5c5dc0f8c3fe3cc0601270854d7f308934e518980fd30cab6ec8

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp310-cp310-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 76aa59b9167f8247497a646bf0e0758c4be7a05090b151d952452a478e3a2795
MD5 afd22f459b668a47d269b2dab65b8f9a
BLAKE2b-256 af27c613ced66006a481aa14a30560cbacadac0127461004b3d9e2aed5b77149

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10cec7b1c1649ae732eec69b909617b5469ccd20beedc9c691484af14893b2ea
MD5 8003bbec76fde5a252d7c4c398054b08
BLAKE2b-256 6ae9522693fe6e37e33329541dec23218ab316ab1b8ae8f114374d1d7e3714e7

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.89.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 136.5 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.89.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 59757fdd6c1da67ba2b61cdc42413c4a7f0e5044a313c0d9723df0059895324f
MD5 629f55dcda036cb95f7688e0b5d0d627
BLAKE2b-256 7389bc15305680da42f7b21f0c9ff74d99aac6d2ded502012edd367e4f822744

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp39-cp39-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 9825e24e698c05db19ae9510a12257d7ed7704c80652c8d0c4e714830ba28afe
MD5 8bdcaecf307ac6e29f6261d638dafb05
BLAKE2b-256 36ea7175802bdd67e9d4e8769ca1804d6677336fc5d6bd5d636a14044db4d5d0

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a10ddaf9cdeb6ca40942fe90f8ec3e40cdba196b224914d0f78331ce8116412f
MD5 44d7396942b523327943f564f20ec853
BLAKE2b-256 ca70e2d3a51787dc78fc99458c1a10af28f2193157101052609f461387185014

See more details on using hashes here.

File details

Details for the file lightrun-1.89.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightrun-1.89.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8bce77b1037147297ac78cdbdb7e652be6af0f2006cbf183f7d77ca73ae06c59
MD5 96cbe24f77045eea1b6c6383c3407b71
BLAKE2b-256 da950784fe7d97cac9a16f7cc4bc5b508f39c8c588518bd52347de27298ed5bd

See more details on using hashes here.

Release history Release notifications | RSS feed

1.92.0

12 files

1.91.0

12 files

1.90.0

12 files

This release

1.89.0 This release

12 files

1.88.0

12 files

1.87.1

12 files

1.87.0

12 files

1.86.0

12 files

1.85.0

12 files

1.84.1

12 files

1.84.0

12 files

1.83.0

12 files

1.79.0

12 files

1.78.0

12 files

1.77.2

12 files

1.77.0

12 files

1.76.0

12 files

1.74.0

12 files

1.73.1

12 files

1.73.0

12 files

1.72.0

12 files

1.71.1

12 files

1.71.0

12 files

1.70.4

12 files

1.70.2

12 files

1.69.1

12 files

1.69.0

12 files

1.68.1

12 files

1.68.0

12 files

1.67.1

12 files

1.67.0

12 files

1.66.2

12 files

1.66.1

12 files

1.65.1

12 files

1.65.0

12 files

1.64.2

12 files

1.64.1

12 files

1.64.0

12 files

1.63.0

16 files

1.62.0

16 files

1.61.0

16 files

1.60.0

16 files

1.59.2

16 files

1.59.1

16 files

1.59.0

16 files

1.58.1

16 files

1.58.0

16 files

1.57.4

16 files

1.57.1

16 files

1.57.0

16 files

1.56.0

16 files

1.55.2

16 files

1.55.1

16 files

1.55.0

16 files

1.54.2

16 files

1.54.1

16 files

1.54.0

16 files

1.53.4

16 files

1.53.3

16 files

1.53.1

16 files

1.53.0

16 files

1.52.2

16 files

1.52.0

16 files

1.51.3

16 files

1.51.1

16 files

1.51.0

16 files

1.50.7

16 files

1.50.0

16 files

1.49.1

16 files

1.49.0

16 files

1.48.1

16 files

1.48.0

16 files

1.47.3

16 files

1.47.2

16 files

1.47.0

16 files

1.46.0

16 files

1.45.2

16 files

1.45.1

16 files

1.45.0

16 files

1.44.0

16 files

1.43.0

16 files

1.42.0

16 files

1.41.0

16 files

1.40.0

16 files

1.39.4

16 files

1.39.3

16 files

1.39.2

16 files

1.39.1

16 files

1.39.0

16 files

1.38.2

16 files

1.37.2

16 files

1.37.1

16 files

1.37.0

16 files

1.36.0

16 files

1.35.0

16 files

1.34.1

16 files

1.34.0

16 files

1.33.2

16 files

1.33.1

16 files

1.33.0

16 files

1.32.0

16 files

1.31.0

16 files

1.30.0

13 files

1.29.0

12 files

1.28.0

12 files

1.27.0

20 files

1.26.0

17 files

1.25.0

17 files

1.24.0

22 files

1.23.0

22 files

1.22.0

22 files

1.21.0

22 files

1.20.0

22 files

1.19.0

22 files

1.18.0

22 files

1.17.0

22 files

1.16.0

22 files

1.15.0

22 files

1.14.0

22 files

1.13.0

22 files

1.12.0

22 files

1.10.0

22 files

1.9.0

22 files

1.8.0

21 files

1.7.1

21 files

1.7.0

21 files

1.6.2

15 files

1.6.1

15 files

1.6.0

15 files

1.5.1

15 files

1.5.0

15 files

1.4.1

10 files

1.4.0

10 files

1.2.4

10 files

1.2.3

10 files

1.2.2

10 files

1.2.1

10 files

1.2.post3

10 files

0.0.1

1 file

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