Skip to content

Commit 5948488

Browse files
committed
Add docs
1 parent d7694ed commit 5948488

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

docs/cli.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -655,29 +655,6 @@ poetry run my-script
655655

656656
Note that this command has no option.
657657

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-
681658
## check
682659

683660
The `check` command validates the content of the `pyproject.toml` file

docs/managing-environments.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,39 @@ special `system` Python version to retrieve the default behavior:
7676
poetry 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+
{{< /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+
79112
## Displaying the environment information
80113

81114
If you want to get basic information about the currently activated virtual environment,

0 commit comments

Comments
 (0)