Skip to content

Commit 4b7f072

Browse files
committed
Add named workspaces notes for conda users
1 parent 170db82 commit 4b7f072

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

docs/switching_from/conda.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This shift towards workspaces offers a more organized and efficient way to manag
1313
|-----------------------------|---------------------------------------------------|---------------------------------------------------------------------------|
1414
| Installation | Requires an installer | Download and add to path (See [installation](../index.md)) |
1515
| Creating an Environment | `conda create -n myenv -c conda-forge python=3.8` | `pixi init myenv` followed by `pixi add python=3.8` |
16-
| Activating an Environment | `conda activate myenv` | `pixi shell` within the workspace directory |
16+
| Activating an Environment | `conda activate myenv` | `pixi shell` within the workspace directory, or `pixi shell -w myenv` |
1717
| Deactivating an Environment | `conda deactivate` | `exit` from the `pixi shell` |
1818
| Running a Task | `conda run -n myenv python my_program.py` | `pixi run python my_program.py` (See [run](../reference/cli/pixi/run.md)) |
1919
| Installing a Package | `conda install numpy` | `pixi add numpy` |
@@ -67,6 +67,38 @@ bat pixi.toml
6767
Installing `pip` with `pixi global` will create a new isolated environment with its own `pip` binary.
6868
Using that `pip` binary will install packages in the `pip` environment, making it unreachable from anywhere as you can't activate it.
6969

70+
## Named workspaces
71+
72+
`conda` provides the ability to perform actions on an environment by name or path to a prefix. For example,
73+
74+
```shell
75+
# installs package into an environment named `myenv`
76+
conda install --name myenv numpy
77+
# installs a package into an environment that is located at `{_CONDA_ROOT}/envs/myenv`
78+
conda install --prefix {_CONDA_ROOT}/envs/myenv numpy
79+
```
80+
81+
`pixi` provides a similar functionality. You may register a named workspace using the `pixi workspace register` command.
82+
83+
```shell
84+
pixi workspace register --name myproject --path /path/to/myproject
85+
```
86+
87+
??? tip "Creating a new named workspace"
88+
Registering a workspace in pixi is currently a two step process. First you must create a workspace, for example using the `pixi init` command. Then, you may add it to the workspace registry with the `pixi workspace register` command. This is in contrast to conda, which allows creating a new named environment, for example using the command `conda create --name myenv`.
89+
90+
Then, you may use the named workspace similar to how `conda` works
91+
92+
```shell
93+
# adds a package into a workspace that has been registered with name `myproject`
94+
pixi add numpy --workspace myproject
95+
# adds a package into a workspace at the location `/path/to/myproject`
96+
pixi add numpy --manifest-path /path/to/myproject
97+
```
98+
99+
??? tip "Use `pixi workspace register prune` to clean up disassociated workspaces"
100+
Your named workspace will be disassociated if you move the workspace path. To list all existing associations try running `pixi workspace register list`. To remove disassociated paths try running `pixi workspace register prune`.
101+
70102

71103
## Automated switching
72104

0 commit comments

Comments
 (0)