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

Fix lazy loading of micromamba/pixi_jll #171

Merged
merged 4 commits into from
Mar 3, 2025
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Changelog

## Unreleased
## 0.2.26 (2025-03-03)
* Add `allowed_channels` preference to restrict which Conda channels can be used.
* Add `channel_priority` preference to control channel priority (strict/flexible/disabled).
* Add `channel_order` preference to specify channel ordering.
* Add `channel_mapping` preference to rename channels (useful for proxies/mirrors).
* Default channel priority is now `flexible`, or `strict` on pixi backends (previously `disabled`).
* Bug fixes in lazy loading.

## 0.2.25 (2025-02-18)
* Add `Pixi` and `SystemPixi` backends to allow using [Pixi](https://pixi.sh/latest/) to install packages.
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CondaPkg"
uuid = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
authors = ["Christopher Doris <github.com/cjdoris>"]
version = "0.2.25"
version = "0.2.26"

[deps]
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
Expand Down
13 changes: 9 additions & 4 deletions src/CondaPkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ using Scratch: @get_scratch!
using TOML: TOML

# these are loaded lazily to avoid downloading the JLLs unless they are needed
MICROMAMBA_MODULE = Ref{Module}()
PIXI_JLL_MODULE = Ref{Module}()
const MICROMAMBA_MODULE = Ref{Module}()
const PIXI_JLL_MODULE = Ref{Module}()

const MICROMAMBA_PKGID =
Base.PkgId(Base.UUID("0b3b1443-0f03-428d-bdfb-f27f9c1191ea"), "MicroMamba")
const PIXI_JLL_PKGID =
Base.PkgId(Base.UUID("4d7b5844-a134-5dcd-ac86-c8f19cd51bed"), "pixi_jll")

function micromamba_module()
if !isassigned(MICROMAMBA_MODULE)
MICROMAMBA_MODULE[] = Base.require(CondaPkg, :MicroMamba)
MICROMAMBA_MODULE[] = Base.require(MICROMAMBA_PKGID)
end
MICROMAMBA_MODULE[]
end

function pixi_jll_module()
if !isassigned(PIXI_JLL_MODULE)
PIXI_JLL_MODULE[] = Base.require(CondaPkg, :pixi_jll)
PIXI_JLL_MODULE[] = Base.require(PIXI_JLL_PKGID)
end
PIXI_JLL_MODULE[]
end
Expand Down
4 changes: 2 additions & 2 deletions test/internals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ end
packages =
Dict("foo" => Dict("test.toml" => CondaPkg.PkgSpec("foo", channel = "bad-channel")))
channels = [CondaPkg.ChannelSpec("conda-forge")]
@test nothing ===
@test true ===
Copy link

Choose a reason for hiding this comment

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

true === is extra now I think

CondaPkg._resolve_check_allowed_channels(devnull, packages, channels, nothing)

# Test package with disallowed channel
Expand Down Expand Up @@ -218,7 +218,7 @@ end
"bar" => Dict("test.toml" => CondaPkg.PkgSpec("bar", channel = "anaconda")),
)
channels = [CondaPkg.ChannelSpec("conda-forge"), CondaPkg.ChannelSpec("anaconda")]
@test nothing ===
@test true ===
CondaPkg._resolve_check_allowed_channels(devnull, packages, channels, allowed)
end

Expand Down
Loading