Python library to perform code execution in fully isolated environments
Project description
pascua
Description
Python library to perform code execution in fully isolated environments.
IMPORTANT: This repository is in the early stage of development, so its not recommended to be used yet. Nevertheless, contributions are welcome!
Installation
You can install the latest pascua
version via pip
:
pip install pascua
Usage
Python Environment
import pascua as psc
context = {
'size': 100,
}
source_code = [
'import numpy as np',
'random_numbers = np.random.uniform(size=size)',
]
env = psc.PythonEnvironment(
version='3.7.3',
dependencies=[
'numpy>=1.14.0',
]
)
result = env.exec(source_code, context)
R Environment
import pascua as psc
context = {
'size': 100,
}
source_code = [
'random_numbers <- runif(n = size)',
]
env = psc.REnvironment(
version='latest',
)
result = env.exec(source_code, context)
C++ Environment
import pascua as psc
context = {
'size': 100,
}
source_code = [
'float r;',
'vector<float> random_numbers;',
'for (int i = 0; i < size; i++) {',
' r = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);',
' random_numbers.push_back(r);',
'}',
]
env = psc.CCEnvironment(
version='latest',
includes=[
'vector',
'numeric',
]
)
result = env.exec(source_code, context)
Development
You can install it simply typing:
python setup.py install
To run the tests perform:
python -m unittest discover tests
License
- This project is licensed under MIT license.
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
pascua-0.0.1.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file pascua-0.0.1.tar.gz
.
File metadata
- Download URL: pascua-0.0.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a058a597916139391262f3af8a6bd95b60a68f7361116fec510c2ffee13d3c5 |
|
MD5 | e4261480df113ee9b5b1aa078ff70659 |
|
BLAKE2b-256 | d7e5a4f5648a25c8cf49d5ba5ea09233a97b182b43fe5b1369b9732582acbbaf |
File details
Details for the file pascua-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pascua-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fc5cf5ac25fbe7c9f475f1d6a8d577ab4aaaf8a5869b64f077ce355ab69d389 |
|
MD5 | f87d4549a79d76589a9b72280f300837 |
|
BLAKE2b-256 | 055a4837245f2cfcc0cedcac3589453333b0909aae549133c25f117235452310 |