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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.91.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.91.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.91.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.91.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a82e730a1aa3b8a9ce89c0bf3f7080bda630e20f89c72b527d4aebb3a3f6c62c
MD5 e6cd5f1a1207085ed3cdbf1fd7a9c7b4
BLAKE2b-256 c0d0ae13f4bc6c5bbd556c1a5d843f9b52c51c9e80d1908fa252a07e1e50c048

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 dde894c22567e4993772ef95aefa59f4d7c21c88a7561c3ea88476da3d5cbbff
MD5 82f3571ee2d5d877b6787f0504e64032
BLAKE2b-256 75b1364b03845c7fe606058b83fd1f55255ab396d8cde4a038e04dcd5938bb73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0a8e4cac83029f7eea45cde239a46ba80d4796a22c98d0ad2b84040162c4c3a5
MD5 b9f3d53605ffcd0b3f60a40d752487de
BLAKE2b-256 07c2ccc6ae8cd5d7de2411fa9582c4c8c5a61ff25a88adf645e25a765846711a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ff15cd9b097316d6a0eea75c71600443e62db644aa9ca1534ebc6380a805d93
MD5 2a30e661fb4039f7342369fb39b01dce
BLAKE2b-256 f990dc09fc566c99b193df40b2ab3dd8353b7acd45c1cb7690f77433413bd9b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.91.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.91.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4464e82e67ef634cd0527d9d23c5c49ebbc705bc175dee124557be8963d9046d
MD5 2df04fc8b47002810c9a0ea6b7699050
BLAKE2b-256 168eaa737bcf3880e132cb10477b901ffd3cbbc92728af64845ef161b4143ac1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 169827cdba7a24356b1bf9a002ff6ed80797b9b760f6ae0862d2f0208d0817a0
MD5 d55575a3c333fc8ec4d167f2b606983f
BLAKE2b-256 3b2ff63d484dc964e9ead5b359712e5c30b15cd9bce408b1571c7a098754649f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0f562fb1dea95d4a21ed5110985ed0492c262ecf8d47ff84c9054445a3aa2520
MD5 341ed0c602e148268c88d8e893213203
BLAKE2b-256 5ff7638650de83fa48a02a83f825736c9f241d3c5b586a887bb8c4d7a18a8eee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8b06e8a12edee2d3a5b10d821c02f2a94ddd0a999e82caf3fa1ec46cee3e4ee
MD5 97eee0516df592b2a42e9a21d80427a8
BLAKE2b-256 9fd9fc2887619030002fa1ff1a6415a063ffe057559e7db1fe181fcedb0e0635

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.91.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.91.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 20dc9bd001a211b17903112b1547c87c03252366afa4b67e4a6a607da13e57cc
MD5 8b65de082e9c14bce456998f98e47d22
BLAKE2b-256 baa1d2582af2b961f7a45642b88883d06bce31e3108fd74aea2065e00c768d0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 e1e63b29f9f416f93183bd5ea340639897d9b1d8bc9ffa211a9a7e098ff8c3c1
MD5 f849cb669678257dc96a30b4f9c527fc
BLAKE2b-256 1b1d1fefabdb7bc91f4dbdae831ba247e9f13697d334d50ddb5f205216f3db31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 80282d78e2ed724662a0303fd02d8b6d8c96a0d4a3aabdea381b6ba13eadf9a5
MD5 2723ae0361b2899dc556dd85d5b5127e
BLAKE2b-256 c51a00e5e6c3e8cfe3baa9c0e4dae88ff97b2b74f4364232a7b9b8d635779356

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.91.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 90dab190298c93efa7856628907948338cf65c9a8fa90282293d213805ce67e0
MD5 459330d72d6fb2400428ab06873e5dd7
BLAKE2b-256 16fd383489c51e8697bb73d87347def0ad98035ef3f206ed1d8bfda0cc24d99e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.92.0

12 files

This release

1.91.0 This release

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