py-discovery
#
py-discovery
aims to abstract away discovering Python interpreters on a user machine.
API#
- py_discovery.__version__ = '0.1.dev2+ged06613'#
version of the package
Python discovery.
- class py_discovery.PythonInfo[source]#
Bases:
object
Contains information for a Python interpreter.
- property version_str#
- property version_release_str#
- property python_name#
- property is_old_virtualenv#
- property is_venv#
- property system_include#
- property system_prefix#
- property system_exec_prefix#
- property spec#
- satisfies(spec, impl_must_match)[source]#
Check if a given specification can be satisfied by the python interpreter instance.
- Return type:
- classmethod current()[source]#
Locate the current host interpreter information.
This might be different than what we run into in case the host python has been upgraded from underneath us.
- Return type:
- classmethod current_system()[source]#
Locate the current host interpreter information.
This might be different than what we run into in case the host python has been upgraded from underneath us.
- Return type:
- classmethod from_exe(exe, *, raise_on_error=True, resolve_to_host=True, env=None)[source]#
Given a path to an executable, get the python information.
- Return type:
- class py_discovery.VersionInfo(major, minor, micro, releaselevel, serial)#
Bases:
tuple
Create new instance of VersionInfo(major, minor, micro, releaselevel, serial)
- major#
Alias for field number 0
- micro#
Alias for field number 2
- minor#
Alias for field number 1
- releaselevel#
Alias for field number 3
- serial#
Alias for field number 4
- class py_discovery.PythonSpec(str_spec, implementation, major, minor, micro, architecture, path)[source]#
Bases:
object
Contains specification about a Python Interpreter.
- property is_abs#
- class py_discovery.Discover(options)[source]#
Bases:
object
Discover and provide the requested Python interpreter.
Create a new discovery mechanism.
- Parameters:
options (
Namespace
) – The parsed options as defined within theadd_parser_arguments()
.
- classmethod add_parser_arguments(parser)[source]#
Add CLI arguments for this discovery mechanisms.
- Parameters:
parser (
ArgumentParser
) – The CLI parser.- Return type:
- class py_discovery.Builtin(options)[source]#
Bases:
Discover
Create a new discovery mechanism.
- Parameters:
options (
Namespace
) – The parsed options as defined within theadd_parser_arguments()
.
- classmethod add_parser_arguments(parser)[source]#
Add CLI arguments for this discovery mechanisms.
- Parameters:
parser (
ArgumentParser
) – The CLI parser.- Return type:
- class py_discovery.PathPythonInfo[source]#
Bases:
PythonInfo
python info from a path.