https://github.com/fortierq/flimit
Limit time and memory usage from a Python function
https://github.com/fortierq/flimit
function limit memory python time
Last synced: 5 months ago
JSON representation
Limit time and memory usage from a Python function
- Host: GitHub
- URL: https://github.com/fortierq/flimit
- Owner: fortierq
- Created: 2021-08-24T18:44:23.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-16T20:37:26.000Z (about 4 years ago)
- Last Synced: 2025-09-28T00:01:50.692Z (9 months ago)
- Topics: function, limit, memory, python, time
- Language: Python
- Homepage: https://pypi.org/project/flimit/
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Limit time and memory usage of a Python function
## Installation
```
pip install flimit
```
## Usage
```python
from flimit.memory import limit_memory
from flimit.time import limit_time
@limit_memory(10**9) # octets
@limit_time(60) # seconds
def f(...): # f will have a limit of 1 Go allocation memory and 60 seconds computation time
...
```
## Tests
```
python -m pytest tests
```