Add your description here
Project description
λ-trim
λ-trim is a debloater for Python applications. Given a Python function and a set of inputs to this function λ-trim automatically removes all redundant modules, functions and classes from the modules that the application imports.
Installation
Install λ-trim from PyPI:
pip install ltrim
Usage
Basic Usage
To run the debloater against a Python script file.py, a testcase file with a specific structure is needed (see Test cases format from our accompanying benchmark repository).
debloat /path/to/code/file.py
By default, λ-trim assumes the existence of the testcases fike under the name data.json in the current working directory. You can also specify the path to this file with the -t, --testcases flag, like:
debloat /path/to/code/file.py -t /path/to/code/data.json
Scoring Methods
Users can specify the number of modules that they want to debloat by using the -k flag.
Additionally, the ranking of the top K modules can be set by using the -s, --scoring flag.
λ-trim currently supports the following scoring methods:
cost, which corresponds to the serverless cost models and takes into account both import time and memory footprint (default)time, which ranks modules based on import timememory, which ranks modules based on memory footprintrandom, which ranks modules randomly.
Users can provide their own custom scoring functions by extending the scoring function in ltrim/debloat/utils.
Citation
Please use the following citation when reffering to the source code and/or the accompanying paper
@article{pavlatos2025lambdatrim,
title={𝜆-trim: Reducing Monetary and Performance Cost of Serverless Cold Starts with Cost-driven Application Debloating},
author={Liu, Xuting and Pavlatos, Spyros and Liu, Yuhao and Liu, Vincent},
journal={UNDER SUBMISSION},
year={2025}
}
License
This project is licensed under the GNU General Public License v3.0.
You are free to use, modify, and distribute this software under the terms of the GPL-3.0 License.
Copyright (C) 2025 University of Pennsylvania
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ltrim-0.1.1.tar.gz.
File metadata
- Download URL: ltrim-0.1.1.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65e58ab4f37155de5a82e46b03d59e2f287323507d19959e060b6319f6e59ac7
|
|
| MD5 |
4e262142643b2b6b18a0367586d60516
|
|
| BLAKE2b-256 |
35599aca3d37cb50ad0e7873005f36fffd31ad96426d4892bcccb81b5c6a2d93
|
File details
Details for the file ltrim-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ltrim-0.1.1-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69d0e3804f650dcace717a7527c578ccd5def278aed676e1a8d2f37e937e8c15
|
|
| MD5 |
0bbe4a7bfdc8694d3489c6d9c252e784
|
|
| BLAKE2b-256 |
8d44d5631a42229c2b722af2cb54c537d64b5e75a74be67515c77a1019ecb89e
|