Skip to content

langpkg

Manages one language-ecosystem package per declaration via pip, npm, or gem — distinct from the OS-level package module. Idempotent: re-applying an unchanged declaration reports no change.

Category: Files & VCS

States

StateMeaning
presentThe package is installed. With version set, exactly that version must be installed; otherwise any installed version satisfies.
absentThe package is not installed; an installed package is removed.

Parameters

ParameterTypeRequiredDescription
namestringyesPackage name (npm scoped names like @types/node are accepted).
managerstringyesLanguage toolchain: pip, npm, or gem. No cross-ecosystem auto-detect.
versionstringStrict-equality version pin (state present only). Unset means any installed version satisfies. Invalid with absent.

Examples

Pin a Python package version

langpkg:
  gunicorn-pin:
    state: present
    name: gunicorn
    manager: pip
    version: "21.2.0"

Install a global npm tool, remove a gem

langpkg:
  pm2:
    state: present
    name: pm2
    manager: npm
  old-bundler:
    state: absent
    name: bundler
    manager: gem

Notes

  • Module maturity: experimental.
  • Installs are system-wide / global only (pip install, npm install -g, gem install).
  • Version matching is strict-equality; semver ranges and constraints are out of scope.
  • Out of scope: per-user / per-project installs, lockfile-driven installs, PEP-668 --break-system-packages, manager-option pass-through, and additional ecosystems (cargo, composer, mvn/gradle, go install).