Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add reference documentation for the exec command #1587

Merged
merged 6 commits into from
Jul 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,40 @@ pixi run --clean-env "echo \$PATH"
pixi run start
```

## `exec`

Runs a command in a temporary environment disconnected from any project.
This can be useful to quickly test out a certain package or version.

Temporary environments are cached. If the same command is run again, the same environment will be reused.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to find this cache, e.g. for cleaning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some information about where to find the environments and that they should be deleted manually.


??? note "Cleaning temporary environments"
Currently, temporary environments can only be cleaned up manually.
Environments for `pixi exec` are stored under `cached-envs-v0/` in the cache directory.
Run `pixi info` to find the cache directory.

##### Arguments

1. `<COMMAND>`: The command to run.

#### Options:
* `--spec <SPECS> (-s)`: Matchspecs of packages to install. If this is not provided, the package is guessed from the command.
* `--channel <CHANNELS> (-c)`: The channel to install the packages from. If not specified the default channel is used.
* `--force-reinstall` If specified a new environment is always created even if one already exists.

```shell
pixi exec python

# Add a constraint to the python version
pixi exec -s python=3.9 python

# Run ipython and include the py-rattler package in the environment
pixi exec -s ipython -s py-rattler ipython

# Force reinstall to recreate the environment and get the latest package versions
pixi exec --force-reinstall -s ipython -s py-rattler ipython
```

## `remove`

Removes dependencies from the [manifest file](project_configuration.md).
Expand Down