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.10.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec1a7c270b139d0a8fe3b40a5e91964b0e9cd432d3f2eced4e87a2b08b463381 |
|
MD5 | b1cd7003d01bfb6e9e6266735a7b8956 |
|
BLAKE2b-256 | d7d226a6e5d3fc0b5bd72701f0d5af7ed107b731a83437984ca3251b56d29a08 |
Hashes for lightrun-1.10.0-cp310-cp310-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2dc9015b0cde867501ca82965a7170cc6cb08591619b2ac2f06f196b038175ae |
|
MD5 | e0c3548f9040e904c43bcd7363fe04f4 |
|
BLAKE2b-256 | ba5e9a27d9ca5809652c0dd4f2223b6ec51e2ff5fe0cfff281beb299bec38b05 |
Hashes for lightrun-1.10.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 217764f55bedabf20c6c1aa8089f8187152fce807c63043b87f40eb17ee8d39e |
|
MD5 | cd3d30722fd19a5103d694b4771495ee |
|
BLAKE2b-256 | 558f2f102c63547c5905f220b8d37810f2953f64e8c43db41d1919662ec43186 |
Hashes for lightrun-1.10.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed3e4f1fee15913dbacdfdf7ee4e95874e2dc79099f7faf33b8d9e6690277fa2 |
|
MD5 | 9ec0fa48fb1cc5cf3bb76d4119774b11 |
|
BLAKE2b-256 | 9dd54c438f0e3849c2071aab0fce5ca18ddbfa8143e18fbf143dadcd5e7ff14a |
Hashes for lightrun-1.10.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ed7018f58c33f3c52beca05b6073db95e87e7e2bb138aa50dea0557593933af |
|
MD5 | 5fbe92aec1005054f76c955b1d1cacab |
|
BLAKE2b-256 | 4057c1921aa8c81127d6d422a223c3369712170ad5e09bfa2e89367538fbcd15 |
Hashes for lightrun-1.10.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5d4a8d4da45347e3a1cfb5543eab7d02a193a7c4b92d6dff31379e235c43c31 |
|
MD5 | fd65f1092f6546c2da327f7a8ab0dce3 |
|
BLAKE2b-256 | de4d04e9e910822c8e86fd45a9fd0db9e1d7fe59e61a48c73db0107df0d307bc |
Hashes for lightrun-1.10.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8efbf5f29310b9f3a6ee31ac7015c3be3cccd97e2715246755cf49600591b446 |
|
MD5 | 6bdc707a3eb6bba66f6df6390b3f139c |
|
BLAKE2b-256 | fe0a26f75945220e8194f370701541f69bb92edd659fd91fcabfc0da51739f47 |
Hashes for lightrun-1.10.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a025b02851b5b5384793389d5fd0cc5479b1075c6fd1ae62575bd8855701ade |
|
MD5 | ea44bf66b2f18a39520cc04a9930626b |
|
BLAKE2b-256 | 60a38989d4587d3897dcbd5f95d1ddc773222d65227935d4efd86ae7aa153197 |
Hashes for lightrun-1.10.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4a7f5cf439563af16f48e87801e10e640e79fbeff51e3abf91c26af462af084 |
|
MD5 | 675e27b23e365f9f1e46c50ec6b1e7d7 |
|
BLAKE2b-256 | 684138cb4c8d4d01a1794f9960ef4234205e6ac4dd2df96dcd8a43a2b7c74eed |
Hashes for lightrun-1.10.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b43035299f9edee48922582b5c4f88de626cd817d8597b7030436e0a634b1804 |
|
MD5 | 04232016b15890394bfbd65891de8172 |
|
BLAKE2b-256 | f05ff67957a8a116a416a4095eec06e881ad5f02422842dce5c100f0509e55d9 |
Hashes for lightrun-1.10.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2ff1ea21116b5ea7dae061d29ace72ce77250a4834867af8ccc59837d22f8ef |
|
MD5 | 629e421e67656dfe31473ed12cb8224f |
|
BLAKE2b-256 | 9eb3d5aab7beb5df1bfdb2929d5f49f891150db1b827bf8cdc0bf71ea4ddcf02 |
Hashes for lightrun-1.10.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9463a6b07f81f7dcd7b222d68eca71d9b39db89ceda3225dc21ffe0b20367dc |
|
MD5 | 7c6f4b5be70dd7436f3adc579fdd73a4 |
|
BLAKE2b-256 | f652c20df5e5874bd1c5aa73b1fd097a1624bb98fcac1c3496336c137e101181 |
Hashes for lightrun-1.10.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62f97a9def1b6ab1d1398b43e045f66bd28cda34af7215092fe0eb692b16ff6b |
|
MD5 | 8c9eb2f8619bd09738bb6cce6cccf501 |
|
BLAKE2b-256 | 8d80974291ee157f939902bb3ea408775f0972918c744f7111a59dc0c871b830 |
Hashes for lightrun-1.10.0-cp37-cp37m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba4e3060c2d02995839caef5d0d83723dc74e81c93e1a68f7ad246430b370263 |
|
MD5 | beffe0fa237e757a96a8f98c408c0a1b |
|
BLAKE2b-256 | 559026f33a4de5ac6ebe12fd5872a1630667473dc3a462eaaa6799a64ac71380 |
Hashes for lightrun-1.10.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 904114e5b3ebe760a00878bc23e22996c63f7994674bbc41de45bdf7779f6964 |
|
MD5 | da101cee84696577f471bade270c9072 |
|
BLAKE2b-256 | 1f768d7084df242f8dc34980e2b51bf33f1c03613f96aa82ffc51dc13c261455 |
Hashes for lightrun-1.10.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41bc68a23e1a7530da79a31f3ee6ffcef508e90969144e3ed08cf1a334730ea3 |
|
MD5 | 34348b7cf8a4260690e74751d123fd08 |
|
BLAKE2b-256 | 71fc688f7b5c9383e6c1f545ddc47575e655825480fb11455b21c70a3e9f514e |
Hashes for lightrun-1.10.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31dc24331716fa8e2c6eafba2ac7d850a6592f60bd11b346512fc4c9fdabae3b |
|
MD5 | 794a4f8c4fff612fe0746d73a02f1cbe |
|
BLAKE2b-256 | 5e57f017ff3f8c2290b8bbb9c10b614054ca47493e8d5a7d60c1c32f882b5696 |
Hashes for lightrun-1.10.0-cp36-cp36m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c5acca42482f7d6ccf82807beb5a87be4b6b6a5e1737d5e2a3b44ea5c8e59df |
|
MD5 | c9133249103f42ad23d2d4d88f5b55b5 |
|
BLAKE2b-256 | 76ba5fce0e01d12c704aaeed11527ad7bb735818323a154ac564178ca6265291 |
Hashes for lightrun-1.10.0-cp36-cp36m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74a9615c38197f7345d8acab76c39ed97a34372bef42f9e11116bd0f40351d4f |
|
MD5 | 1ce26ada57bb806005cfeda3d32c0897 |
|
BLAKE2b-256 | 8ad9abb9f21110c79607e966d4ecb567dd33e82ea1b56a3532c6edb98db2d9fa |
Hashes for lightrun-1.10.0-cp27-cp27mu-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 514919302b172bffdd532f53f211114ce3747214693c38e476834296e349d710 |
|
MD5 | 0ffa986ee8560469ccd0cae4bcd3ec16 |
|
BLAKE2b-256 | 88138c44ba9d268b68a8bcb84db8ed45453af531f9e90bf6bfc3c4256db63933 |
Hashes for lightrun-1.10.0-cp27-cp27m-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72f84b197805e5eb10cf7b6d32d49e218b977be63615251e9776bb58d1343c03 |
|
MD5 | df89f6a5062923a2a4c9bd49a207cedc |
|
BLAKE2b-256 | 495876b359980e855f74d6947028d1deea1b22b6a9bdf6aedacc25f126df4963 |
Hashes for lightrun-1.10.0-cp27-cp27m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50abd1428a295b2b4b0d01b823a076116962651b7540aad5f1ef81d2892b7e6a |
|
MD5 | 58bb25fb8cd3066857e03a7b8e2ae78b |
|
BLAKE2b-256 | 23fb47a9704f6a0db9cd602bcde03b3c2737ef637ab711c0e462f1b7951aa715 |