meta_package_manager.managers.miktex module¶

class meta_package_manager.managers.miktex.MiKTeX[source]¶

Bases: PackageManager

TeX package manager of the MiKTeX distribution.

Reaches MiKTeX’s own package repositories, which are distinct from the catalog tlmgr reaches for TeX Live: two distributions, two managers, rather than one wrapped twice.

Note

Linux and Windows only, and that follows the tool rather than a choice. The packages command arrived in MiKTeX 22.3, while the newest macOS build MiKTeX publishes is 22.1, which predates it. The only package surface on macOS is the standalone binary that happens to share this project’s name, which is reason enough never to reach for it.

Caution

--admin is deliberately never passed, and the reasoning inverts what its name suggests. Left alone, MiKTeX reports the packages installed for the user and those installed system-wide; the flag narrows that to the system-wide ones alone. The default is therefore already the wider listing, and passing it would drop rows rather than pin them. It is fatal outright on an installation that is not shared, and warns about privileges it may lack when run without them. The cost is that removing a system-wide package is out of reach, needing both that flag and administrator rights.

Important

Queries pass --disable-installer. MiKTeX installs packages on the fly by default, so without it reading the inventory is not guaranteed to leave the system as it found it.

Note

No outdated, though MiKTeX does have a non-mutating check: it prints bare package names and no version of any kind, where reporting something as outdated needs a version to report it against. The only route to one is asking after each package individually, thousands of invocations for a single answer. upgrade --all is unaffected.

No search, MiKTeX having no such command, and no cleanup: nothing in the package surface purges a cache or sweeps orphans.

Warning

The command that upgrades everything is update. MiKTeX’s upgrade is a different thing entirely, taking a package level such as basic or complete and erroring without one, so it is never used here.

Documentation: MiKTeX packages.

Initialize cli_errors list.

name: str = 'MiKTeX'¶

Return package manager’s common name.

Default value is based on class name.

homepage_url: str | None = 'https://miktex.org'¶

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

Slug of the brand mark standing for this manager in the documentation.

Names an SVG vendored under docs/assets/managers/, whose provenance and license are recorded in docs/assets/managers/logos.yaml. Inlined at the top of the manager’s page by meta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.

Several managers legitimately share one slug, either because they wrap the same upstream (brew and cask) or because the tool has no mark of its own and its ecosystem’s stands in (apt under Debian’s swirl, cargo under Rust’s gear). Documentation-only, like homepage_url: no CLI output reads it.

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

The release that introduced the packages command this drives.

version_regexes: tuple[str, ...] = ('\\(MiKTeX (?P<version>\\d+(?:\\.\\d+)*)',)¶

Search the release named in parentheses.

$ miktex --version
One MiKTeX Utility 1.12.0 (MiKTeX 26.5)

Two numbers share that line: the utility’s own version first, then the MiKTeX release, which is the one that means anything here. The parenthesis is what tells them apart. A word such as the build’s word size may follow the release, which the pattern stops before.

property installed: Iterator[Package]¶

Fetch installed packages.

$ miktex --disable-installer packages list --template "{isInstalled} {id} {version}"
true amsmath 2.17n
false zwpagelayout
true fancyhdr 4.0.3
install(package_id, version=None)[source]¶

Install one package.

$ miktex packages install fancyhdr
Return type:

str

Caution

MiKTeX fails outright when the package is already installed, rather than treating it as a no-op.

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

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

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.

upgrade_all_cli()[source]¶

Generates the CLI to upgrade all packages.

$ miktex packages update
Return type:

tuple[str, ...]

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_one_cli(package_id, version=None)[source]¶

Generates the CLI to upgrade the package provided as parameter.

Naming packages genuinely restricts the run to them, the rest being reported as already up to date.

$ miktex packages update fancyhdr
Return type:

tuple[str, ...]

remove(package_id)[source]¶

Removes a package.

$ miktex packages remove fancyhdr
Return type:

str

Caution

MiKTeX fails outright when the package is not installed.

sync()[source]¶

Sync package metadata.

$ miktex packages update-package-database
Return type:

None