From 8b2e27746d1376123146b0b4946ba6570b0595be Mon Sep 17 00:00:00 2001 From: James Owers-Bardsley Date: Tue, 5 Dec 2023 17:41:43 +0000 Subject: [PATCH 1/2] Update basic-usage.md Add note to help resolve confusion around `poetry run` and external env management. --- docs/basic-usage.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/basic-usage.md b/docs/basic-usage.md index dd872f4a1c5..7e00f48bfec 100644 --- a/docs/basic-usage.md +++ b/docs/basic-usage.md @@ -125,6 +125,19 @@ any Poetry commands that expect to manipulate an environment. ### Using `poetry run` +{{% note %}} +If managing your own virtual environment externally, you do not need to use `poetry run` or `poetry shell` since +you will, presumably, already have activated that virtual environment and made available the correct python instance. +For example, these commands should output the same python path: +```shell +conda activate your_env_name +which python +poetry run which python +poetry shell +which python +``` +{{% /note %}} + To run your script simply use `poetry run python your_script.py`. Likewise if you have command line tools such as `pytest` or `black` you can run them using `poetry run pytest`. From 4f404f61879c71fc9eb9c0db68e12ef2e2993eb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Fri, 5 Jan 2024 18:03:29 +0100 Subject: [PATCH 2/2] Put note at the end --- docs/basic-usage.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/basic-usage.md b/docs/basic-usage.md index 7e00f48bfec..b9c0a0d7c41 100644 --- a/docs/basic-usage.md +++ b/docs/basic-usage.md @@ -125,6 +125,9 @@ any Poetry commands that expect to manipulate an environment. ### Using `poetry run` +To run your script simply use `poetry run python your_script.py`. +Likewise if you have command line tools such as `pytest` or `black` you can run them using `poetry run pytest`. + {{% note %}} If managing your own virtual environment externally, you do not need to use `poetry run` or `poetry shell` since you will, presumably, already have activated that virtual environment and made available the correct python instance. @@ -138,9 +141,6 @@ which python ``` {{% /note %}} -To run your script simply use `poetry run python your_script.py`. -Likewise if you have command line tools such as `pytest` or `black` you can run them using `poetry run pytest`. - ### Activating the virtual environment The easiest way to activate the virtual environment is to create a nested shell with `poetry shell`.