Skip to content

Allow OrderedCollections 2 (and Parameters 0.13) - #87

Open
matthew-liu-1 wants to merge 1 commit into
StanJulia:masterfrom
jahan-open:compat/orderedcollections-2
Open

matthew-liu-1 wants to merge 1 commit into
StanJulia:masterfrom
jahan-open:compat/orderedcollections-2

Conversation

@matthew-liu-1

@matthew-liu-1 matthew-liu-1 commented Sep 30, 2026 •

Copy link
Copy Markdown

Summary

Widens two compat bounds so StanSample can be used in environments that need
OrderedCollections 2, and bumps the patch version to 7.10.4.

-OrderedCollections = "1.4"
-Parameters = "0.12"
+OrderedCollections = "1.4, 2"
+Parameters = "0.12, 0.13"

Parameters has to move together with OrderedCollections: every Parameters
0.12.x release caps OrderedCollections to 1.x, so 0.13.1 is the only release in
the 0.12–0.13 range that admits OrderedCollections 2. That indirection is why
widening OrderedCollections alone is not enough.

This is safe to merge on its own: the resolver simply keeps OrderedCollections
1.x until StanBase allows 2 as well (companion PR in StanJulia/StanBase.jl), so
merging this alone changes nothing for existing users.

Motivation

@bparbhu — for context on why we're asking for this: we're trying to run
MLJLinearModels at head, which needs OrderedCollections 2 in the resolved
environment. StanSample and StanBase are currently the StanJulia-side pins that
prevent our environment from getting there (along with StanOptimize, which has the
same Parameters = "0.12" cap — companion PR filed there too).

Why no code changes are needed

  • OrderedDict is only ever constructed or used as a type parameter:
    src/utils/reshape.jl (OrderedDict{String, Variable}),
    src/utils/namedtuples.jl (OrderedDict()), src/utils/particles.jl and
    ext/MonteCarloMeasurementsExt.jl (OrderedDict{Symbol, …}).
  • Parameters is imported in src/StanSample.jl:24 but no macro from it is used
    anywhere
    in src/ or ext/ — no @with_kw, @unpack, @pack!,
    reconstruct or type2dict. The only other matches for "Parameters" in the
    source are docstring prose.

OrderedCollections 2.0's breaking changes are: removal of the deprecated
similar(::OrderedDict) / similar(::OrderedSet) / sort(::Dict) methods,
removal of deprecated OrderedSet indexing, convert(OrderedDict, ::AbstractDict)
on an unordered dict now throwing instead of warning, first/last on an empty
collection throwing ArgumentError, and a changed internal OrderedDict struct
layout (new live, firstlive, lastlive fields). None of these are reachable
from the usage above.

Testing

Julia 1.10.12, Linux x86_64, CmdStan 2.36.0.

Full test suite under OrderedCollections 2.0.1 + Parameters 0.13.1:
260 passed, 0 failed, exit code 0.

Bernoulli array tests             11/11      InferenceData interface           1/1
Test correct chains are read in    6/6       Bernoulli sig-figs tests          1/1
Bernoulli basic run tests         20/20      Tables.jl interface              43/43
JSON                               3/3       Nested Dataframes             175/175

StanSample and its AxisKeys, InferenceObjects and MonteCarloMeasurements
extensions all precompile cleanly against OrderedCollections 2.0.1.

One caveat: the MCMCChains extension

MCMCChains is capped at "5.6, 6" here, but every MCMCChains release —
including 7.7.0 — caps OrderedCollections to 1.x, so the extension cannot reach
OrderedCollections 2 regardless of what this PR does, and widening that bound here
would not help; it needs a compat widening in MCMCChains itself.

That widening is already open as TuringLang/MCMCChains.jl#511
(OrderedCollections "1.4" → "1.4, 2"), with a green test matrix. Once it
merges and registers, the MCMCChains bound here can be revisited in a follow-up.

In the meantime I left the MCMCChains bound untouched and excluded the two test
files that using MCMCChains (test/test_mcmcchains/, test/test_chris_two_step/)
from the OrderedCollections 2 run. Since MCMCChains is a weak dependency, this does
not affect users who don't load it.

OrderedCollections 2.0.1 is available. Parameters 0.13.1 is the first
Parameters release that allows it. This change widens both compat
entries and bumps the patch version.

The resolver keeps OrderedCollections 1.x until StanBase also allows
version 2. This change is therefore safe to merge on its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant