Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus committed Oct 14, 2024
1 parent bfaa2b3 commit 47570c0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 23 deletions.
23 changes: 0 additions & 23 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,29 +648,6 @@ poetry run my-script

Note that this command has no option.

## shell

The shell command spawns a shell within the project's virtual environment.

By default, the current active shell is detected and used. Failing that,
the shell defined via the environment variable `SHELL` (on *nix) or
`COMSPEC` (on Windows) is used.

If a virtual environment does not exist, it will be created.

```bash
poetry shell
```

Note that this command starts a new shell and activates the virtual environment.

As such, `exit` should be used to properly exit the shell and the virtual environment instead of `deactivate`.

{{% note %}}
Poetry internally uses the [Shellingham](https://github.com/sarugaku/shellingham) project to detect current
active shell.
{{% /note %}}

## check

The `check` command validates the content of the `pyproject.toml` file
Expand Down
33 changes: 33 additions & 0 deletions docs/managing-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,39 @@ special `system` Python version to retrieve the default behavior:
poetry env use system
```

## Activating the environment

`poetry env activate` command prints the activate command to the console. This way you won't leave the current shell.
You can then feed the output to `eval` to activate the environment. This way is the closest to manually activating the environment.

{{% note %}}
Looking for `poetry shell`? It was moved to a plugin: [`poetry-plugin-shell`](https://github.com/python-poetry/poetry-plugin-shell)
{{% /note %}}

{{< tabs tabTotal="3" tabID1="bash-csh-zsh" tabID2="fish" tabID3="powershell" tabName1="Bash/Zsh/Csh" tabName2="Fish" tabName3="Powershell" }}

{{< tab tabID="bash-csh-zsh" >}}

```bash
$ eval $(poetry env activate)
(test-project-for-test) $ # Virtualenv entered
```
{{< /tab >}}
{{< tab tabID="fish" >}}

```bash
$ eval (poetry env activate)
```
{{< /tab >}}
{{< tab tabID="powershell" >}}

```ps1
PS1> Invoke-Expression (poetry env activate)
```

{{< /tab >}}
{{< /tabs >}}

## Displaying the environment information

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

0 comments on commit 47570c0

Please sign in to comment.