pythonfinder.utils module¶
- pythonfinder.utils.dedup(iterable)[source]¶
Deduplicate an iterable object like iter(set(iterable)) but order-reserved.
- Return type
- pythonfinder.utils.ensure_path(path)[source]¶
Given a path (either a string or a Path object), expand variables and return a Path object.
- pythonfinder.utils.expand_paths(path, only_python=True)[source]¶
Recursively expand a list or
PathEntry
instance
- pythonfinder.utils.filter_pythons(path)[source]¶
Return all valid pythons in a given path
- Return type
Iterable | Path
- pythonfinder.utils.get_python_version(path)[source]¶
Get python version string using subprocess from a given path.
- Return type
- pythonfinder.utils.guess_company(path)[source]¶
Given a path to python, guess the company who created it
- pythonfinder.utils.looks_like_python(name)[source]¶
Determine whether the supplied filename looks like a possible name of python.
- pythonfinder.utils.path_is_executable(path)[source]¶
Determine whether the supplied path is executable.
- Return type
- Returns
Whether the provided path is executable.
- pythonfinder.utils.path_is_known_executable(path)[source]¶
Returns whether a given path is a known executable from known executable extensions or has the executable bit toggled.
- pythonfinder.utils.path_is_python(path)[source]¶
Determine whether the supplied path is executable and looks like a possible path to python.
- Parameters
path (
Path
) – The path to an executable.- Return type
- Returns
Whether the provided path is an executable path to python.
- pythonfinder.utils.path_is_pythoncore(path)[source]¶
Given a path, determine whether it appears to be pythoncore.
Does not verify whether the path is in fact a path to python, but simply does an exclusionary check on the possible known python implementations to see if their names are present in the path (fairly dumb check).