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: copy from cms #355

Merged
merged 2 commits into from
Sep 26, 2023
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
89 changes: 89 additions & 0 deletions docs/basic_usage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
part: pixi
title: Basic usage
description: Taking your first steps with pixi
---

Make sure that you have `pixi` installed, this should print the help function, check the [installation manual](overview) if it doesn't.

```shell
pixi
```

Initialize a new project and navigate to the project directory.

```shell
pixi init pixi-hello-world
cd pixi-hello-world
```

Add the dependencies you would like to use.

```shell
pixi add python
```

Create a file named `hello_world.py` in the directory and paste the following code into the file.

```python title="hello_world.py" showLineNumbers
def hello():
print("Hello World, to the new revolution in package management.")

if __name__ == "__main__":
hello()
```

Run the code inside the environment.

```shell
pixi run python hello_world.py
```

You can also put this run command in a **task**.

```shell
pixi task add hello python hello_world.py
```

After adding the task, you can run the task using its name.

```shell
pixi run hello
```

Use the `shell` command to activate the environment and start a new shell in there.

```shell
pixi shell
python
exit
```

You've just learned the basic features of pixi:
1. adding a dependency.
2. adding a task, and executing it.
3. running a program.
Feel free to play around with what you just learned like adding more tasks, dependencies or code.
If you want to learn more checkout out our [in-depth documentation](./advanced)

Happy coding!

## Use pixi as an installation tool

Use pixi to install tools on your machine.

Some notable examples:

```shell
# Awesome cross shell prompt, huge tip when using pixi!
pixi global install starship

# Want to try a different shell?
pixi global install fish

# Install other prefix.dev tools
pixi global install rattler-build

# Install a linter you want to use in multiple projects.
pixi global install ruff
```
60 changes: 52 additions & 8 deletions docs/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,11 @@ pixi run --manifest-path ~/myproject/pixi.toml python
pixi run build
```

> **Note:** In `pixi` the [`deno_task_shell`](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) is the underlying runner of the run command.
> Checkout their [documentation](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) for the syntax and available commands.
> This is done so that the run commands can be run across all platforms.
:::info
In `pixi` the [`deno_task_shell`](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) is the underlying runner of the run command.
Checkout their [documentation](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) for the syntax and available commands.
This is done so that the run commands can be run across all platforms.
:::

## `task`

Expand Down Expand Up @@ -142,9 +144,11 @@ cow = "cowpy \"Hello User\""
moo = { depends_on = ["cow"] }
```

> **Note:** In `pixi` the [`deno_task_shell`](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) is the underlying runner of the tasks.
> Checkout their [documentation](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) for the syntax and available commands.
> This is done so that the tasks defined can be run across all platforms.
:::info
In `pixi` the [`deno_task_shell`](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) is the underlying runner of the tasks.
Checkout their [documentation](https://deno.land/manual@v1.35.0/tools/task_runner#task-runner) for the syntax and available commands.
This is done so that the tasks defined can be run across all platforms.
:::

## `shell`

Expand Down Expand Up @@ -194,7 +198,9 @@ This command is used to authenticate the user's access to remote hosts such as `

Store authentication information for given host.

> **Note:** The host is real hostname not a channel.
:::tip
The host is real hostname not a channel.
:::

#### Options

Expand All @@ -221,7 +227,12 @@ pixi auth logout repo.prefix.dev
pixi auth logout anaconda.org
```

## `global install`
## `global`

Global is the main entry point for the part of pixi that executes on the
global(system) level.

### `global install`

This command installs a package into its own environment and adds the binary to `PATH`, allowing you to access it anywhere on your system without activating the environment.

Expand All @@ -245,6 +256,39 @@ pixi global install python=3.11.0=h10a6764_1_cpython

After using global install, you can use the package you installed anywhere on your system.

### `global info`

This command shows the current installed global environments including what binaries come with it.
A global installed package/environment can possibly contain multiple binaries.
Here is an example of a few installed packages:
```
> pixi global info
Globally installed binary packages:
- [package] starship
- [bin] starship
- [package] pre-commit
- [bin] pre-commit
- [package] grayskull
- [bin] grayskull
- [bin] greyskull
- [bin] conda-grayskull
- [bin] conda-greyskull
- [package] zsh
- [bin] zsh
- [bin] zsh-5
```

### `global remove`

Removes a package previously installed into a globally accessible location via
`pixi global install`

Use `pixi global info` to find out what the package name is that belongs to the tool you want to remove.

```
pixi global remove pre-commit
```

## `project`

This subcommand allows you to modify the project configuration through the command line interface.
Expand Down
Loading