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

lightrun-1.45.1-cp311-cp311-win_amd64.whl (887.2 kB view details)

Uploaded CPython 3.11 Windows x86-64

lightrun-1.45.1-cp311-cp311-musllinux_1_1_x86_64.whl (821.2 kB view details)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

lightrun-1.45.1-cp311-cp311-manylinux2010_x86_64.whl (819.5 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ x86-64

lightrun-1.45.1-cp311-cp311-macosx_11_0_arm64.whl (760.5 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

lightrun-1.45.1-cp310-cp310-win_amd64.whl (743.2 kB view details)

Uploaded CPython 3.10 Windows x86-64

lightrun-1.45.1-cp310-cp310-musllinux_1_1_x86_64.whl (771.9 kB view details)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

lightrun-1.45.1-cp310-cp310-manylinux2010_x86_64.whl (772.7 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ x86-64

lightrun-1.45.1-cp310-cp310-macosx_11_0_arm64.whl (617.6 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

lightrun-1.45.1-cp39-cp39-win_amd64.whl (745.0 kB view details)

Uploaded CPython 3.9 Windows x86-64

lightrun-1.45.1-cp39-cp39-musllinux_1_1_x86_64.whl (771.8 kB view details)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

lightrun-1.45.1-cp39-cp39-manylinux2010_x86_64.whl (615.8 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

lightrun-1.45.1-cp39-cp39-macosx_11_0_arm64.whl (564.7 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

lightrun-1.45.1-cp38-cp38-win_amd64.whl (744.5 kB view details)

Uploaded CPython 3.8 Windows x86-64

lightrun-1.45.1-cp38-cp38-musllinux_1_1_x86_64.whl (771.0 kB view details)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

lightrun-1.45.1-cp38-cp38-manylinux2010_x86_64.whl (614.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

lightrun-1.45.1-cp38-cp38-macosx_11_0_arm64.whl (564.3 kB view details)

Uploaded CPython 3.8 macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f6dc00d93cc881d54434911bf5feaadefc36d6f194fcee1333f6236774f4b87c
MD5 3f0566515c89e6256b236118425c5f8a
BLAKE2b-256 d75219516b170557053f6a91530f5ab2533edc0d4878dcf0ca698c6f0efe517e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 d806e70a302cf86c79ad6b6818cb0ca2eeaddd6d42b2cf620b2b706c461787ba
MD5 9f09f19e04d1d2588cd727cc5b3ce2dd
BLAKE2b-256 da9c48727033c03256fb42a225f6ad3537d9fd64ad57f1910908c9d44d4d8cd3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f2d69ac0ea608da5b0ac400e5a389935a5a2a83087ff4f0c790e63062fbc6b78
MD5 abf22c16e88a70c176031ca7c72c1a3b
BLAKE2b-256 c45cf50b4d01aa41cf79144c00b1d80d72fb2839f618bf5dc68d6f05ce0c4382

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bba95f0a23378fd821d7351434d6ebfd8c96d3bc3b2894000d52de7aa345a9e0
MD5 30038cfc8826b6d4a6f0f491c2901422
BLAKE2b-256 395b2fddc3511431d5728d2c92a4b18e937247814959f7cc12163f1aa870b065

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c9149ce36f12d8b46f34782bb888547fcf7b70311e4f8fb9f81c27d3a22a833f
MD5 6dd5f4ecb3edcaa26286665a887665ee
BLAKE2b-256 14fd2cf55caef0fad1884e52d5948e1098ad640669d9bb61d9a049eec97caa1e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 43a668fd9aee18c1682df55734555b395868377b608409fe92128a74de37110c
MD5 810e4ae3cd41ef74c0a320f3a77ce3ee
BLAKE2b-256 bcc4aa0e539bf0421cefb32e2d2f622d4f0b2dda34ae1b6fbd93c41be3e9922e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6174635af5e46f7479ac658b4507fda0be9c0c8b222482f4bfafaafa5c4a292e
MD5 e911b07dca574830b8e0c2b9f8cff92f
BLAKE2b-256 44e806ce2d0ece7f7b01015eccc8014758fdf84e9c3921cdbf5d21b6196924a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4451a36af0f1042bdd1838513c1d914ec64b56a6cf02efbbbd43bc06ac9032d0
MD5 42b31ee6db63dade6a13cb47943ae253
BLAKE2b-256 968213e6472152805fa1b3ed2ce97936ebd3020d1181e318de6f5c6d6e09d22d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for lightrun-1.45.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1a1bb553382e2d9635c63dbcc63b8d67f598ce5657f187537174946ea8a4d554
MD5 66d062f2c995792e730353c606f359fb
BLAKE2b-256 25f59d48ba7a0d0d62c08878d314c84307b028752d80fcc17902c0732acd7bc4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 5855442a58bb71e610c7acab4944db735c8ee676cc5c2bb10a2296675c626397
MD5 552a6c01cd6e4a47fff5b0510f95df89
BLAKE2b-256 5ad10c85921daf50067d0cf418df4a613011cc7b9000d7dff2d285f24036e3f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0687395a40e5f8a91182dfa0f331ab2b703f3508fcd15db78a6eaa43e4846276
MD5 0e797042d697d2a7390160c2b4cf1a7d
BLAKE2b-256 4c40a9968220538ae8395c8b4fcebcca9111b24cc44b79bf5504a90df35467e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.45.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c1f02e721703ef00ee06ae892ad5760a46b8f5c46f66478a0a7e10f3946a6dca
MD5 4966ce8c195b24aa9c09a23326341461
BLAKE2b-256 4a8916aea269d29db462105de1c3adb5474987d71b0faa643a252eacf15485a0

See more details on using hashes here.

File details

Details for the file lightrun-1.45.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.45.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 744.5 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.5

File hashes

Hashes for lightrun-1.45.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 3c9e33bcad774c1bf78e91927740ec3fe6927e3c647e46dc0ae0acdda8274d3c
MD5 7b1c3a5f4d58d869c983325bf9c0c348
BLAKE2b-256 7d4f22267b340a775d029fcab93eac5b75da04926ebf41b5dc1fe5fe03d10dbe

See more details on using hashes here.

File details

Details for the file lightrun-1.45.1-cp38-cp38-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.45.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 3a36b3d1210d10debca48b7969a3fac0c084bbd8a2a7561d729e0fe20e718dd1
MD5 2284645892da225d3d95a5da217bbab6
BLAKE2b-256 af7f59bec7eb3be83f0d118c73735df6c938a9043333d2fb09182bfcb45ee0aa

See more details on using hashes here.

File details

Details for the file lightrun-1.45.1-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for lightrun-1.45.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3ae3881362e03dce8b6ee3d9b97f20a6104884b0e3ae6361c978353017c2fc83
MD5 521a9d4c2d75a4010769c47f8cd4897b
BLAKE2b-256 642e5140b15fe335c59544024ecc26e3099facf57654d7112b4f7539c4316bbe

See more details on using hashes here.

File details

Details for the file lightrun-1.45.1-cp38-cp38-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightrun-1.45.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cddfc900c3a8cf3f0cac54dbc8720798aa9449727a8933989bcb7e4bd6eba0db
MD5 6896f44ca3b6f938cb72c62a5ba5c1cc
BLAKE2b-256 dbaf6c4e4a55001933e66a31e428ba482e7fd71a5539e628767f0bfecbebbb95

See more details on using hashes here.

Supported by

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