Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
71 changes: 42 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 15 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async-trait = "0.1"
bzip2 = "0.6.1"
clap = { version = "4.6.0", features = ["derive"] }
dashmap = "6.1"
dirs = "6.0.0"
dunce = "1.0.5"
console = { version = "0.16.3", features = ["windows-console-colors"] }
flate2 = "1.1.9"
Expand Down Expand Up @@ -133,39 +134,38 @@ tracing-subscriber = { version = "0.3", features = [
] }
tracing-test = "0.2.6"

# rattler crates
# Rattler crates
rattler_conda_types = { version = "0.47.2", default-features = false }
rattler_conda_types = { version = "0.48", default-features = false }
rattler_digest = { version = "1.3.1", default-features = false, features = [
"serde",
] }
rattler_networking = { version = "0.30.0", default-features = false }
rattler_package_streaming = { version = "0.26.5", default-features = false }
rattler_shell = { version = "0.27.7", default-features = false, features = [
rattler_networking = { version = "0.30.1", default-features = false }
rattler_package_streaming = { version = "0.26.7", default-features = false }
rattler_shell = { version = "0.27.9", default-features = false, features = [
"sysinfo",
] }
rattler_git = { version = "0.1.3" }
rattler_prefix_guard = { version = "0.1.1" }

rattler_config = { version = "0.5.2" }
rattler = { version = "0.46.0", default-features = false, features = [
rattler_config = { version = "0.6" }
rattler = { version = "0.47", default-features = false, features = [
"cli-tools",
"indicatif",
] }
rattler_cache = { version = "0.10.0", default-features = false }
rattler_index = { version = "0.30.5", default-features = false }
rattler_upload = { version = "0.8.0", default-features = false }
rattler_cache = { version = "0.10.2", default-features = false }
rattler_index = { version = "0.30.8", default-features = false }
rattler_upload = { version = "0.8.3", default-features = false }
rattler_s3 = { version = "0.2.5" }
rattler_redaction = { version = "0.2.1", default-features = false }
rattler_repodata_gateway = { version = "0.29.6", default-features = false, features = [
rattler_repodata_gateway = { version = "0.30", default-features = false, features = [
"gateway",
] }
rattler_solve = { version = "7.1.4", default-features = false, features = [
rattler_solve = { version = "7.2", default-features = false, features = [
"resolvo",
"serde",
] }
rattler_virtual_packages = { version = "3.0.2", default-features = false }
rattler_menuinst = "0.2.67"
rattler_virtual_packages = { version = "3.0.3", default-features = false }
rattler_menuinst = "0.2.69"

Comment on lines +137 to 168

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.

Would be better to only bump minor patches and leave patch bumps in the lockfile only.


# Internal rattler-build crates
Expand Down Expand Up @@ -241,6 +241,7 @@ ignore = { workspace = true }
globset = { workspace = true }
clap-verbosity-flag = { workspace = true }
indexmap = { workspace = true }
dirs = { workspace = true }
dunce = { workspace = true }
fs-err = { workspace = true }
clap_complete = "4.6.0"
Expand Down
3 changes: 2 additions & 1 deletion crates/rattler_build_core/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ pub async fn skip_existing(

let channels = if only_local {
vec![
Channel::from_directory(&first_output.build_configuration.directories.output_dir)
Channel::try_from_directory(&first_output.build_configuration.directories.output_dir)
.expect("could not create channel from directory")
.base_url,
]
} else {
Expand Down
7 changes: 6 additions & 1 deletion crates/rattler_build_core/src/package_test/run_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,12 @@ pub async fn run_test(
let package_folder = cache_metadata.path().to_path_buf();

let mut channels = config.channels.clone();
channels.insert(0, Channel::from_directory(tmp_repo.path()).base_url);
channels.insert(
0,
Channel::try_from_directory(tmp_repo.path())
.expect("could not create channel from directory")
.base_url,
);

let host_platform = config.host_platform.clone().unwrap_or_else(|| {
if target_platform == Platform::NoArch {
Expand Down
4 changes: 3 additions & 1 deletion crates/rattler_build_core/src/render/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ pub async fn load_repodatas(
.clear()
.unwrap();

Ok(result)
// `query` now returns a `RepoDataQueryOutput` (records plus non-fatal

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can we emit the warnings here? Or elsewhere? That would be a nice improvement.

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 it would be good to add them for sure! Now they are silently dropped.

// warnings); we only need the repodata records here.
Ok(result.repodata)
}

pub async fn install_packages(
Expand Down
3 changes: 2 additions & 1 deletion crates/rattler_build_core/src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ pub async fn build_reindexed_channels(
return Ok(build_configuration.channels.clone());
}

let output_channel = Channel::from_directory(output_dir);
let output_channel =
Channel::try_from_directory(output_dir).expect("could not create channel from directory");

// Clear the repodata gateway of any cached values for the output channel.
// Clear all subdirs so that packages from other platforms (e.g. a linux-64
Expand Down
2 changes: 1 addition & 1 deletion crates/rattler_build_playground/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rattler_build_jinja = { path = "../rattler_build_jinja" }
rattler_build_types = { path = "../rattler_build_types" }
rattler_build_yaml_parser = { path = "../rattler_build_yaml_parser" }
indexmap = "2"
rattler_conda_types = { version = "0.47.2", default-features = false }
rattler_conda_types = { version = "0.48", default-features = false }
serde_yaml = "0.9"
arborium = { version = "2", default-features = false, features = ["lang-yaml"] }

Expand Down
30 changes: 28 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
# Rattler-Build configuration

Rattler-Build can be configured by specifying `--config-file ~/.pixi/config.toml`.
The config file is of the same format as pixi's [global configuration file](https://pixi.sh/latest/reference/pixi_configuration/).
Rattler-Build shares its configuration format with pixi: the config file is of the same format as pixi's [global configuration file](https://pixi.sh/latest/reference/pixi_configuration/).

By default (when no `--config-file` is passed), Rattler-Build automatically loads and merges configuration from the standard locations shared by all rattler based tools. Discovery is provided by `rattler_config`'s common `locations` helper, so the search order is identical to the one pixi and other tools use. The locations, in ascending order of precedence (values from later files override values from earlier files):

1. The system-wide configuration of each tool: `/etc/pixi/config.toml` followed by `/etc/rattler-build/config.toml` (on Windows: `C:\ProgramData\<tool>\config.toml`)
2. The per-user configuration of each tool: the platform config directory (`$XDG_CONFIG_HOME/<tool>/config.toml`, e.g. `~/.config/pixi/config.toml`) and the tool home (`$PIXI_HOME` / `$RATTLER_BUILD_HOME`, defaulting to `~/.pixi/config.toml` / `~/.rattler-build/config.toml`), for `pixi` first and then `rattler-build`

In other words all system-wide files are read before any per-user file, and within each group pixi's files are overridden by Rattler-Build's own files. This means that settings such as default channels, mirrors, or S3 options that you have configured for pixi are picked up by Rattler-Build automatically, and can be overridden in Rattler-Build's own configuration files.

Alternatively, a single configuration file can be specified explicitly with `--config-file` (e.g. `--config-file ~/.pixi/config.toml`), which disables the automatic discovery and loads only that file.

!!! note "Behavior change"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should we add a mode in which rattler-build doesn't load any configuration so users can preserve the old behavior?

Earlier versions of Rattler-Build only loaded configuration when `--config-file` was passed. Automatic discovery of the locations above is new: if you already have a pixi configuration, Rattler-Build now picks it up by default. Pass `--config-file` (pointing at the file you want, or an empty file) to opt out of discovery.

## Seeing which configuration was loaded

On startup Rattler-Build logs its version and the configuration files it actually loaded, so you can always trace where a setting came from:

```
rattler-build 0.68.0
Loaded configuration from: /etc/pixi/config.toml, /home/user/.pixi/config.toml
```

If no configuration file was found — either because none of the default locations exist, or because `--config-file` was not given — it logs `No configuration file loaded` instead. These lines appear at the default log level; run with `-v` to additionally see the full list of candidate paths that were considered (useful when a file you expected is not picked up).

## Programmatic use

Automatic discovery happens **only when you run the `rattler-build` command-line tool**. When Rattler-Build is used as a library (for example from [pixi](https://pixi.sh), or through the Python bindings), no configuration is loaded implicitly — the embedding application constructs the configuration and passes it in. This guarantees that using Rattler-Build programmatically never silently reads your global pixi or Rattler-Build configuration from disk.

## Channels

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/cli/rattler-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ rattler-build [OPTIONS] [COMMAND]
<br>**env**: `RATTLER_BUILD_WRAP_LOG_LINES`
<br>**options**: `true`, `false`
- <a id="arg---config-file" href="#arg---config-file">`--config-file <CONFIG_FILE>`</a>
: The Rattler-Build configuration file to use
: The Rattler-Build configuration file to use. If not set, configuration is loaded from the default locations (the system-wide and global pixi configuration files as well as rattler-build's own configuration files)
- <a id="arg---color" href="#arg---color">`--color <COLOR>`</a>
: Enable or disable colored output from Rattler-Build. Also honors the `CLICOLOR` and `CLICOLOR_FORCE` environment variable
<br>**env**: `RATTLER_BUILD_COLOR`
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/cli/rattler-build/auth/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ rattler-build auth status [OPTIONS]
```

## Options
- <a id="arg---verbose" href="#arg---verbose">`--verbose (-v)`</a>
- <a id="arg---details" href="#arg---details">`--details`</a>
: Show endpoint URLs, client ID, and other IdP-introspection fields that are only useful for debugging
Loading
Loading