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
Hashes for lightrun-1.13.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c52cf62a75d256d0ab6e771b1e93d52f84bac843b726e32a4110a73d6c34f2a |
|
MD5 | abb81ea680a1be315af51d58b2dcf07e |
|
BLAKE2b-256 | 696bdf1387b34b3a1dbd82170cb70df3785dfb9779c507d6ec8c323234cd46a0 |
Hashes for lightrun-1.13.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a78d68902a2732ab0c8ae83c478a83cbd619e9dd4d14aea1f34ec1b95392bfc |
|
MD5 | 8f55448ebd55779767075bcb8109f34d |
|
BLAKE2b-256 | b02204272047efde877a1fc303551569e8902f6c89552313e24bf409b2de76a1 |
Hashes for lightrun-1.13.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7fd2decff0c105cb83cec4f6831377490cae2784404ce98b78b97d353b1cfba |
|
MD5 | 2f443938a4f1e27fe600082cd88a3dde |
|
BLAKE2b-256 | c4d970c82452a84a82c13d4e7be18fd4c0487e331d4d2475c1de74a3975f82e0 |
Hashes for lightrun-1.13.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8adf4b3b638fc627dd485482dd6c300d1edcb928b31f180cd94ce3c3ec359dc |
|
MD5 | 0c44f7fd4adbf0ef8900bdc99a4dd72a |
|
BLAKE2b-256 | e9ccc2cf4608052fe020a7bb1cf888bd3b850633d76be7e346b54e09c2800785 |
Hashes for lightrun-1.13.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49766d970a6b903f0b13e884ebcccc234b2c8625301a4c7b779a7cd3faf1309 |
|
MD5 | f5a2122f2e820cdea5bdf75fd604af1b |
|
BLAKE2b-256 | 9cdcaad741c91ae51cc48192c7982985ee1efadbd7442847d41fc877ab89e883 |
Hashes for lightrun-1.13.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1702631557b11ccc33fd837357a4193140fa40d369119286ddf6ed44b79b0ffa |
|
MD5 | ab3512a5442f89b8f389d9717a61125e |
|
BLAKE2b-256 | b7c72f12f8609b34e442fa75e15d3ff630b9e358a09521994f9cfaac7ff7772d |
Hashes for lightrun-1.13.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3fa726c6af24ad98d425909056e024e04335c8b05e7f6a36d137d9e37a84bfa |
|
MD5 | c64f3ddc70876e3b06e9df26d92b99da |
|
BLAKE2b-256 | b5b2e8b59eb29cd77b0773b6f21198797b7172a89300fe7db96ddf20f32009fb |
Hashes for lightrun-1.13.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8421c2a42903e6ebf48102c26532b24182e8a44c20967f4668d302ef1dabe736 |
|
MD5 | 441ef13a4b9eb6c679c50d229987e862 |
|
BLAKE2b-256 | 339ec3c5853ebe6e8bf0261e490bb157e7c7d8e1dbc3d4075f3a9396636dba2c |
Hashes for lightrun-1.13.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ec09f6f595c31c39c6f202f66467b26859a21cdad7fdb9d24072b2e233c9d0c |
|
MD5 | 484237e5bf085056acd484f96f00b6de |
|
BLAKE2b-256 | 480ca5f4e1294767f09cbb3584310944efbafb5bf928d01855b2e9e6ae49b652 |
Hashes for lightrun-1.13.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b305d0097e06f935bb50eda08fd976db5b1bcb60be2fbf2c88d7cc6f80a1aa |
|
MD5 | e2a04647188b0da5b28b4aadb60dd37b |
|
BLAKE2b-256 | a543c10a080e8c3b586befef09141105da1dfe77e1efbe84faf9b6efe6af444d |
Hashes for lightrun-1.13.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff19621e819e842f969cbd537381c6785dc9d458ec34391dfb0dee885de6d574 |
|
MD5 | 22523ed194d32517c7a25ebe5f34d69e |
|
BLAKE2b-256 | 28c72907976b5ec5bc2beb348f91f740c3b1942cc156e02a8194e8903d3c4a50 |
Hashes for lightrun-1.13.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09840cf816a3d1cd0ce259086c603ec81242aa406f6b1d6d0641064ac76a7c3d |
|
MD5 | c682beda7bc4eafd0518187d5c48a5ee |
|
BLAKE2b-256 | 5c7a42ba75e83769cbd766d50f5e3659b1dc52fe0712cedcbeb93479785125b3 |
Hashes for lightrun-1.13.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eac3d19cc533d01ebffd0747dfc590c5bf1600731a930a7e9705cbfcb6b2ca89 |
|
MD5 | d88cbfb72ea7c722093e2370884b2f1d |
|
BLAKE2b-256 | e9df55b1d1d3f41e158c558b02378b8f5ebeb76156e3d692a717adf9e0bd9706 |
Hashes for lightrun-1.13.0-cp37-cp37m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4367925951d79dca03ea0ee582fb7573186c611e77d4ff476a3b37fae47948f4 |
|
MD5 | 593d9a40fdf696ea1d2c617be41206ee |
|
BLAKE2b-256 | 9584dfc4dafb8f1beaf87ad6d5ad8e6a81d201e10de3e0f68058519e97607475 |
Hashes for lightrun-1.13.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a68b07221be4bb80bff65b47b22a06b482fb41a9d3f478e3f98905cc8cf563e1 |
|
MD5 | 255a6ec24818e74eabb237ca4a69f105 |
|
BLAKE2b-256 | c03bceffa23ab183be5a21b239ac7a443116be0cdd4a6429d7f9b3afeeaf29dc |
Hashes for lightrun-1.13.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 255128a3c1bbb709e943aeb69b042e1e17a58f5f68648a5054d8d18388f136b9 |
|
MD5 | aa36b20af4bf07d8777751f00063eb5c |
|
BLAKE2b-256 | 642f5f6928b7ec7b59043fbac2ec89b2fe47f903f9b6ce5e748c928e6f673abc |
Hashes for lightrun-1.13.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a3a00134eee39f4364826dcdba7254d796351c6ce107af9bd9e540c73e4049d |
|
MD5 | 6608079a57bee7eab29d14cf0d5bf189 |
|
BLAKE2b-256 | 483163ee9be69093077396122b90242fb6d63aa7e6119064e679fc9fba8f95bd |
Hashes for lightrun-1.13.0-cp36-cp36m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04d70ce5960a6c09e3061cb9d81fa31dff532dbe299c8f085d6d3731e5b213af |
|
MD5 | c76d100f8b35dcb3b1cbecc9223dd7b7 |
|
BLAKE2b-256 | 82db126cf0c28b6e801750488e9973e6731ad623876aed5ff787b52d7962e048 |
Hashes for lightrun-1.13.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbca43c85af1fa13c94c58fabfc566861dce9054c9750b1faf045f98e483a02c |
|
MD5 | ddec284759fa3854581737e9a7634b76 |
|
BLAKE2b-256 | 06be220be0dc6cbc5afe2180640d8603bf113d766a4eed98eaac1a0d2e9c205d |
Hashes for lightrun-1.13.0-cp27-cp27mu-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59be7feb1b2929adeece2be4c080e889940a535c82b0815c8aface17213aab03 |
|
MD5 | b79c91762c3c21acf7d26c1bd34456f3 |
|
BLAKE2b-256 | ec8051f4db8e9d072b8a4c6c804b99079f97dccdda2358adf3eda488c4caa83f |
Hashes for lightrun-1.13.0-cp27-cp27m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b11843e5e85657a43d13557fd80ade5877e3f500b60516b1082d45e5e0979eab |
|
MD5 | 40a0bffe50011447f9d0e11fdb024dd1 |
|
BLAKE2b-256 | 809e4dc364561fa017a96ae84747e13aa38eaea2c2f139b1b7e49a1cb6e47141 |
Hashes for lightrun-1.13.0-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3d2e2583b0554065211bb6f3dcfeef54cfd03b2686076c956af9410791ab6d1 |
|
MD5 | 86d9adddcd1e87529b69229717f34279 |
|
BLAKE2b-256 | ac0671c3848a112d63b130457e28386f7cd8a25eaedae3ec4bbc76d1f04aa230 |