hbutils.system.python.version
Python version inspection utilities.
This module provides a lightweight helper for retrieving the current Python
interpreter version as a packaging.version.Version instance. The
returned object offers rich comparison semantics, making it suitable for
version checks and conditional logic in system-dependent workflows.
The module contains the following main components:
python_version()- Retrieve the interpreter version as apackaging.version.Versionobject.
Example:
>>> from hbutils.system.python.version import python_version
>>> ver = python_version()
>>> ver >= Version("3.8")
True
Note
This module relies on platform to query the interpreter version and
uses packaging.version.Version for standardized parsing.
__all__
- hbutils.system.python.version.__all__ = ['python_version']
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
python_version
- hbutils.system.python.version.python_version() Version[source]
Retrieve the current Python interpreter version.
This function queries the running Python interpreter using
platform.python_version()and returns a parsedpackaging.version.Versioninstance. The returned object can be compared directly with other version strings orVersioninstances.- Returns:
The current Python interpreter version.
- Return type:
Version
Example:
>>> from hbutils.system.python.version import python_version >>> python_version() Version('...')