meta_package_manager.managers.sdkman module¶
- class meta_package_manager.managers.sdkman.SDKMAN[source]¶
Bases:
PackageManagerSDKMAN! manages parallel versions of multiple Software Development Kits on Unix-based systems.
Note
SDKMAN! primarily serves the JVM ecosystem: Java, Gradle, Maven, Kotlin, Scala, and ~115 other candidates. Each candidate is treated as a package.
Caution
The
sdkcommand is a shell function, not a standalone binary, so mpm detects SDKMAN by its init script (sdkman-init.sh) rather than a binary onPATHand wraps every invocation inbash -c 'source <init> && sdk <args>'.Note
SDKMAN has no read-only “outdated” verb, so
outdatedpipesnintosdk upgradeto capture the candidate list without applying any upgrade.Initialize
cli_errorslist.- homepage_url: str | None = 'https://sdkman.io'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'openjdk'¶
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='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
frozensetofPlatforminstances at instantiation.
- requirement: str | None = '>=5.0.0'¶
Version requirement specifier.
Supports a comma-separated range of constraints (e.g.
">=1.20.0,<2.0.0"). A bare version string like"1.20.0"is treated as>=1.20.0.Parsed by
meta_package_manager.version.VersionRange.Defaults to
None, which deactivates version check entirely.
- cli_names: tuple[str, ...] = ('sdkman-init.sh',)¶
Detect SDKMAN by the presence of its init script.
- cli_search_path: tuple[str, ...] = ('/home/runner/.sdkman/bin',)¶
List of additional path to help mpm hunt down the package manager CLI.
Must be a list of strings whose order dictates the search sequence.
Most of the time unnecessary:
meta_package_manager.execution.CLIExecutor.cli_pathworks well on all platforms.
- extra_env: ClassVar = {'sdkman_auto_answer': 'true', 'sdkman_colour_enable': 'false'}¶
Disable ANSI colors and auto-accept interactive prompts.
- version_cli_options: tuple[str, ...] = ('version',)¶
CLI options used to produce the version of the package manager.
The raw output produced by the package manager CLI will be parsed with the
version_regexesbelow to extract the version number.
- version_regexes: tuple[str, ...] = ('script:\\s+(?P<version>\\S+)',)¶
$ sdk version SDKMAN! script: 5.18.2 native: 0.4.6
- build_cli(*args, **kwargs)[source]¶
Wrap all CLI invocations to source the SDKMAN init script in bash.
Note
The
**kwargsaccepted by the base class (auto_pre_args,sudo, etc.) are accepted but ignored because every invocation goes through thebash -cwrapper and SDKMAN never requires elevated privileges.
- property installed: Iterator[Package]¶
Fetch installed packages.
$ sdk current Using: groovy: 4.0.22 java: 21.0.4-tem scala: 3.4.2
- property outdated: Iterator[Package]¶
Fetch outdated packages.
$ echo n | sdk upgrade Available defaults: gradle (local: 2.3, 1.11; default: 8.9) java (local: 21.0.4-tem; default: 25.0.2-tem) Use prescribed default version(s)? (Y/n):
Note
Pipes
ntosdk upgradeto obtain the outdated list without actually performing the upgrade. Overridessdkman_auto_answertofalseso the command prints the candidate list before prompting.
- install(package_id, version=None)[source]¶
Install one package.
$ sdk install java 21.0.4-tem
- Return type:
- id: str = 'sdkman'¶
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.
- name: str = 'SDKMAN'¶
Return package manager’s common name.
Default value is based on class name.
- upgrade_one_cli(package_id, version=None)[source]¶
Generates the CLI to upgrade one package.
$ sdk upgrade java
- 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.
- remove(package_id)[source]¶
Remove one package.
SDKMAN’s
uninstallcommand requires both the candidate and a specific version. The currently installed version is looked up frominstalled()and passed to the CLI.$ sdk uninstall java 21.0.4-tem
- Return type: