File tree Expand file tree Collapse file tree 2 files changed +33
-23
lines changed Expand file tree Collapse file tree 2 files changed +33
-23
lines changed Original file line number Diff line number Diff line change @@ -655,29 +655,6 @@ poetry run my-script
655
655
656
656
Note that this command has no option.
657
657
658
- ## shell
659
-
660
- The shell command spawns a shell within the project's virtual environment.
661
-
662
- By default, the current active shell is detected and used. Failing that,
663
- the shell defined via the environment variable ` SHELL ` (on * nix) or
664
- ` COMSPEC ` (on Windows) is used.
665
-
666
- If a virtual environment does not exist, it will be created.
667
-
668
- ``` bash
669
- poetry shell
670
- ```
671
-
672
- Note that this command starts a new shell and activates the virtual environment.
673
-
674
- As such, ` exit ` should be used to properly exit the shell and the virtual environment instead of ` deactivate ` .
675
-
676
- {{% note %}}
677
- Poetry internally uses the [ Shellingham] ( https://github.com/sarugaku/shellingham ) project to detect current
678
- active shell.
679
- {{% /note %}}
680
-
681
658
## check
682
659
683
660
The ` check ` command validates the content of the ` pyproject.toml ` file
Original file line number Diff line number Diff line change @@ -76,6 +76,39 @@ special `system` Python version to retrieve the default behavior:
76
76
poetry env use system
77
77
```
78
78
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
+ {{< /tab >}}
97
+ {{< tab tabID="fish" >}}
98
+
99
+ ```bash
100
+ $ eval (poetry env activate)
101
+ ```
102
+ {{< /tab >}}
103
+ {{< tab tabID="powershell" >}}
104
+
105
+ ```ps1
106
+ PS1> Invoke-Expression (poetry env activate)
107
+ ```
108
+
109
+ {{< /tab >}}
110
+ {{< /tabs >}}
111
+
79
112
## Displaying the environment information
80
113
81
114
If you want to get basic information about the currently activated virtual environment,
You can’t perform that action at this time.
0 commit comments