Skip to content

Commit

Permalink
Add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Sep 10, 2024
1 parent 1e35c56 commit f801eaa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Create a new conda environment - in this example a conda environment for Python
conda create -n py312 python=3.12
```

### Subprocess Interface
Open a python shell in your base environment where `conda_subprocess` is installed and execute `python --version` in the
`py312` environment:
```python
Expand Down Expand Up @@ -64,6 +65,20 @@ process.communicate()
>>> (b'Python 3.12.1\n', None)
```

### Decorator
In analogy to the subprocess interface the `conda_subprocess` also introduces the `@conda` decorator to
execute python functions in a separate conda environment:
```python
from conda_subprocess.decorator import conda

@conda(prefix_name="py312")
def add_function(parameter_1, parameter_2):
return parameter_1 + parameter_2

add_function(parameter_1=1, parameter_2=2)
>>> 3
```

## Remarks
* The `shell` parameter and the `env` parameter are not supported in `Popen()` and all derived methods.
* The `pipesize` parameter and the `process_group` parameter were removed for compatibility with python 3.9.

0 comments on commit f801eaa

Please sign in to comment.