Skip to content

Commit

Permalink
add wolf's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Mar 13, 2024
1 parent af440ca commit 4ba7f25
Showing 1 changed file with 31 additions and 66 deletions.
97 changes: 31 additions & 66 deletions docs/design_proposals/channel_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ default_url = "https://my.custom.mirror/{channel}"

[[channels]]
name = "conda-forge"
url = [
mirrors = [
"https://conda.anaconda.org/conda-forge",
"https://repo.prefix.dev/conda-forge"
]

[[channels]]
name = "prefix-internal"
url = "https://repo.prefix.dev/prefix-internal"
server = "https://repo.prefix.dev"

[[channels]]
name = "bioconda"
url = "https://repo.prefix.dev/bioconda"
mirrors = ["https://repo.prefix.dev/bioconda"]
```

!!!note "Configure in `pixi.toml`"
Expand All @@ -50,40 +50,20 @@ url = "https://repo.prefix.dev/bioconda"
If you want to use the same mirror for all channels, you can set the `default_url` key in the configuration file.

```toml title="rattler.toml"
default_url = "https://my.custom.mirror/{channel}"

[[channels]]
name = "bioconda"
url = "https://repo.prefix.dev/bioconda"
default_server = "https://my.custom.mirror"
```

This results in all channels being redirected to this mirror.

```toml title="pixi.toml"
...
channels = [
"conda-forge",
"bioconda",
"https://conda.anaconda.org/cf-staging",
"https://repo.prefix.dev/prefix-internal"
]
...
server = "https://my.custom.mirror"
```

Using this `pixi.toml` with the above `rattler.toml` will result in the following behavior:

- `conda-forge` will be redirected to `https://my.custom.mirror/conda-forge`
- `bioconda` will be redirected to `https://repo.prefix.dev/bioconda` since it has higher priority than `default_mirrors`
- `https://conda.anaconda.org/cf-staging` and `https://repo.prefix.dev/prefix-internal` will not being redirected since they specify a full URL

!!!note "URLs in `channels`"
If you specify a full URL in `channels`, it will never be changed by `rattler.toml`. Only named channels will be redirected.

!!!tip "Use `prefix.dev` mirrors"
If you want to use the mirrors hosted on [prefix.dev](https://prefix.dev), you can use the following configuration:

```toml title="rattler.toml"
default_url = "https://repo.prefix.dev/{channel}"
default_server = "https://repo.prefix.dev"
```

### Default channels
Expand All @@ -93,7 +73,7 @@ default_channels = ["my-private-channel", "bioconda", "conda-forge"]

[[channels]]
name = "my-private-channel"
url = "https://my.private.quetz/get/my-private-channel"
server = "https://my.private.quetz/get"
```

This will result in the channels `bioconda` and `conda-forge` and `my-private-channel` being used when you run `pixi init` or `pixi global install` and `rattler-build` (assuming you don't override the channels using `-c`).
Expand All @@ -111,7 +91,7 @@ channels = [

[[channels]]
name = "my-private-channel"
url = "https://my.private.quetz/get/my-private-channel"
server = "https://my.private.quetz/get"
```

`pixi init --ignore-rattler-config` would create the following `pixi.toml`:
Expand All @@ -122,20 +102,22 @@ channels = ["conda-forge"]
# ...
```

### Multiple mirrors
### Mirrors

Instead of providing a single mirror, you can also provide a list of mirrors.

```toml title="rattler.toml"
[[channels]]
name = "conda-forge"
url = [
"https://conda.anaconda.org/conda-forge",
[mirrors]
"https://conda.anaconda.org" = [
"https://conda.anaconda.org", # (1)!
"https://repo.prefix.dev",
{url = "https://repo.artifactory.com/conda-mirror-conda-forge", use_zstd = false},
"oci://ghcr.io/conda-channel-mirrors/conda-forge"
]
```

1. Need to re-add this to also use anaconda.org.

This will result in `conda-forge` being redirected to all mirrors specified in `mirrors`.
`pixi` and `rattler-build` will use the fastest (TODO: what is the real behavior?) mirror available.

Expand All @@ -145,18 +127,18 @@ You can specify whether `pixi` and `rattler-build` should use the `repodata.json
This is needed for some proxies like older versions of artifactory ([RTFACT-29886](https://jfrog.atlassian.net/jira/software/c/projects/RTFACT/issues/RTFACT-29886)).

```toml title="rattler.toml"
default_url = {
url = "https://my.custom.mirror/{channel}",
use_bz2 = false,
use_zstd = false
}
[mirrors]
"https://conda.anaconda.org" = [
{ url = "https://mirrorme.com", no_zstd = false }
]

[[channels]]
name = "bioconda"
use_zstd = false
url = "https://repo.prefix.dev/bioconda"
"https://repo.artifactory.cloud" = [ # (1)!
{ url = "https://repo.artifactory.cloud", no_zstd = true, no_jlap = true }
]
```

1. If you want to specify the behavior of a specific server, you can add it as a mirror to itself with the desired behavior.

### Use private channels

You can specify private channels in your `pixi.toml` and route them to a different URL.
Expand All @@ -166,45 +148,28 @@ channels = ["conda-forge", "bioconda", "private-channel"]

[[channels]] # (1)!
name = "bioconda"
url = "https://conda.anaconda.org/bioconda"
server = "https://conda.anaconda.org"

[[channels]]
name = "private-channel"
url = "https://my.private.quetz/get/my-private-channel"
server = "https://my.private.quetz/get"
```

1. This is the default behavior
1. This is the default behavior.

This will result in `private-channel` being redirected to `https://my.private.quetz/get/my-private-channel`.
If you want to use a mirror for this private channel, you can override the channel URL in `rattler.toml` since `rattler.toml` takes precedence over `pixi.toml`.

```toml title="rattler.toml"
[[channels]]
name = "private-channel"
url = "https://repo.artifactory.com/conda-mirror-my-private-channel"
[mirrors]
"https://my.private.quetz/get/my-private-channel" = [
"https://repo.artifactory.com/conda-mirror-my-private-channel"
]
```

This will result in `private-channel` being redirected to `https://repo.artifactory.com/conda-mirror-my-private-channel`, but `https://my.private.quetz/get/my-private-channel` is still used in the `pixi.lock` file.
Thus, the canonical URL is still `https://my.private.quetz/get/my-private-channel`.

The `pixi.lock` file will persist the channels defined in `pixi.toml`:

```yaml title="pixi.lock"
channels:
- name: conda-forge
url: https://conda.anaconda.org/conda-forge
- name: my-channel
url: https://repo.prefix.dev/my-channel
environments:
default:
channels:
- conda-forge
packages:
linux-64:
- conda: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
# ...
```

### OCI mirrors

You can also use [OCI](https://opencontainers.org/) mirrors.
Expand Down

0 comments on commit 4ba7f25

Please sign in to comment.