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 transitioning docs for poetry and conda #1624

Merged
merged 9 commits into from
Jul 17, 2024

Conversation

ruben-arts
Copy link
Contributor

This is a starting point to start adding more beginner friendly documentation.

Disclaimer, I've not used conda mamba poetry more then just for examples. The deeper details are not known to me. So any improvements are welcome, that said this should merge fast and incrementally improve overtime.

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I have never used poetry so I wasn't able to review much there.

docs/switching_from/poetry.md Outdated Show resolved Hide resolved
docs/switching_from/poetry.md Outdated Show resolved Hide resolved
| Creating an Environment | `poetry new myenv` | `pixi init myenv` |
| Running a Task | `poetry run which python` | `pixi run which python` `pixi` uses a build-in cross platform shell for run where poetry uses your shell. |
| Installing a Package | `poetry add numpy` | `pixi add numpy` adds the conda variant. `pixi add --pypi numpy` adds the PyPI variant of the package. |
| Uninstalling a Package | `poetry remove numpy` | `pixi remove numpy` |
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a PyPI version for pixi remove? If yes, maybe mention it as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep added it, thanks.

Make sure that `python` is only defined in the `tool.pixi.dependencies` and not in the `tool.pixi.pypi-dependencies`.

!!! Danger
It's possible to use `poetry` in `pixi` environments but this is advised against.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe specify the risk. Is it only more maintenance, or is there more to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried to add more information.

pixi.toml Outdated Show resolved Hide resolved
@ruben-arts ruben-arts changed the title Docs/add transitioning docs docs: add transitioning docs for poetry and conda Jul 17, 2024
ruben-arts and others added 4 commits July 17, 2024 11:57
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
ruben-arts and others added 3 commits July 17, 2024 14:10
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
Co-authored-by: Hofer-Julian <30049909+Hofer-Julian@users.noreply.github.com>
@ruben-arts ruben-arts enabled auto-merge (squash) July 17, 2024 14:18
Copy link
Contributor

@abkfenris abkfenris left a comment

Choose a reason for hiding this comment

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

Some thoughts on coming from Conda. I think it might be worth thinking a bit about steering folks towards Pixi's happy path, vs the more advanced compatibility features for docs about transitioning.


## Why Pixi?

`Pixi` builds upon the foundation of the conda ecosystem, introducing a project-centric approach rather than focusing solely on environments.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`Pixi` builds upon the foundation of the conda ecosystem, introducing a project-centric approach rather than focusing solely on environments.
`Pixi` builds upon the foundation of the conda ecosystem, introducing a project-centric approach rather than focusing solely on named global environments.

## Why Pixi?

`Pixi` builds upon the foundation of the conda ecosystem, introducing a project-centric approach rather than focusing solely on environments.
This shift towards projects offers a more organized and efficient way to manage dependencies and run code, tailored to modern development practices.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe specify that the dependency management is automated rather than manual?

Suggested change
This shift towards projects offers a more organized and efficient way to manage dependencies and run code, tailored to modern development practices.
This shift towards projects offers a more automated, organized, and efficient way to manage dependencies and run code, tailored to modern development practices.

!!! warn "No `base` environment"
Conda has a base environment, which is the default environment when you start a new shell.
**Pixi does not have a base environment**. And requires you to install the tools you need in the project or globally.
Using `pixi global install bat` will install `bat` in a global environment, which is not the same as the `base` environment in conda.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Using `pixi global install bat` will install `bat` in a global environment, which is not the same as the `base` environment in conda.
Using `pixi global install bat` will install `bat` in an isolated global environment (similar to pipx), which is not the same as the `base` environment in conda.

Comment on lines +28 to +32
??? tip "Activating pixi environment in the current shell"
For some advanced use-cases, you can activate the environment in the current shell.
This uses the `pixi shell-hook` which prints the activation script, which can be used to activate the environment in the current shell without `pixi` itself.
```shell
~/myenv > eval "$(pixi shell-hook)"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd emphasize pixi shell, possibly with it's own section over using shell-hook.

It would also be worth showing how --manifest-path can be used to point to activate a shell from a different directory.

In `pixi`, a project is a folder containing a [manifest](../reference/project_configuration.md)(`pixi.toml`/`pyproject.toml`) file that describes the project, a `pixi.lock` lock-file that describes the exact dependencies, and a `.pixi` folder that contains the environment.

This project-centric approach allows for easy sharing and collaboration, as the project folder contains all the necessary information to recreate the environment.
It manages more than one environment for more than one platform in a single project, and allows for easy switching between them. (See [multiple environments](../features/multi_environment.md))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a callout on how Pixi can lock for multiple platforms to help enable collaboration to highlight Pixi's additional abilities?

Using that `pip` binary will install packages in the `pip` environment, making it unreachable form anywhere as you can't activate it.


## Automated switching
Copy link
Contributor

Choose a reason for hiding this comment

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

Automated switching feels like it describes Pixi using the right task environment over moving from environment.yml.

Suggested change
## Automated switching
## Migrating from environment.yml

Comment on lines +44 to +50
When this is important to you for filesystem reasons, you can use the [detached-environments](../reference/pixi_configuration.md#detached-environments) feature of pixi.
```shell
pixi config set detached-environments true
# or a specific location
pixi config set detached-environments /path/to/envs
```
This doesn't allow you to activate the environments using `pixi shell -n` but it will make the installation of the environments go to the same folder.
Copy link
Contributor

Choose a reason for hiding this comment

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

I might move this to troubleshooting, as having it here makes it sound more like a suggestion on the best way for a Conda user to use Pixi.

@ruben-arts ruben-arts merged commit 5f490f2 into prefix-dev:main Jul 17, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants