@@ -245,7 +245,11 @@ def _try_posix_fallback_executable(self, base_executable: str) -> str | None:
245245 return None # in this case we just can't tell easily without poking around FS and calling them, bail
246246
247247 def install_path (self , key : str ) -> str :
248- """Return the relative installation path for a given installation scheme *key*."""
248+ """
249+ Return the relative installation path for a given installation scheme *key*.
250+
251+ :param key: sysconfig installation scheme key (e.g. ``"scripts"``, ``"purelib"``).
252+ """
249253 result = self .distutils_install .get (key )
250254 if result is None : # pragma: >=3.11 cover # distutils is empty when "venv" scheme is available
251255 # set prefixes to empty => result is relative from cwd
@@ -308,7 +312,13 @@ def is_venv(self) -> bool:
308312 return self .base_prefix is not None
309313
310314 def sysconfig_path (self , key : str , config_var : dict [str , str ] | None = None , sep : str = os .sep ) -> str :
311- """Return the sysconfig install path for a scheme *key*, optionally substituting config variables."""
315+ """
316+ Return the sysconfig install path for a scheme *key*, optionally substituting config variables.
317+
318+ :param key: sysconfig path key (e.g. ``"purelib"``, ``"include"``).
319+ :param config_var: replacement mapping for sysconfig variables; when ``None`` uses the interpreter's own values.
320+ :param sep: path separator to use in the result.
321+ """
312322 pattern = self .sysconfig_paths .get (key )
313323 if pattern is None :
314324 return ""
@@ -406,14 +416,23 @@ def spec(self) -> str:
406416
407417 @classmethod
408418 def clear_cache (cls , cache : PyInfoCache ) -> None :
409- """Clear all cached interpreter information from *cache*."""
419+ """
420+ Clear all cached interpreter information from *cache*.
421+
422+ :param cache: the cache store to clear.
423+ """
410424 from ._cached_py_info import clear # noqa: PLC0415
411425
412426 clear (cache )
413427 cls ._cache_exe_discovery .clear ()
414428
415429 def satisfies (self , spec : PythonSpec , * , impl_must_match : bool ) -> bool : # noqa: PLR0911
416- """Check if a given specification can be satisfied by this python interpreter instance."""
430+ """
431+ Check if a given specification can be satisfied by this python interpreter instance.
432+
433+ :param spec: the specification to check against.
434+ :param impl_must_match: when ``True``, the implementation name must match exactly.
435+ """
417436 if spec .path and not self ._satisfies_path (spec ):
418437 return False
419438 if impl_must_match and not self ._satisfies_implementation (spec ):
@@ -462,7 +481,11 @@ def _satisfies_version_specifier(self, spec: PythonSpec) -> bool:
462481
463482 @classmethod
464483 def current (cls , cache : PyInfoCache | None = None ) -> PythonInfo :
465- """Locate the current host interpreter information."""
484+ """
485+ Locate the current host interpreter information.
486+
487+ :param cache: interpreter metadata cache; when ``None`` results are not cached.
488+ """
466489 if cls ._current is None :
467490 result = cls .from_exe (sys .executable , cache , raise_on_error = True , resolve_to_host = False )
468491 if result is None :
@@ -473,7 +496,11 @@ def current(cls, cache: PyInfoCache | None = None) -> PythonInfo:
473496
474497 @classmethod
475498 def current_system (cls , cache : PyInfoCache | None = None ) -> PythonInfo :
476- """Locate the current system interpreter information, resolving through any virtualenv layers."""
499+ """
500+ Locate the current system interpreter information, resolving through any virtualenv layers.
501+
502+ :param cache: interpreter metadata cache; when ``None`` results are not cached.
503+ """
477504 if cls ._current_system is None :
478505 result = cls .from_exe (sys .executable , cache , raise_on_error = True , resolve_to_host = True )
479506 if result is None :
@@ -504,7 +531,16 @@ def from_exe( # noqa: PLR0913
504531 resolve_to_host : bool = True ,
505532 env : Mapping [str , str ] | None = None ,
506533 ) -> PythonInfo | None :
507- """Get the python information for a given executable path."""
534+ """
535+ Get the python information for a given executable path.
536+
537+ :param exe: path to the Python executable.
538+ :param cache: interpreter metadata cache; when ``None`` results are not cached.
539+ :param raise_on_error: raise on failure instead of returning ``None``.
540+ :param ignore_cache: bypass the cache and re-query the interpreter.
541+ :param resolve_to_host: resolve through virtualenv layers to the system interpreter.
542+ :param env: environment mapping; defaults to :data:`os.environ`.
543+ """
508544 from ._cached_py_info import from_exe # noqa: PLC0415
509545
510546 env = os .environ if env is None else env
@@ -583,7 +619,14 @@ def discover_exe(
583619 exact : bool = True ,
584620 env : Mapping [str , str ] | None = None ,
585621 ) -> PythonInfo :
586- """Discover a matching Python executable under a given *prefix* directory."""
622+ """
623+ Discover a matching Python executable under a given *prefix* directory.
624+
625+ :param cache: interpreter metadata cache.
626+ :param prefix: directory prefix to search under.
627+ :param exact: when ``True``, require an exact version match.
628+ :param env: environment mapping; defaults to :data:`os.environ`.
629+ """
587630 key = prefix , exact
588631 if key in self ._cache_exe_discovery and prefix :
589632 _LOGGER .debug ("discover exe from cache %s - exact %s: %r" , prefix , exact , self ._cache_exe_discovery [key ])
0 commit comments