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.

Metadata

Release files for lightrun 1.96.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for lightrun 1.96.2
File Actions
lightrun-1.96.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for lightrun-1.96.2-cp312-cp312-win_amd64.whl
lightrun-1.96.2-cp312-cp312-musllinux_1_1_x86_64.whl CPython 3.12 CPython 3.12 Linux musl 1.1+ x86-64 Details for lightrun-1.96.2-cp312-cp312-musllinux_1_1_x86_64.whl
lightrun-1.96.2-cp312-cp312-manylinux2010_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.12+ x86-64 Details for lightrun-1.96.2-cp312-cp312-manylinux2010_x86_64.whl
lightrun-1.96.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for lightrun-1.96.2-cp312-cp312-macosx_11_0_arm64.whl
lightrun-1.96.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for lightrun-1.96.2-cp311-cp311-win_amd64.whl
lightrun-1.96.2-cp311-cp311-musllinux_1_1_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.1+ x86-64 Details for lightrun-1.96.2-cp311-cp311-musllinux_1_1_x86_64.whl
lightrun-1.96.2-cp311-cp311-manylinux2010_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.12+ x86-64 Details for lightrun-1.96.2-cp311-cp311-manylinux2010_x86_64.whl
lightrun-1.96.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for lightrun-1.96.2-cp311-cp311-macosx_11_0_arm64.whl
lightrun-1.96.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details for lightrun-1.96.2-cp310-cp310-win_amd64.whl
lightrun-1.96.2-cp310-cp310-musllinux_1_1_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.1+ x86-64 Details for lightrun-1.96.2-cp310-cp310-musllinux_1_1_x86_64.whl
lightrun-1.96.2-cp310-cp310-manylinux2010_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.12+ x86-64 Details for lightrun-1.96.2-cp310-cp310-manylinux2010_x86_64.whl
lightrun-1.96.2-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details for lightrun-1.96.2-cp310-cp310-macosx_11_0_arm64.whl

Total release size: 1.8 MB

Release files / lightrun-1.96.2-cp312-cp312-win_amd64.whl

Download URL lightrun-1.96.2-cp312-cp312-win_amd64.whl
Size 126.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
de8a784f720563d93573f9ad1550c74b6d8f81e85b35354b801ce06aa3f01907
BLAKE2b-256 checksum
How to use checksums
dd72c548c95a034ec4982dc4630649a9273af89f8be3910ab929fdd975b63f9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp312-cp312-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.2-cp312-cp312-musllinux_1_1_x86_64.whl
Size 150.0 kB
Tags CPython 3.12 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
9206382881d42fbf0c8e092ef3427b7e7984e7ac5b151e81c50d11401f9279ef
BLAKE2b-256 checksum
How to use checksums
684b1dba226fd3a54040a721c78b72e1ddd4e7e25cc3deb72527f7ea92ddbcf9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp312-cp312-manylinux2010_x86_64.whl

Download URL lightrun-1.96.2-cp312-cp312-manylinux2010_x86_64.whl
Size 146.2 kB
Tags CPython 3.12 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
4710457b327c819462dfa06b444b3849c2822febb1c283e9bf49fb6b78b1f118
BLAKE2b-256 checksum
How to use checksums
65cc0bd076261b9acc09736006ed8d3f9b23b098c9d54447978b381f23b24499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL lightrun-1.96.2-cp312-cp312-macosx_11_0_arm64.whl
Size 116.5 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
64942280c7d3cfdfb0c5421c7882d374d57707d57d65758a3cf02f976e0436b8
BLAKE2b-256 checksum
How to use checksums
a2b5bb857cef41e6af9b50228a81321b426e38c4162b7b088c023994a6c3bc3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp311-cp311-win_amd64.whl

Download URL lightrun-1.96.2-cp311-cp311-win_amd64.whl
Size 135.6 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
d9988e97721e55bd3bfd3628b3211a4cc8f72a1d4135508618ec6d769cbb76d7
BLAKE2b-256 checksum
How to use checksums
46842674d7532e25766adb517191152679d50892f27d38bf445fd00beb9afec6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp311-cp311-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.2-cp311-cp311-musllinux_1_1_x86_64.whl
Size 176.8 kB
Tags CPython 3.11 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
3e01f5324f0deaae943ebd1f39e494ebb733ab32e1953485825af4752948be95
BLAKE2b-256 checksum
How to use checksums
4d4d857f8e378b04de0cc22142aef0133abb6caff9c4eede6b100527b5821eb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp311-cp311-manylinux2010_x86_64.whl

Download URL lightrun-1.96.2-cp311-cp311-manylinux2010_x86_64.whl
Size 168.9 kB
Tags CPython 3.11 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
2c9986373f77fca82a4df51f2e527019a80e739822f85cf9ca80adcf92c94bb7
BLAKE2b-256 checksum
How to use checksums
788080bb6796c09affcc2ce8faa8a4decef724c46f400eeb7473285b6b61426d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL lightrun-1.96.2-cp311-cp311-macosx_11_0_arm64.whl
Size 135.5 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8527eb746129497ed00d904a35d0848e61edb17ce2c54bc2876f327aadd89a40
BLAKE2b-256 checksum
How to use checksums
0e3ebb1363392bb894d56101dffda63eec8d0fc659ec8fa6950aca62f9130d10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp310-cp310-win_amd64.whl

Download URL lightrun-1.96.2-cp310-cp310-win_amd64.whl
Size 131.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
be6c48db46d2597d8832418655f963ffcba5fff8d0d676d274a469839a7609bb
BLAKE2b-256 checksum
How to use checksums
705277a7b9f372890639e5e546b8b5db58efbb2f2ebac83acf23e7392e674583
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp310-cp310-musllinux_1_1_x86_64.whl

Download URL lightrun-1.96.2-cp310-cp310-musllinux_1_1_x86_64.whl
Size 171.6 kB
Tags CPython 3.10 Linux musl 1.1+ x86-64
SHA-256 checksum
How to use checksums
fe6bb13868a6ac876fadb139d8bc118772d4c31c7f7f9b47626b3134aef94f3f
BLAKE2b-256 checksum
How to use checksums
e35eb94fc4774968f830eea78ded7cfc5ff5fdeca3a20ef720c833f57fa1baca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp310-cp310-manylinux2010_x86_64.whl

Download URL lightrun-1.96.2-cp310-cp310-manylinux2010_x86_64.whl
Size 164.6 kB
Tags CPython 3.10 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
24189bab09dacc086af1b0a0916ab77bd526e7670d078539765307af6a9e1f86
BLAKE2b-256 checksum
How to use checksums
ec4ee1bd878548fc051d0e74ed72d4734e0be572296e28d70570b0e7369f8c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Release files / lightrun-1.96.2-cp310-cp310-macosx_11_0_arm64.whl

Download URL lightrun-1.96.2-cp310-cp310-macosx_11_0_arm64.whl
Size 130.9 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ac2e92c79dac9208f79fbde9d51298e3ff18f3914690bcc73d83d7231c648e9e
BLAKE2b-256 checksum
How to use checksums
fce0eabc1dfc5bb5ee469041fd513afc97932fb561a2db76e54104cbf3d03292
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.5

Security for lightrun 1.96.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.96.2 This release

12 release files No provenance

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