pythonfinder.models.mixins module¶
- class pythonfinder.models.mixins.PathEntry(**data)[source]¶
Bases:
BaseModel
- class Config[source]¶
Bases:
object
- allow_mutation = True¶
- arbitrary_types_allowed = True¶
- include_private_attributes = True¶
- validate_assignment = True¶
- property as_python: PythonVersion¶
- children_ref: Optional[Any]¶
- classmethod create(path, is_root=False, only_python=False, pythons=None, name=None)[source]¶
Helper method for creating new
pythonfinder.models.PathEntry
instances.- Parameters
path (str) – Path to the specified location.
is_root (bool) – Whether this is a root from the environment PATH variable, defaults to False
only_python (bool) – Whether to search only for python executables, defaults to False
pythons (dict) – A dictionary of existing python objects (usually from a finder), defaults to None
name (str) – Name of the python version, e.g.
anaconda3-5.3.0
- Return type
- Returns
A new instance of the class.
- find_all_python_versions(major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None)[source]¶
Search for a specific python version on the path. Return all copies
- Parameters
major (int) – Major python version to search for.
minor (int) – Minor python version to search for, defaults to None
patch (int) – Patch python version to search for, defaults to None
pre (bool) – Search for prereleases (default None) - prioritize releases if None
dev (bool) – Search for devreleases (default None) - prioritize releases if None
arch (str) – Architecture to include, e.g. ‘64bit’, defaults to None
name (str) – The name of a python version, e.g.
anaconda3-5.3.0
- Return type
- Returns
A list of
PathEntry
instances matching the version requested.
- find_python_version(major=None, minor=None, patch=None, pre=None, dev=None, arch=None, name=None)[source]¶
Search or self for the specified Python version and return the first match.
- Parameters
major (int) – Major version number.
minor (int) – Minor python version to search for, defaults to None
patch (int) – Patch python version to search for, defaults to None
pre (bool) – Search for prereleases (default None) - prioritize releases if None
dev (bool) – Search for devreleases (default None) - prioritize releases if None
arch (str) – Architecture to include, e.g. ‘64bit’, defaults to None
name (str) – The name of a python version, e.g.
anaconda3-5.3.0
- Return type
PathEntry | None
- Returns
A
PathEntry
instance matching the version requested.
- is_dir_ref: Optional[bool]¶
- is_executable_ref: Optional[bool]¶
- is_python_ref: Optional[bool]¶
- is_root: bool¶
- name: Optional[str]¶
- only_python: Optional[bool]¶
- path: Optional[Path]¶
- property py_version: PythonVersion | None¶
- py_version_ref: Optional[Any]¶
- pythons_ref: Optional[Dict[Any, Any]]¶