Skip to main content

Add logs and snapshots (virtual breakpoints) to live applications - without stopping them.

Project description

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.

Project details


Release history Release notifications | RSS feed

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.88.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.88.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.88.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.88.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 34c415560bb7e204f4fb7e5021d883cf563b8d425de59905b4a8b785bc90515b
MD5 872a5e7ee24f4accf30bba61b6ab7b07
BLAKE2b-256 ecb273cd3b876fd9257e296ce06add0ef8d6ffe7b7fb6f289b7701d3d70e9813

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 4180d54fb83e539924c9ac76cd1159cb26f16d8d2595f165d6659c4df796e18b
MD5 23470f575b827702b147ee8182494b5c
BLAKE2b-256 8e36fe5baf7536fc0c35662b8a99b34be3735b469f5222da99fc6dee8ca3d1b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 82ca35ded1e4b4b736db2bdf09dd9b77482f92520b74b3409dd800682444b9a7
MD5 25fd978b32fa471b7e09711c220e450c
BLAKE2b-256 0d06414d8102c4ec3b22a4fbdb8a9cf766bbfd9426fd1c8bdfa465b378d02efa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 164d38a67dc76c5aefa649bf6091ea6fdf3597f8d84518376ce7ef1b98c99dc7
MD5 cc9f2ff431d602e2e2d2cc25aaf29c15
BLAKE2b-256 0785d1a994b01c6939635430194db5aa3881749ba64cdc6e02f3480f6d161eee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.88.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.88.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3c824e1dec223c0ef5a0535e10fd3445ed4e0eabb80a5bf073cb1586ce5bf947
MD5 fdb0a4197d95a7ac7d1f70aaa8697ffa
BLAKE2b-256 ec13149a4a18efc807d28f727abb248b65b5e855cb05eedc0e566cf8e31bb8e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 fd05ab663be18699a293f6449aa3e44c6e93aeb56855ab4ced96e55836c9bf51
MD5 5e705f80d26b1fd57c633046265e5118
BLAKE2b-256 d9073d6ffe82d3bcedf67cc927214e286252f2e663215907fa86aeac00194c12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 42f4e9307428667d47e45a6393cacaaf8767883239324e1a20845bc6476a14d9
MD5 e1fd2e36b6b31774a0cccb74d41e72e9
BLAKE2b-256 6bda319f987f0c07bbed94dc451b1a8d2147feadba5292fb04d79dbb39646014

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 905fa7b3f2ee765a4ebd9a5952bab457541eacf49342d291295d6ad475b18493
MD5 7f5ee9b10f6726a9c34e420b088d9492
BLAKE2b-256 7fdae45056920972778f79eebdce88a064819bbf93d5982c3ae88f1d136b18cd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.88.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.88.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 036b7b1690d0f1382c77150f635194ad20dc9d1603cd86c164a2bdf4397a722a
MD5 31517e574a4af4aebb6f31df1c06c111
BLAKE2b-256 b1daff8871c1753651c72fe43dc6de4e725a688e1ac0458cfd62d8ce4e61cd12

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 1648a8d396fe35cf6b12037a6470de89635fadb5c540fb389a7d47890d1d4fee
MD5 99b663c15609b2912ebf1be0548fa8d0
BLAKE2b-256 344da7f0e598865110bcf1bb1d4216ebd3720a38ea11fee74dcc8255f6668cdd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d900eafd5a051ddd06d10d31b16c6cbfd2b687c20e01df31208c7c219534d3b6
MD5 4f7c89c60ef666619fb3a0819e144bfb
BLAKE2b-256 6329f6244fe305fbb0b5b23416b8dca5c411f82b989045737f8fcd52af7012fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.88.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d4b6a93dfaee7814e2845eb1248d30366df1c8377352e77d2eae7d6d7d0eecf
MD5 8b6a7e05fc70644d456fc29862189e6b
BLAKE2b-256 2ad6ed179854a0c64fba2eec0b29f00d509a785f8403175a74949240db7a30ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page