Mamba 2.0 Changes#
Command Line Executables#
Mamba (executable)#
mamba, previously a Python executable mixing libmambapy, conda, and some specific code logic
has been entirely replaced by the dynamically linked version of micromamba,
a statically-linked ELF based on libmamba.
Hence mamba` now has the exact same user interface and experience as micromamba.
Warning
The previous code being a highly complex project with few of its original developers still active, it is hard to make an exhaustive list of all changes.
Please help us by reporting changes missing changes.
Micromamba#
Micromamba receives all new features and its CLI remains mostly unchanged.
Breaking changes include:
micromamba shell initroot prefix parameter--prefix(-p) was renamed--root-prefix(-r). Both options were supported in version1.5.A new config
order_solver_request(default true) can be used to order the dependencies passed to the solver, getting order independent solutions.Support for complex match specs such as
pkg[md5=0000000000000]andpkg[build='^\d*$'].
Libraries#
Mamba (Python package)#
In version 2.0, all tools are fully written in C++.
All code previously available in Python through import mamba has been removed.
Libmambapy (Python bindings)#
The Python bindings to the C++ libmamba library remain available through import libmambapy.
They are now considered the first class citizen to using Mamba in Python.
Changes include:
The global
Context, previously available throughContext(), must now be instantiated at least once before usinglibmambapyfunctions and types. Only one instance can exist at any time, but that instance can be destroyed and another recreated later, for example if you use it in specific functions scopes.- What’s more, it is required to be passed explicitly in a few more functions. Notably:
MultiPackageCache(constructor)SubdirData.create_repoSubdirIndex.createSubdirIndex.downloadcleantransmuteget_virtual_packagescancel_json_output
In version 2,
Context()will throw an exception to allow catching errors more smoothly.ChannelContextis no longer an implicit global variable. It must be constructed with one ofChannelContext.make_simpleorChannelContext.make_conda_compatible(withContext.instanceas argument in most cases) and passed explicitly to a few functions.A new
Contextindependent submodulelibmambapy.specshas been introduced with:The redesign of the
Channeland a newUnresolvedChannelused to describe unresolved channel strings. A featurefullibmambapy.specs.CondaURLis used to describe channel URLs.The redesign of
MatchSpec. The module also includes a platform enumeration, an implementation of orderedVersion, and aVersionSpecto match versions.PackageInfohas been moved to this submodule. Some attributes have been given a more explicit namefn>filename,url>package_url.
A new
Contextindependent submodulelibmambapy.solverhas been introduced with the changes below. A usage documentation page is available at Solving Package Environments.The redesign of the
Pool, which is now available aslibmambapy.solver.libsolv.Database. The new interfaces make it easier to create repositories without using otherlibmambapyobjects.Repohas been redesigned into a lightweightRepoInfoand moved tolibmambapy.solver.libsolv. The creation and modification of repos happen through theDatabase, with methods such asDatabase.add_repo_from_repodata_jsonandDatabase.add_repo_from_packages, but also high-level free functions such asload_subdir_in_databaseandload_installed_packages_in_database.The
Solverhas been moved tolibmambapy.solver.libsolv.Solver.All jobs, pins, and flags must be passed as a single
libmambapy.solver.Request.The outcome of solving the request is either a
libmambapy.solver.Solutionor alibmambapy.solver.libsolv.Unsolvablestate from which rich error messages can be extracted.
For many changes, an exception throwing placeholders has been kept to advise developers on the new direction to take.
Libmamba (C++)#
The C++ library libmamba has received significant changes.
Due to the low usage of the C++ interface, all changes are not listed here.
The main changes are:
Refactoring and testing of a large number of utilities into a
util::namespace.Creation of
specs::including the items below. A usage documentation (in Python) is available at Describing Conda Objects.Implementations of
VersionandVersionSpecfor matching versions,A refactoring of a purely functional
Channelclass,Implementation of a
UnresolvedChannelto describe unresolvedChannels,A refactored and complete implementation of
MatchSpecusing the components above.
A cleanup of
ChannelContextto be a light proxy and parameter holder wrapping thespecs::Channel.A new
repodata.jsonparser using simdjson.The
MPool,MRepoandMSolverAPI has been completely redesigned into asolversubnamespace and works independently of theContext. Thesolver::libsolvsub-namespace has also been added for full isolation of libsolv, and a solver API withoutContext. ThesolverAPI redesign includes the items below. A usage documentation (in Python) is available at Solving Package Environments.A refactoring of the
MPoolas aDataBase, fully isolates libsolv, and simplifies repository creation.A refactoring and thinning of
MRepoas a newRepoInfo.A solver
Requestwith all requirements to solve is the new way to specify jobs.A refactoring of
Solver.A solver outcome as either a
Solutionor anUnSolvablestate.
Plug of the Mamba’s
MatchSpecimplementation in theSolver, enabling the solving of all types of previously unsupported MatchSpecs.Improved downloaders.
Mirrors and OCI registries#
In the perspective of ensuring continuous and faster access when downloading packages, we now support mirroring channels.
Furthermore, we support fetching packages from OCI registries in order to provide an alternative to hosting on https://conda.anaconda.org/conda-forge/.
Specifying a mirror can be done in the rc file as follows:
$ cat ~/.mambarc
# Specify a mirror (can be a list of mirrors) for conda-forge channel
mirrored_channels:
conda-forge: ["oci://ghcr.io/channel-mirrors/conda-forge"]
# ``repodata_use_zst`` isn't considered when fetching from oci registries
# since compressed repodata is handled internally
# (if present, compressed repodata is necessarily fetched)
# Setting ``repodata_use_zst`` to ``false`` avoids useless requests with
# zst extension in repodata filename
repodata_use_zst: false
Then, you can for instance create a new environment pandoc_from_oci where pandoc can be fetched from the specified mirror and installed:
$ micromamba create -n pandoc_from_oci pandoc -c conda-forge
Listing packages in the created pandoc_from_oci environment:
$ micromamba list -n pandoc_from_oci
Name Version Build Channel
─────────────────────────────────────────────────────────────────────────────────────
pandoc 3.2 ha770c72_0 https://pkg-containers.githubusercontent.com/ghcr1/blobs