Skip to content

Commit

Permalink
Fix lazy loading of micromamba/pixi_jll (#171)
Browse files Browse the repository at this point in the history
* Fix lazy loading of micromamba/pixi_jll

* fix tests

---------

Co-authored-by: Christopher Doris <github.com/cjdoris>
  • Loading branch information
cjdoris authored Mar 3, 2025
1 parent 70aa9db commit 03f8a36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
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 ===
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

2 comments on commit 03f8a36

@cjdoris
Copy link
Collaborator Author

@cjdoris cjdoris commented on 03f8a36 Mar 3, 2025

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/126205

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.26 -m "<description of version>" 03f8a36a90d05b8c5921f7e499b4135262a5f186
git push origin v0.2.26

Please sign in to comment.