exec wrapper run API
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Once a gcc cell is defined, it should be nice to have a wrapper for the generated code.
Expected API:
```
%%gcc foo.c
#include
int main(int argc, char ** argv) {
for (int i = 0; i < argc; i++) {
printf("%d: %s\n", i, argv[i]);
}
return 0;
}
```
Once this cell is run, the executable should be built and wrapped in a Python `foo` object.
This object will have a `run` method that accepts `*args` and `**kwargs`:
- Uppercase kwargs are treated as enviroment variables
- Lowercase casted to string are passed as arguments.
``` python
foo.run('1', 'b', 'c', PATH="/bin")
```
It would be nice to have the env before the args, so this should be equivalent to:
``` python
foo.env(PATH="/bin").run('a', 'b', 'c')
```
Envieroment variables and arguments that receive iterators should execute many times.
**IDEA** Maybe run could be a lazy object that is evaluated within first display...
``` python
foo.env(A=1).run(range(1, 100)).time()
# Maybe too crazy
foo.env(OMP_NUM_THREADS=range(1, 4).run().time()
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.