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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.90.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.90.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.90.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.90.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 ad78fe1a1ff286871f92afa8b47ed83b013c13c8198c719ea5edc5dfe3b2bfb7
MD5 66b41356706177717409c0600acd1aa9
BLAKE2b-256 826310c68412524f95ebf5e709e262b35b7ea989ba1a3466bb617de0d1734dea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 67b2fbc37a0914ca46c70e9bd3483bb71b8a116c5689c5092ea4d30d297e4b99
MD5 dbd03bbf4ea4a94bcc2a29dabc2759ae
BLAKE2b-256 1eec1816db0ff96d8b182af8111ff4c8eaf72013c28a219506c4bc0c96844451

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 72af2d8291235a3b3a6d3acab0037c04b1766699470e4e8940f81c605b6ea5a8
MD5 e9110c45f6af8e7914e5fceb4acbbba0
BLAKE2b-256 a21131d0153e8c5c2e29e8fee23787143b3080cc9be6001a92722284859fbbf4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 50bfb9cb81f5d411a7bf031e577c7d67d4b4999c0711970ef97f852fe5267b02
MD5 bfadeb617917e9cdcf449e2a0f08f5b3
BLAKE2b-256 26a3d5c46e440eb9d30d66a7bc1cba8852dad41904cad47412e38bc04bef0d2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.90.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.90.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 37a28d8300756d995921bcf85035c35c6ec4fec218bcf76bbd1f447c071c4a76
MD5 fe32aa3de2588105dcc819060022f7c4
BLAKE2b-256 a516587f6cd49a921acbd2150ab77e5c65b7a6679f1d97d9b2fd59a1580e9a0a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 405f457af5ac786ddec9241aa67e4adaad72254882b135ee9c9e5cd31e84739e
MD5 b7b97b17944d0f6301a5b53dc6b7c227
BLAKE2b-256 d13589ded54a46cf183b6f07e4fdbbfbf07487431692e82ef32af64a3172826a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8db58f16c1948cff8a01f519c4575faa72dee229f48a42a490de56e298a93530
MD5 943e66c3316883bafd9d4dce3ccf2181
BLAKE2b-256 e9d26dd3a1a7b572db1cfe983f5d369d774566256b7510533e284729b8a48a4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2160ed179ec8d1fe469943497086ac24d39a9e49ef1b99156c629cda2eeabc4
MD5 e8046ac9a99775fe4b93f100343c8090
BLAKE2b-256 2735f873f086cf265dd69ac3f91b595e0b9e822e562b1b05bfe7fe0ec473a020

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.90.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.90.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c7087a862986465fe07301339cbb16e0d8877c46590fdd9a1bac2fc66878ee5c
MD5 f84d01a2e4367a956e58a4302af1a5b8
BLAKE2b-256 9bbeed780c8791b8e4e3df963578b043f6a075d15a149421321e02f39360ee08

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 e35aac01b6d90caa9d5e1c7c075691c04405e5e372eb9decacb6e5a87f650dc9
MD5 b5ffe715b1a9ad3f0093f73eeea651fa
BLAKE2b-256 611720666752f126ba0ed3adc1181b1839082851884bd4e3f580002820013a1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1524b0a0afb081690e1e7891911d9afa46d2a4b62f1cf7b96e83d71c96908c80
MD5 b1c689d4744b5e9688eeb399364463db
BLAKE2b-256 1a0ec0be7509a6ced78c383f083a650e974d084c85b8a49ac22cb8f2d58b3469

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.90.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 507e401e89be08b91bf37de2f0a0d8682bcd2401ae9c968d8739ed7727634e9f
MD5 51969dbc0bda5f5495b4862a0f00f26d
BLAKE2b-256 e841eed5cc508c3c3a8986c7a4fd25226d1d8c8568050096ab1726f118fe8b95

See more details on using hashes here.

Release history Release notifications | RSS feed

1.92.0

12 files

1.91.0

12 files

This release

1.90.0 This release

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