all2md.utils.packages
Utility functions to checking installed packages.
- all2md.utils.packages.get_package_version(package_name: str) str | None
Get the installed version of a package.
- Parameters:
package_name (str) – Name of the package
- Returns:
Version string if package installed, None otherwise
- Return type:
str or None
- all2md.utils.packages.check_version_requirement(package_name: str, version_spec: str) Tuple[bool, str | None]
Check if installed package meets version requirement.
- Parameters:
package_name (str) – Name of the package
version_spec (str) – Version specification (e.g., “>=1.24.0”)
- Returns:
(meets_requirement, installed_version)
- Return type:
tuple
Notes
Results are memoized on
(package_name, version_spec). A package’s installed version and the parsedSpecifierSetare stable for the life of the process, so therequires_dependenciesdecorator can call this on every parse/render without re-runningimportlib.metadata.versionor re-parsing the specifier.