An open API service indexing awesome lists of open source software.

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

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
```