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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.10macOS 11.0+ ARM64

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

Uploaded CPython 3.9Windows x86-64

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

Uploaded CPython 3.9manylinux: glibc 2.12+ x86-64

lightrun-1.85.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.85.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: lightrun-1.85.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.85.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 30836d22cefc04ec2d48a78fac4fb9bc0a918bc5dbe7c2f9a34a6a7a5e076267
MD5 139e93d0eb91346a815d2b9f80ec7907
BLAKE2b-256 b65d5ed9d068daf9576b5991c5df2d08a8b48fbd400dc20a7b4df04400e4c457

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 c907af2a904de12fd541a536d08282663a9e23c0518be3ef1924734a0aeb85fe
MD5 c6712e5caccd6f15e4ef0ece9c7e2243
BLAKE2b-256 ac09dc8ee8a4f9d80c325fed69df38e790c6a195edce0d24efaf5af8e05c1495

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp311-cp311-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 951951c054d71a40fe76e90c207f424ce1df6646f8646a41c702dfc83e95737b
MD5 404b6f7aa1a3c5024316770f962912ce
BLAKE2b-256 b84774fc1f7131f79cd21c68c10a3c1639102fbdde189e384075f492e1367aa2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 539c6ca96fd7f4aabe135e6af2b1a416b5a302bdaf87535d7efcdde91d1bfcf7
MD5 aeda5c8307a101e5702c758caa794a94
BLAKE2b-256 423e7f6d10719dd5deeffb4300ee9f2fc13fe357e17da7665bf4bf642b782e7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.85.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.85.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f0e865f58bbf093b17618131d4cacd108ab7fa458d75c8cfe8b66ab00dc7718d
MD5 bd668529d214ba7af58c9eaf032155ae
BLAKE2b-256 8c894a7dcc0ca787f0bd0f3b9096270031e2d4c27de73305d685bd1186fc4201

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 80f317c5f2ff0ddb1ea26154b738d0561ddce849a469e6087e2eb33b0ed4ec26
MD5 353c2cbc009f9fbc1de4cf86f034e8f0
BLAKE2b-256 657d0949de8369cb12ce26f9fa902637a151c119feed1edd2d1823351be706cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 73d4e8f07821a66d80843324a75e257ee6df818ff72ba3925fbba1dd61651b0a
MD5 c796c6d9af5f43877a191a61209e568a
BLAKE2b-256 2e210f82d658b0eb9e5c424b2d16105eb54ea7dba5f8fae8738205dfe73e4a25

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e59ffe5dc48d2db6531a5246b79444fffd86884b7b6e61342168064a3e22b7a1
MD5 c966bfac96302ce21287bc0ad99c3dfc
BLAKE2b-256 302e428ab6f4998daf96b77ab786c58cdaf4ed961a5b27704d69a72563ffe963

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lightrun-1.85.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.85.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 824e3316d5b95656ed2a57f4a47c16323b830982137aeb1b40717b13ca3be679
MD5 ae24c37e70c613f1a1aa485588865699
BLAKE2b-256 c9b19828f965833bec8af229336d3c2a8abbf63a09d29abfd2413dba2ac63f82

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 bbca070901b5bcbe7630e9a657357653b4501e014b89a4d7e40711980705d6f7
MD5 0145215705229ea2451f80962168fbbb
BLAKE2b-256 2efcf861955ae7ed904f9dffaf63b1fdaf05e71a4723bf3ae17f675190c270d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 2b9044ec3f662e7ba22df81a76fed54daa36806fda33ab47b095eb406050e869
MD5 b792c1170c18dc368ad09500639f1c53
BLAKE2b-256 2257eae31c4689dfd6c84e30115688bd5b89c3cf55ab49f148e570745f8cc15f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for lightrun-1.85.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2098f67ff883dd7c3a6b16f906442cec12af1d4b6b2a189d4ddbb0fe4baebebd
MD5 d9d4f541a94be39a3d418d6086543682
BLAKE2b-256 3e20b0e7857521bf21f2ac6f39f8ccf41bb88bd68cde0fe7765709bc8f578019

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