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.92.0-cp311-cp311-win_amd64.whl (135.0 kB view details)

Uploaded CPython 3.11Windows x86-64

lightrun-1.92.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.92.0-cp311-cp311-manylinux2010_x86_64.whl (154.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

lightrun-1.92.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.92.0-cp310-cp310-manylinux2010_x86_64.whl (150.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

lightrun-1.92.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.92.0-cp39-cp39-manylinux2010_x86_64.whl (150.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.92.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.92.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.92.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/7.0.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.92.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f8d616beed48f0845b7160cd8e5027f782ec25b810563e819c4dd577a68398dc
MD5 e32d46d48a220d7e24d0f26b600cf678
BLAKE2b-256 f7239dcc884e2f05489c554c1b2c35ca9828692e223da4ab2b1397ac8b165bc0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 29f4a58cc0a23284b8acf0385d43e4d5c9c5dbfe95934eb54baa2993fccd38b2
MD5 ca4f9a5f7b5ab439e2faa615496211d7
BLAKE2b-256 4dcf62a655ca8d4e7e68e7b8b54a0bfd167a5f5d75ef39e72a8f50583567e621

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3cc38b0b9bfb516d6679ab77bd86c5bfc54b56cd5d96415dab9a62e33bca6a4e
MD5 2506b2393f103ca8c8161ea24c01e461
BLAKE2b-256 89aae129b889a5cf708c908ba4631a3a309b8c45df9002f7419c13ae637436fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c691469bbecb1a4527c12868f809eaeada0fe68b320f1d65dc44dbda7ce9e93c
MD5 f1b10dc679ef744d0f66012fef1808c0
BLAKE2b-256 6678008fb125cc9e000df325a514ef0e172a04e800b7129ea37c8093af65a881

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.92.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/7.0.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.92.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2d6a64f3f94a1f931ebd5a9b1e17b4597089ee573c7f4bcf0150b38439f0cc24
MD5 9081ad2f48c939cdf4fa801365dd7b6e
BLAKE2b-256 b5cdaa110632957189cba8164aea167e1ad3b00dac2e85018972eb864b019e3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 49230edb16d7d1e5307f4d4113f135e994bc13a0810b76a8c0edbbe361e3ff0c
MD5 34cffde8a0f80ca0efbeb642ceffdb49
BLAKE2b-256 fcad1f51c297e40b18e1c9a43b6bddbbbe6d6fb9340266e72749ebd5c1b09928

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 359c2c85852e8ea0963bd82d8aea534aeaed23e02449b82609c72e36ba4fc08e
MD5 82d85707756b0adbf1e0b9ad066b90d0
BLAKE2b-256 b01120d19993b02e5358e4c5101256c5328698acf3ff28b590d85f7bf5111a82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be30836fe280f60eb7203136ba969521c1ae0fb87521410415ee61bdc7bf3779
MD5 39c5b2f6d24d5261b8370044a130dbc0
BLAKE2b-256 6ad39405d2cc7eb52fbdf024e0a72b4ed45a75a85f1087d4b48d65072e703e11

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.92.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/7.0.0 CPython/3.11.5

File hashes

Hashes for lightrun-1.92.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 502a02961631be7e3342f7610402014f9973dc688a4ca61724fd20fe1cdfa49f
MD5 6e388356206dca4e8c286d301c4e90ee
BLAKE2b-256 3e094cf57da7420d10d3759f74ec21c2e95d9ee154069cc2af178711a74a3489

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 af8c0d0ead8043ae561d1ddcbaffb85ced78446b1eaddd90890b7123ebbb1fef
MD5 012f7fecbde2f7b9a7dcd706dbc7765d
BLAKE2b-256 badd7ebbe6dc40d7812071876be0edde189cf281b2971edea4336e28936f7d85

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f348e1e8137711f37307d9d6a6606153bd0ef15582bbf4767a6676b49beff9a4
MD5 ee4829aa3dce6a35d7a27f06d4bbe560
BLAKE2b-256 5f15baad250799a7384504b893cef3e0eee06006c73b52cbbe5c156baf336c6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.92.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d56ed2fa96c16b53eb7b7b9a3e4223087d8de9fb0c1b9aec17afd8efa755eb6d
MD5 22c4ff602fcc7e9bf86e76f3d3a28095
BLAKE2b-256 a5276404d295acf3389429d0cf8f48c088ecc630fdf4adcf723b3a39db0287d0

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.92.0 This release

12 files

1.91.0

12 files

1.90.0

12 files

1.89.0

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