From f801eaaee7b8f7e16d809b3c11716b5609934fc6 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 10 Sep 2024 09:26:09 +0200 Subject: [PATCH] Add README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index cc42f19..d04ea6f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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.