Skip to content
Merged
Show file tree
Hide file tree
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
Binary file added docs/assets/vscode-python-env-selector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/zed-python-env-selector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

## Pycharm

<!-- Keep in sync with https://github.com/pavelzw/pixi-pycharm/blob/main/README.md -->

You can use PyCharm with Pixi environments by using the `conda` shim provided by the [pixi-pycharm](https://github.com/pavelzw/pixi-pycharm) package.

## How to use

To get started, add `pixi-pycharm` to your Pixi workspace.

```bash
Expand Down Expand Up @@ -85,13 +86,13 @@ It also might come up that you have multiple environments with the same name.

It is recommended to rename the environments to something unique.

## Debugging
### Debugging

Logs are written to `~/.cache/pixi-pycharm.log`.
You can use them to debug problems.
Please attach the logs when [filing a bug report](https://github.com/pavelzw/pixi-pycharm/issues/new?template=bug-report.md).

## Install as an optional dependency
### Install as an optional dependency

In some cases, you might only want to install `pixi-pycharm` on your local dev-machines but not in production.
To achieve this, we can use [multiple environments](../../workspace/multi_environment.md).
Expand Down Expand Up @@ -129,3 +130,9 @@ lint = { features = ["lint"], no-default-feature = true }

Now you as a user can run `pixi shell`, which will start the default environment.
In production, you then just run `pixi run -e prod COMMAND`, and the minimal prod environment is installed.

## Direnv

In order to use Direnv with [Jetbrains](https://www.jetbrains.com/ides/) products you first have to install the [Direnv plugin](https://plugins.jetbrains.com/plugin/15285-direnv-integration).
Then follow the instructions in our [Direnv doc page](../third_party/direnv.md).
Now your Jetbrains IDE will be run within the selected Pixi environment.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The Python extension also has proper pixi support, we should mention that IMO

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You mean this https://code.visualstudio.com/docs/python/python-quick-start extension, correct?
I do not see an explicit mention of pixi.
I suppose it is something similar to conda?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes it's this extension. maybe add an image guide on how to do it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, If we have a proper vscode section, the Python extension should be mentioned as well 🙂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not entirely sure how to use the python extension with pixi.
I saw that there is some effort to make a pixi conda but I do not think that is the way to go.
I am looking for a way to use conda run ... as that should be translatable to pixi run ....
But, I am not finding that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suppose trampolines could be used as the target of
image
but, trampolines are not provided as part of project workspaces.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I suppose it comes down to the settings.yml for the python plugin:

https://code.visualstudio.com/docs/python/settings-reference

It is not obvious to me how this should be configured.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It should no configuration.

I just created a fresh Pixi workspace with Python, started vscode in it and vscode immediately selected the pixi environment. Maybe @baszalmstra can check if something is broken on Windows at the moment?

Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
[Visual Studio Code](https://code.visualstudio.com/) is a popular editor that can be extended to support most programming languages by installing the suitable extension.

## Python Extension

First, install the Python extension from the [marketplace](https://marketplace.visualstudio.com/items?itemName=ms-python.python).
Typically, the extension will detect and select the Pixi default environment automatically as soon as you open a Python file.
In case it doesn't or you want to select a different environment, you can open the environment selector to select the environment of your choice.

![VSCode Python Environment Selector](../../assets/vscode-python-env-selector.png)

## Direnv Extension

Direnv provides a language agnostic way of running VSCode in a Pixi environment.
First, install the Direnv extension from the [marketplace](https://marketplace.visualstudio.com/items?itemName=mkhl.direnv).
Then follow the instructions in our [Direnv doc page](../third_party/direnv.md).


## Devcontainer Extension

[VSCode Devcontainers](https://code.visualstudio.com/docs/devcontainers/containers) are a popular tool to develop on a workspace with a consistent environment.
They are also used in [GitHub Codespaces](https://github.com/environments/codespaces) which makes it a great way to develop on a workspace without having to install anything on your local machine.

Expand Down
15 changes: 15 additions & 0 deletions docs/integration/editor/zed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Zed](https://zed.dev/) is a code editor that provides support for many languages out of the box.
By installing extensions more languages can be supported.


## Python

Zed supports Pixi and Python out of the box.
If Zed hasn't done so already, select a suitable Pixi environment in the environment selector and you are good to go!

![Zed Python Environment Selector](../../assets/zed-python-env-selector.png)

## Direnv

Zed supports Direnv out of the box.
Set up Direnv with Pixi as described in our [Direnv page](../third_party/direnv.md) and Zed will activate the environment automatically.
27 changes: 17 additions & 10 deletions docs/integration/third_party/direnv.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@

??? note "Installing direnv"
`direnv` is a tool which automatically activates an environment as soon as you enter a directory with a `.envrc` file that you accepted at some point.
This tutorial will demonstrate how to use `direnv` with Pixi`.

Of course you can use `pixi` to install `direnv` globally. We recommend to run
First install `direnv` by running the following command:

```bash
pixi global install direnv
```

to install the latest version of `direnv` on your computer.
```bash
pixi global install direnv
```

You can use `pixi` in combination with `direnv` to automatically activate environments on entering the corresponding directory.
Enter the following into your `.envrc` file:
Then create a `.envrc` file in your Pixi workspace root with the following content:

```shell title=".envrc"
watch_file pixi.lock # (1)!
eval "$(pixi shell-hook)" # (2)!
```

1. This ensures that every time your `pixi.lock` changes, `direnv` invokes the shell-hook again.
2. This installs if needed, and activates the environment. `direnv` ensures that the environment is deactivated when you leave the directory.
2. This installs the environment if needed, and activates it. `direnv` ensures that the environment is deactivated when you leave the directory.

```shell
$ cd my-project
Expand All @@ -34,3 +32,12 @@ direnv: unloading
$ which python
python not found
```

While `direnv` comes with [hooks for the common shells](https://direnv.net/docs/hook.html),
these hooks into the shell should not be relied on when using and IDE.

Here you can see how to set up `direnv` for your favorite editor:

- [VSCode](../editor/vscode.md#direnv-extension)
- [Jetbrains](../editor/jetbrains.md#direnv)
- [Zed](../editor/zed.md)
15 changes: 9 additions & 6 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ nav:
- Examples: global_tools/examples.md
- Integration:
- Editor:
- JupyterLab: integration/editor/jupyterlab.md
- PyCharm: integration/editor/pycharm.md
- VSCode: integration/editor/vscode.md
- Jetbrains: integration/editor/jetbrains.md
- Zed: integration/editor/zed.md
- RStudio: integration/editor/r_studio.md
- VSCode Devcontainer: integration/editor/devcontainer.md
- JupyterLab: integration/editor/jupyterlab.md
- Continuous Integration:
- GitHub Actions: integration/ci/github_actions.md
- Lockfile Updates: integration/ci/updates_github_actions.md
- Third Party:
- Direnv: integration/third_party/direnv.md
- Pixi Diff: integration/third_party/pixi_diff.md
- Direnv: integration/third_party/direnv.md
- Starship: integration/third_party/starship.md
- Switching from:
- Poetry: switching_from/poetry.md
Expand Down Expand Up @@ -199,9 +200,9 @@ plugins:
"features/global_tools.md": "global_tools/introduction.md"
"features/pytorch.md": "python/pytorch.md"
"ide_integration/jupyterlab.md": "integration/editor/jupyterlab.md"
"ide_integration/pycharm.md": "integration/editor/pycharm.md"
"ide_integration/pycharm.md": "integration/editor/jetbrains.md"
"ide_integration/r_studio.md": "integration/editor/r_studio.md"
"ide_integration/devcontainer.md": "integration/editor/devcontainer.md"
"ide_integration/devcontainer.md": "integration/editor/vscode.md"
"advanced/authentication.md": "deployment/authentication.md"
"advanced/channel_priority.md": "advanced/channel_logic.md"
"advanced/github_actions.md": "integration/ci/github_actions.md"
Expand All @@ -216,6 +217,8 @@ plugins:
"packaging.md": "misc/packaging.md"
"Community.md": "misc/Community.md"
"FAQ.md": "misc/FAQ.md"
"integration/editor/devcontainer.md": "integration/editor/vscode.md"
"integration/editor/pycharm.md": "integration/editor/jetbrains.md"

- search
- social
Expand Down
Loading