meta_package_manager.managers.nimble module¶

class meta_package_manager.managers.nimble.Nimble[source]¶

Bases: PackageManager

Nimble, the package manager of the Nim language.

A package is a Nim library or binary, identified by the bare name the registry publishes it under.

Caution

The inventory forces --ver, and that flag is the whole difference between a useful listing and a misleading one. Without it nimble list --installed prints package names and nothing else, so every package would be reported with no version at all while looking perfectly healthy. Upstream tracked the flag being ignored as nim-lang/nimble#1469, closed as completed; the fix is what sets the requirement floor below.

Note

Both listings open with a three-line legend describing the format, whose own lines look exactly like the records that follow: a :PackageName: placeholder where a name goes, and a └── @{Version} (...) placeholder where a version goes. Both parsers therefore demand a real value, refusing the brace-wrapped placeholders, rather than skipping a fixed number of header lines that a future release could renumber.

Note

Records span two lines, a name followed by one indented line per version held, which is what makes this a class rather than a bundled definition. Nimble keeps several versions of a package side by side, so the versions are reduced here to the newest per name.

Note

No outdated: Nimble has no command reporting which installed packages have newer releases.

No upgrade either, and that is a deliberate reading rather than an oversight. nimble upgrade is documented as upgrading “a list of packages in the lock file”, which is a project operation on a nimble.lock and not something that acts on the machine. Installing a package again does fetch the newest release, but Nimble adds it beside the version already held rather than replacing it, so reporting that as an upgrade would misstate what happened.

Documentation: Nimble README.

Initialize cli_errors list.

name: str = 'Nimble'¶

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://github.com/nim-lang/nimble'¶

Home page of the project, only used in documentation for reference.

platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='aix', name='IBM AIX'), Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='cygwin', name='Cygwin'), Platform(id='debian', name='Debian'), Platform(id='dragonfly_bsd', name='DragonFly BSD'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='freebsd', name='FreeBSD'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='haiku', name='Haiku'), Platform(id='hurd', name='GNU/Hurd'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='illumos', name='illumos'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='midnightbsd', name='MidnightBSD'), Platform(id='netbsd', name='NetBSD'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='openbsd', name='OpenBSD'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='os400', name='IBM i'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='solaris', name='Solaris'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='sunos', name='SunOS'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='windows', name='Windows'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶

List of platforms supported by the manager.

Allows for a mishmash of platforms and groups of platforms. Will be normalized into a frozenset of Platform instances at instantiation.

requirement: str | None = '>=0.22.0'¶

First release carrying the fix that makes list --installed --ver print versions: nim-lang/nimble#1469 was closed on 2025-09-18, between v0.20.1 and v0.22.0.

pre_args: tuple[str, ...] = ('--noColor', '--accept')¶

Strip styling so the parsers see plain text, and pre-answer the prompts.

--accept is not cosmetic: uninstall asks “Do you wish to continue?” and blocks forever without it.

version_regexes: tuple[str, ...] = ('nimble[ \\t]+v(?P<version>\\S+)',)¶

Search the version right after the nimble v string.

$ nimble --version
nimble v0.22.2 compiled at 2026-04-24 03:34:24
git hash: couldn't determine git hash
cli_names: tuple[str, ...] = ('nimble',)¶

List of CLI names the package manager is known as.

This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.

..hint::

This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named python or python3.

By default, this property’s value is derived from the manager’s ID (see the MetaPackageManager.__init__ method above).

id: str = 'nimble'¶

Package manager’s ID.

Derived by defaults from the lower-cased class name in which underscores _ are replaced by dashes -.

This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.

virtual: bool = False¶

Should we expose the package manager to the user?

Virtual package manager are just skeleton classes used to factorize code among managers of the same family.

property installed: Iterator[Package]¶

Fetch installed packages.

$ nimble --noColor --accept list --installed --ver
Package list format:
{PackageName}
└── @{Version} ({CheckSum})[Special Versions (if any)] ({InstallPath})
parsetoml
├── @0.7.2 (2a9fb57ef1f6460fd61b1cfab2d83af44f788a25) (/Users/kde/.nimble/pkgs2/parsetoml-0.7.2-2a9fb57ef1f6460fd61b1cfab2d83af44f788a25)
└── @0.7.1 (586fe63467a674008c4445ed1b8ac882177d7103) (/Users/kde/.nimble/pkgs2/parsetoml-0.7.1-586fe63467a674008c4445ed1b8ac882177d7103)
search(query, extended, exact)[source]¶

Fetch matching packages.

Caution

Search does not support extended or exact matching, and reports no version: Nimble’s records carry a URL, tags, a description, a license and a website, but nothing identifying a release.

$ nimble --noColor --accept search parsetoml
parsetoml:
  url:         https://github.com/NimParsers/parsetoml.git (git)
  tags:        library, parse
  description: Library for parsing TOML files.
  license:     MIT
  website:     https://github.com/NimParsers/parsetoml
Return type:

Iterator[Package]

install(package_id, version=None)[source]¶

Install one package.

$ nimble --noColor --accept install checksums
Downloading https://github.com/nim-lang/checksums using git
      Info: using /opt/homebrew/Cellar/nim/2.2.10/nim/bin/nim for compilation
Return type:

str

remove(package_id)[source]¶

Remove one package.

$ nimble --noColor --accept uninstall checksums
    Looking for checksums (any version)
   Checking reverse dependencies
    Prompt: The following packages will be removed:
        ... checksums-0.2.2-6357ab195ec23e0e0a54d4d8b5e0212456bf899e
        ... Do you wish to continue? -> [forced yes]
    Removed checksums-0.2.2-6357ab195ec23e0e0a54d4d8b5e0212456bf899e
Return type:

str

sync()[source]¶

Sync package metadata.

$ nimble --noColor --accept refresh
Downloading Official package list
    Success Package list downloaded.
Return type:

None