meta_package_manager.managers.sheldon module¶

class meta_package_manager.managers.sheldon.Sheldon[source]¶

Bases: PackageManager

Sheldon is a fast, configurable plugin manager for any shell.

Plugins are declared in a plugins.toml config file, each under a unique local name, and materialized into a plugins.lock file that Sheldon generates. Packages are identified by that local name, which is what every command below takes.

Unlike the other shell plugin managers mpm wraps, Sheldon is a real compiled binary rather than a sourced shell function, so it needs no interpreter wrapper: mpm calls sheldon directly.

Caution

No installed: Sheldon ships no command that prints its plugins. The inventory does exist, in the plugins.toml config file, but reaching it would mean mpm reading and parsing a configuration file instead of calling a CLI, which is not how a manager gathers packages here. The upstream command set is init, add, edit, remove, lock, source, completions and version: none of them lists anything.

Caution

No install: sheldon add requires two values, a unique local name and a source flag naming where the plugin comes from (--github, --git, --gist, --remote or --local). mpm’s install carries a single package id, which cannot supply both, and guessing a source from the id would be inventing a mapping Sheldon never defined. The operation is therefore not implemented rather than faked, and mpm auto-skips it.

Note

No outdated: Sheldon compares nothing against its remotes short of performing the update. upgrade --all still works, and mpm auto-skips the operation.

Documentation: sheldon.

Initialize cli_errors list.

name: str = 'Sheldon'¶

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://sheldon.cli.rs'¶

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

platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({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='debian', name='Debian'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), 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='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), 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='sourcemage', name='Source Mage GNU/Linux'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), 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.6.0'¶

The series carrying the subcommand set this class drives.

0.6.0 is where lock --update settled as the way to refresh every plugin source, split from the source command that generates the shell script.

extra_env: ClassVar = {'NO_COLOR': '1'}¶

Sheldon colors its progress output, which NO_COLOR disables. It also honors a --color flag, but the environment variable covers every invocation without threading a flag through each one.

cli_names: tuple[str, ...] = ('sheldon',)¶

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 = 'sheldon'¶

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.

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

Sheldon declares its version through clap, which prints the crate name and release. The separate sheldon version subcommand prints a longer report, and is not what the probe reads.

$ sheldon --version
sheldon 0.8.2
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.

upgrade_all_cli()[source]¶

Generates the CLI to upgrade all packages.

lock --update re-fetches every plugin source declared in plugins.toml and regenerates the lock file. The sibling --reinstall discards and re-clones each source instead, which is a repair rather than an upgrade, so it is not what this builds.

$ sheldon lock --update
Return type:

tuple[str, ...]

remove(package_id)[source]¶

Remove one package.

remove takes the plugin’s unique local name, the same identifier add assigned it in plugins.toml, and drops its entry from that file.

$ sheldon remove zsh-autosuggestions
Return type:

str