Modules#
An overview of the packages that make up mibare.
The API reference below is generated automatically from the source docstrings.
Core (mibare.core)#
Always-included infrastructure.
Resolve a repository to a ranked list of mise backend candidates.
- mibare.core.resolve.SCHEMA_VERSION = 1#
Version of the shape
Resolution.to_dictreturns; bumped on breaking changes.
- class mibare.core.resolve.Candidate(backend_string, reasons=(), tier=5, legacy=False, warning=None, registry_name=None, windows_target=False)[source]#
Bases:
objectA backend string that could install the tool for a repository.
- Parameters:
- reasons#
Short explanations of why it is a candidate; each resolution step that finds the backend string appends its own.
- tier#
Position on mise’s preference ladder, 1 (packslip) to 5 (plugins); lower is better. Defaults to the lowest tier.
- Type:
- registry_name#
The registry short name to install it by, set only for the backend mise itself picks first for that name, so the entry’s options apply;
Noneotherwise.- Type:
str | None
- windows_target#
Whether the target platform is Windows, so the command is quoted for
cmd.exeinstead of a POSIX shell.- Type:
- property mise_use: str#
A ready-to-paste
mise usecommand for this candidate.It names the registry short name when
registry_nameis set and the backend string otherwise. The argument is quoted for the target platform’s shell, since the command is pasted where the tool will be installed: double quotes for a Windows target, POSIX quotes otherwise.
- class mibare.core.resolve.Exclusion(backend_string, reason)[source]#
Bases:
objectA backend string that was considered and left out.
- class mibare.core.resolve.Resolution(repository, mise_version, candidates, exclusions=(), platform=None, notes=())[source]#
Bases:
objectThe outcome of resolving a repository.
- Parameters:
- repository#
The repository that was resolved.
- candidates#
The candidates, best first.
- Type:
- exclusions#
The backend strings considered and left out, each with the reason.
- Type:
- platform#
The target platform the candidates are for.
- Type:
mibare.core.platform.Platform | None
- property recommendation: Candidate | None#
The top-ranked candidate, or
Nonewhen there is no backend.
- to_dict()[source]#
Return the documented, stable JSON shape of this resolution.
The keys, in order:
schema_version(int),repository(owner/repo),mise_version,recommendation(the first candidate’s backend string, ornull),candidates(best first, each withbackend_string,recommended,tier(int),legacy(bool),warning(text ornull),commandandreasons),excluded(each withbackend_stringandreason),platform(os-archornull) andnotes(a list of text).commandis always a string. It names the registry short name for the backend mise itself picks first for a registry entry (so the entry’s options, whichmise registry --jsonomits, apply), and the explicit backend string for every other candidate;backend_stringstays the candidate’s identity either way. An argument that needs quoting is quoted for the target platform’s shell: double quotes for a Windows target, POSIX single quotes otherwise.
- mibare.core.resolve.resolve(repository, mise, platform=None, github=None, ecosystems=(Ecosystem(backend='pypi', languages=frozenset({'Python'}), detect=<function _detect_python>), Ecosystem(backend='cargo', languages=frozenset({'Rust'}), detect=<function _detect_cargo>), Ecosystem(backend='npm', languages=frozenset({'JavaScript', 'TypeScript'}), detect=<function _detect_npm>), Ecosystem(backend='go', languages=frozenset({'Go'}), detect=<function detect_go>)))[source]#
Resolve
repositoryto the mise backends that can install it.- Parameters:
repository¶ – A GitHub URL or
owner/reposhorthand.mise¶ – The mise adapter.
platform¶ – The target platform; defaults to the host.
github¶ – The GitHub adapter. Without one the steps that need the GitHub API are left out, so
resolve()stays offline.ecosystems¶ – The language-package ecosystems to detect; defaults to the registered ones.
repository (str)
mise (Mise)
platform (Platform | None)
github (GitHub | None)
ecosystems (Sequence[Ecosystem])
- Returns:
- The ranked candidates; the first is the recommendation.
When GitHub is unreachable or a mise probe fails, the other candidates are kept and the skipped steps are named in
notes.
The first failure (
GitHubUnavailableErrororMiseError) is raised instead when a step failed and no step found a candidate, so the answer does not read as “no backend”.An
InvalidPlatformErroris raised when noplatformis given and the host is not a supported platform; an explicitplatformneeds no host detection.- Return type:
The repository mibare is asked about, and how to recognise it in text.
- mibare.core.repository.parse_repository(text)[source]#
Parse a GitHub URL or
owner/reposhorthand.Tolerates surrounding whitespace, trailing slashes, a
.gitsuffix, awww.prefix, a missing scheme, extra path segments and a query or fragment (both ignored).- Parameters:
- Returns:
The repository the input names.
- Return type:
- Raises:
InvalidRepositoryError – If the input does not name a GitHub repository.
The mise adapter: the only code that runs a mise binary (ADR 0002).
mise always runs in an isolated environment so the user’s settings, such as
MISE_DISABLE_BACKENDS, never change the answer: a clean environment, a
temporary HOME, MISE_NO_CONFIG=1, and GITHUB_TOKEN plus the proxy and
certificate variables passed through so mise can still reach the network, and
SystemRoot, which Windows needs in an explicit environment.
- mibare.core.mise.MIN_MISE_VERSION = (2026, 10, 13)#
The oldest mise whose
registry --jsonoutput mibare understands.
- class mibare.core.mise.Mise(*args, **kwargs)[source]#
Bases:
ProtocolThe interface
resolve()needs from mise, replaceable in tests.- registry()[source]#
Return the registry entries in registry order.
- Return type:
tuple[RegistryEntry, …]
- class mibare.core.mise.RegistryEntry(tool, backends)[source]#
Bases:
objectOne tool in mise’s registry.
- class mibare.core.mise.SubprocessMise(run=<function run_process>)[source]#
Bases:
objectThe real adapter, which runs
miseas a subprocess.Create the adapter.
- Parameters:
run¶ – Runs the command line; replaced in tests so no process starts.
run (Runner)
- version()[source]#
Return the mise version, recording it on first use.
- Returns:
The version number, such as
2026.10.13.- Return type:
- Raises:
MiseTooOldError – If mise is older than
MIN_MISE_VERSION.MiseError – If the version cannot be read.
- registry()[source]#
Return the registry entries in registry order.
- Returns:
The entries from
mise registry --json.- Return type:
tuple[RegistryEntry, …]
- Raises:
MiseError – If mise is unusable or its output cannot be understood.
- recipe_exists(backend_string)[source]#
Say whether mise can list versions of
backend_string.- Parameters:
- Returns:
Truewhenmise ls-remoteexits 0,Falsewhen itreports the recipe as not found.
- Return type:
- Raises:
MiseError – If
mise ls-remotefails for any other reason, so a network or rate-limit failure never reads as “absent”.
- mibare.core.mise.run_process(args, env, cwd)[source]#
Run a command with exactly
envas its environment.The executable is looked up on the caller’s
PATH, not onenv.- Parameters:
- Returns:
The finished process.
- Return type:
- Raises:
FileNotFoundError – If the executable is not on
PATH.
Errors mibare reports to the user as exit code 2.
Bases:
MibareErrorThe GitHub API could not be used: no network, a rate limit or a server error.
- exception mibare.core.errors.InvalidPlatformError[source]#
Bases:
MibareErrorThe platform is not a known
os-archpair.
- exception mibare.core.errors.InvalidRepositoryError[source]#
Bases:
MibareErrorThe input is not a GitHub URL or
owner/reposhorthand.
- exception mibare.core.errors.MibareError[source]#
Bases:
ExceptionBase class for errors with a message meant for the user.
- exception mibare.core.errors.MiseError[source]#
Bases:
MibareErrorRunning
misefailed or its output could not be understood.
- exception mibare.core.errors.MiseNotFoundError[source]#
Bases:
MiseErrorNo
misebinary is available.
- exception mibare.core.errors.MiseTooOldError[source]#
Bases:
MiseErrorThe
misebinary is older than the minimum mibare supports.
- exception mibare.core.errors.RepositoryNotFoundError[source]#
Bases:
MibareErrorGitHub has no repository with the given owner and name.
Configurations for the project.
- class mibare.core.config.Settings(log_level=<factory>)[source]#
Bases:
objectApplication settings sourced from environment variables.
Stdlib-only fallback used when pydantic-settings is not enabled. Each field is overridable via an environment variable named after the uppercased project name (dashes normalized to underscores) plus the field, for example
MIBARE_LOG_LEVEL.- Parameters:
log_level (str)
- mibare.core.config.get_settings()[source]#
Return the cached settings singleton.
Cached so all callers share one instance; tests can reset or override it via
get_settings.cache_clear()instead of patching an import-time value.- Returns:
The cached settings instance.
- Return type:
Directory configurations for the project.
- mibare.core.dirs.HOME_IS_RESOLVABLE: bool = True#
Whether the user’s home directory could be resolved at import time.
When
Falsethe project has no user-owned directory to write to, so file logging is disabled incore/logging_setup.pyrather than falling back to a predictable shared location.
- mibare.core.dirs.ROOT_FOLDER_PATH: Path = PosixPath('/home/runner/.mibare')#
Path to the root folder.
- mibare.core.dirs.LOG_FILE_PATH: Path = PosixPath('/home/runner/.mibare/main.log')#
Path to the log file.
Set up logging for the project.
This module configures logging for the project, ensuring that log handlers are only added once to prevent duplicate log entries if the module is imported multiple times.
Setup is resilient to a read-only or unavailable $HOME: if the log
directory cannot be created it degrades to console-only logging instead of
raising, so read-only commands (--help, version) stay usable.
- mibare.core.logging_setup.get_logger()[source]#
Return the cached project logger.
- Returns:
The cached project logger.
- Return type:
CLI (mibare.cli)#
Thin Typer command-line wrapper around the library core.
CLI application for the project.
mibare <repo> is the whole interface: one command, no subcommands. It is a
thin wrapper over mibare.core.resolve.resolve() that parses the
argument, prints the resolution and maps the outcome onto an exit code.
- mibare.cli.app.main(repository, *, platform=None, json_output=False, verbose=False)[source]#
Recommend which mise backend to install a GitHub repository with.
Exits 0 when a backend is found, 1 when none is, and 2 on an error such as input that is not a GitHub repository or a missing or too-old mise.
Example
mibare BurntSushi/ripgrep mibare https://github.com/BurntSushi/ripgrep
- Raises:
typer.Exit – Always, with the exit code describing the outcome.
- Parameters:
repository (Annotated[str, <typer.models.ArgumentInfo object at 0x7f5b8dbe2850>])
platform (Annotated[str | None, <typer.models.OptionInfo object at 0x7f5b8dbe2990>])
json_output (Annotated[bool, <typer.models.OptionInfo object at 0x7f5b8dbe2ad0>])
verbose (Annotated[bool, <typer.models.OptionInfo object at 0x7f5b8dbe2c10>])
- Return type:
None