File tree Expand file tree Collapse file tree 2 files changed +35
-23
lines changed
Expand file tree Collapse file tree 2 files changed +35
-23
lines changed Original file line number Diff line number Diff line change @@ -648,29 +648,6 @@ poetry run my-script
648648
649649Note that this command has no option.
650650
651- ## shell
652-
653- The shell command spawns a shell within the project's virtual environment.
654-
655- By default, the current active shell is detected and used. Failing that,
656- the shell defined via the environment variable ` SHELL ` (on * nix) or
657- ` COMSPEC ` (on Windows) is used.
658-
659- If a virtual environment does not exist, it will be created.
660-
661- ``` bash
662- poetry shell
663- ```
664-
665- Note that this command starts a new shell and activates the virtual environment.
666-
667- As such, ` exit ` should be used to properly exit the shell and the virtual environment instead of ` deactivate ` .
668-
669- {{% note %}}
670- Poetry internally uses the [ Shellingham] ( https://github.com/sarugaku/shellingham ) project to detect current
671- active shell.
672- {{% /note %}}
673-
674651## check
675652
676653The ` check ` command validates the content of the ` pyproject.toml ` file
Original file line number Diff line number Diff line change @@ -76,6 +76,41 @@ special `system` Python version to retrieve the default behavior:
7676poetry env use system
7777```
7878
79+ ## Activating the environment
80+
81+ ` poetry env activate ` command prints the activate command to the console. This way you won't leave the current shell.
82+ You can then feed the output to ` eval ` to activate the environment. This way is the closest to manually activating the environment.
83+
84+ {{% note %}}
85+ Looking for ` poetry shell ` ? It was moved to a plugin: [ ` poetry-plugin-shell ` ] ( https://github.com/python-poetry/poetry-plugin-shell )
86+ {{% /note %}}
87+
88+ {{< tabs tabTotal="3" tabID1="bash-csh-zsh" tabID2="fish" tabID3="powershell" tabName1="Bash/Zsh/Csh" tabName2="Fish" tabName3="Powershell" >}}
89+
90+ {{< tab tabID="bash-csh-zsh" >}}
91+
92+ ``` bash
93+ $ eval $( poetry env activate)
94+ (test-project-for-test) $ # Virtualenv entered
95+ ```
96+
97+ {{< /tab >}}
98+ {{< tab tabID="fish" >}}
99+
100+ ``` bash
101+ $ eval (poetry env activate)
102+ ```
103+
104+ {{< /tab >}}
105+ {{< tab tabID="powershell" >}}
106+
107+ ``` ps1
108+ PS1> Invoke-Expression (poetry env activate)
109+ ```
110+
111+ {{< /tab >}}
112+ {{< /tabs >}}
113+
79114## Displaying the environment information
80115
81116If you want to get basic information about the currently activated virtual environment,
You can’t perform that action at this time.
0 commit comments