meta_package_manager.managers.pnpm module¶
- class meta_package_manager.managers.pnpm.PNPM[source]¶
Bases:
PackageManagerA Node.js package manager with a content-addressable global store.
Like
meta_package_manager.managers.npm.NPM, mpm drives pnpm in global mode (--globalon every operation) and parses its--jsonoutput. Command equivalences with the sibling JS managers are listed in antfu-collective/ni.Note
pnpm enforces a supply-chain cooldown through its
minimumReleaseAgesetting (counted in minutes), refusing to install any release published more recently than the configured age. The version floor is set bysearch, which first shipped in11.0.0; that release also clears the earlierminimumReleaseAgefloor, so one requirement guards every advertised operation.Caution
pnpm outdatedexits1when it finds outdated packages, printing the report to<stdout>with an empty<stderr>. The query passesmust_succeedso this benign non-zero exit is tolerated instead of raising.Initialize
cli_errorslist.- name: str = 'Node pnpm'¶
Return package manager’s common name.
Default value is based on class name.
- homepage_url: str | None = 'https://pnpm.io'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'pnpm'¶
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 indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_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 (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- 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
frozensetofPlatforminstances at instantiation.
- requirement: str | None = '>=11.0.0'¶
11.0.0 is the first version to ship the
searchsubcommand. It also clears the10.16.0floor ofminimumReleaseAge, the release-age gate mpm drives for the supply-chain cooldown (seecooldown_env_var), so a single floor covers every advertised operation. Older pnpm releases either lacksearchor silently ignore the cooldown setting.
- cooldown_env_var: ClassVar[str | None] = 'pnpm_config_minimum_release_age'¶
pnpm honors a release-age cooldown through its
minimumReleaseAgesetting.pnpm reads any setting from an environment variable built by snake-casing the setting name behind a
pnpm_config_prefix (the docs renderpmOnFailaspnpm_config_pm_on_fail), sopnpm_config_minimum_release_agesetsminimumReleaseAgewithout touchingpnpm-workspace.yaml. Once set, pnpm refuses to install any version published more recently than the configured age, across direct and transitive dependencies.minimumReleaseAgeis expressed in minutes, socooldown_env_value()is overridden to emit a minute count.See pnpm’s minimumReleaseAge setting.
- cooldown_env_value()[source]¶
Render
meta_package_manager.execution.CLIExecutor.cooldownas an integer minute count for pnpm’sminimumReleaseAge.Sub-minute cooldowns round up so the gate over-protects rather than silently collapsing to
0(the “no cooldown” sentinel).- Return type:
- property installed: Iterator[Package]¶
Fetch installed packages.
pnpm list --jsonreturns an array of project objects; the global scope resolves to a single one whosedependenciesmap holds the installed packages.$ pnpm list --global --json --depth 0 [ { "name": "global", "dependencies": { "eslint": { "from": "eslint", "version": "9.15.0" }, "typescript": { "from": "typescript", "version": "5.6.3" } } } ]
- property outdated: Iterator[Package]¶
Fetch outdated packages.
pnpm outdatedexits with code1when it finds outdated packages, but writes the report to<stdout>and leaves<stderr>empty. Passingmust_succeedkeeps the lenient failure gate that tolerates a non-zero exit with an empty<stderr>as a benign status code, so the call does not raise (seemeta_package_manager.execution.CLIExecutor.run()).$ pnpm outdated --global --json { "eslint": { "current": "9.10.0", "latest": "9.15.0", "wanted": "9.15.0", "isDeprecated": false, "dependencyType": "dependencies" } }
- search(query, extended, exact)[source]¶
Fetch matching packages.
pnpm queries the registry’s
/-/v1/searchendpoint and, with--json, emits an array of the matched packages (an empty[]when none match).Caution
Search does not support exact matching: the registry endpoint matches on names, descriptions and keywords, so the framework refilters the raw results for exact queries.
$ pnpm search --json is-positive [ { "name": "is-positive", "version": "3.1.0", "description": "Check if something is a positive number", "date": "2017-10-24T15:24:08.180Z", "maintainers": [ { "username": "sindresorhus" } ] } ]
- install(package_id, version=None)[source]¶
Install one package.
$ pnpm add --global markdown
- Return type:
- upgrade_all_cli()[source]¶
Generates the CLI to upgrade all packages.
$ pnpm update --global --latest
- upgrade_one_cli(package_id, version=None)[source]¶
Generates the CLI to upgrade the package provided as parameter.
$ pnpm update --global --latest markdown
- cli_names: tuple[str, ...] = ('pnpm',)¶
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
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- id: str = 'pnpm'¶
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.