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:
- A Lightrun Account - you can get one here.
- A Lightrun Plugin - you'll have instructions to download it once you create an account, but you can also check them out here.
- 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:
-
Install the python agent by running
python -m pip install lightrun
. -
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.
- 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:
- In the application folder, install the python agent by running
python -m pip install lightrun
- 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:
- In the application folder, install the python agent by running
python -m pip install lightrun
- Add the following code to your application's main
init.py
orapp.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:
- 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
. - 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
Built Distributions
File details
Details for the file lightrun-1.46.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 887.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20adbc74294846a527cc0b8584e146d612a02ffabd1660a5e9e1ce227f707178 |
|
MD5 | 8b4cac39cefad0068734605f7c840f90 |
|
BLAKE2b-256 | c7daa67b5d770225e324edae055f1fc05eab51f691d50e41f02f4ee69b693a44 |
File details
Details for the file lightrun-1.46.0-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 822.1 kB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff1efc09385132cb0a8539af8c266202f8860dc74aef5db6fdb9423bec9fb7bd |
|
MD5 | 07006992fa8682f3db3f68ee90bc1b0e |
|
BLAKE2b-256 | 8aa972807a7323d3b4ee346721897b450117e3ececcf0cd5241e145fd67b77c1 |
File details
Details for the file lightrun-1.46.0-cp311-cp311-manylinux2010_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp311-cp311-manylinux2010_x86_64.whl
- Upload date:
- Size: 819.5 kB
- Tags: CPython 3.11, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4256fcc66e8bdb11ec736b2c3152f36cc180a7f52e62ed9c4b3760e2c80b556f |
|
MD5 | b37a94af096b6a0fd35dffdc3aad8581 |
|
BLAKE2b-256 | 9f31acac40c55489e547f593647294c78cd3b65032417b52a63b1d317e9709ac |
File details
Details for the file lightrun-1.46.0-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 760.4 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6aa4078d3cdd80ccb9e61305528a7dc2af320b29ce0acb22c2a493be11972d98 |
|
MD5 | 40f8591aa368f435943a91e017ab5ca7 |
|
BLAKE2b-256 | 0a397c0a3863c2eaf85a251bd0d04357b282fc5fe32b400e4abe5d9f1bd6dbd3 |
File details
Details for the file lightrun-1.46.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 743.5 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 672f779c8cdb13d40e5f86cc414f67a0b5d25b5f39f2b2607b807a154bacf51a |
|
MD5 | 0cc970159e2d058dfa78c3ff91f3029e |
|
BLAKE2b-256 | 00a776cf85935780f4840308fe864fdd2adf26784802a14cc71b60579a2fb5a6 |
File details
Details for the file lightrun-1.46.0-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 771.9 kB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c709ca04e6961139770c4d905f5bb3122780d797a17ca603767176479c8a44 |
|
MD5 | 39ea63de7b2c5e6f4f73d6528295d533 |
|
BLAKE2b-256 | 9279d8c2389a9106c8bd755f20d243519d8a2865f3f960a5dd3c6594749f9aaf |
File details
Details for the file lightrun-1.46.0-cp310-cp310-manylinux2010_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp310-cp310-manylinux2010_x86_64.whl
- Upload date:
- Size: 773.0 kB
- Tags: CPython 3.10, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91ad0350582fed5f1d99e9064092a404c137a535d149eece7cab12aaa91b5e29 |
|
MD5 | a579591df88b43027b2a0296d43aea2a |
|
BLAKE2b-256 | 8584fd14ffed413e1b590ad526862e2a41fe37a3b42957fd43c447f506f78890 |
File details
Details for the file lightrun-1.46.0-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 617.6 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 456733338e6a17c36dfdc94a694b2f61ddab1188f7caadab7a39d2095e50faf2 |
|
MD5 | d8181df6ca48f3fbd43124d6d6ad1ca6 |
|
BLAKE2b-256 | 583b7f5d68f3156bacb9590f708a2cbf6a7af6181c825f3b089265e042d0840b |
File details
Details for the file lightrun-1.46.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: lightrun-1.46.0-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b996abf1de2c3d93039b32b914cb25cfe269e1af4c85174bd19464fec27ea7ab |
|
MD5 | 552ff0f408deffd8687c1c196e16e64c |
|
BLAKE2b-256 | 89c7b0f40cc9ed4241379de31bff217dcceb4f98c99d995d938510832ee10e01 |
File details
Details for the file lightrun-1.46.0-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 771.8 kB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9ac33f205776b861dd54c310f0bef83a87fec3333c045a3309b4c76dbb540fc |
|
MD5 | 9d3f8ea7aeaa0047051ad2653d60a68a |
|
BLAKE2b-256 | 9849f1c90640ece757182896db616bb7a2fc9dc2593a9f8fd0066dd26d5717a1 |
File details
Details for the file lightrun-1.46.0-cp39-cp39-manylinux2010_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp39-cp39-manylinux2010_x86_64.whl
- Upload date:
- Size: 615.6 kB
- Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37c9a5db8823535b1ea6e931e141592df96fc3357e5035e2299d933e3c2de4bc |
|
MD5 | cf9982d517ca4b03a10feb90a9dedde7 |
|
BLAKE2b-256 | b6fe3c95a81b5c425fcf27c2c74237ccc7367092bda90483b0241680b753132e |
File details
Details for the file lightrun-1.46.0-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 565.0 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a40adb7e64de6932922334b39532beba1da6e21d09f6ba872a056264b000cd2 |
|
MD5 | 86777ebad197cd4daface3954e2e76d7 |
|
BLAKE2b-256 | 7cecdf4815f5b77477e3f45a2d4be6e2b901b91a2315b05088e696efb72e34be |
File details
Details for the file lightrun-1.46.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 744.6 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a4f87f01fe31325c6ff88e4e56c4c0e78188fb4794c2cc6cb40cec084888ba |
|
MD5 | 1ea8c514ae057c6116b8d320b7861807 |
|
BLAKE2b-256 | 3efcd61134322aaa44a49bbf18b481e0a7bdbae14e8884fbaf029e411a0de071 |
File details
Details for the file lightrun-1.46.0-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 771.1 kB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43104a9c03fe3cefd2ca73e9daf655ff8759a64ce5be99644b6884600c29a38b |
|
MD5 | 45d8baa546c85528834d50d97cb8e186 |
|
BLAKE2b-256 | c909fe2eb9535747800b0f33ebb6b88e72072e6b285df74255f567cd862ed4d6 |
File details
Details for the file lightrun-1.46.0-cp38-cp38-manylinux2010_x86_64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp38-cp38-manylinux2010_x86_64.whl
- Upload date:
- Size: 615.0 kB
- Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24b1e0e5266e66afa89e40a2d4fb82fc4f429a2cd4a21a5d4cc90168ba036e88 |
|
MD5 | 6c748c628f47f1773ced3b1c6b2b5310 |
|
BLAKE2b-256 | b794ed1ee2d62816c09979cb392220b715f703cce9e063e08d41a4143051e12f |
File details
Details for the file lightrun-1.46.0-cp38-cp38-macosx_11_0_arm64.whl
.
File metadata
- Download URL: lightrun-1.46.0-cp38-cp38-macosx_11_0_arm64.whl
- Upload date:
- Size: 564.6 kB
- Tags: CPython 3.8, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f55c89022aca1933796202e2e6cf570574223888e003e01467995db496ff2fb9 |
|
MD5 | 0b627a35b8b262c892a953ca1e96d5ad |
|
BLAKE2b-256 | b13f661dfbfb561dd53485ecc86d97fcd15a6db80c4303b10263c04cc35701d3 |