pub struct PythonInterpreter {
    pub config: InterpreterConfig,
    pub executable: PathBuf,
    pub platform: Option<String>,
    pub runnable: bool,
    pub implmentation_name: String,
    pub soabi: Option<String>,
}
Expand description

The location and version of an interpreter

Fields

config: InterpreterConfig

Python’s sysconfig Python’s major version

executable: PathBuf

Path to the python interpreter, e.g. /usr/bin/python3.6

Just the name of the binary in PATH does also work, e.g. python3.5

platform: Option<String>

Comes from sysconfig.get_platform()

Note that this can be None when cross compiling

runnable: bool

Is this interpreter runnable

When cross compile the target interpreter isn’t runnable, and it’s executable is empty

implmentation_name: String

Comes from sys.platform.name

soabi: Option<String>

Comes from sysconfig var SOABI

Implementations

Does this interpreter have PEP 384 stable api aka. abi3 support?

Returns the supported python environment in the PEP 425 format used for the wheel filename: {python tag}-{abi tag}-{platform tag}

Don’t ask me why or how, this is just what setuptools uses so I’m also going to use

If abi3 is true, cpython wheels use the generic abi3 with the given version as minimum

Adds the ext_suffix we read from python or know (.pyd/.abi3.so) and adds it to the base name

For CPython, generate extensions as follows:

For python 3, there is PEP 3149, but that is only valid for 3.2 - 3.4. Since only 3.6+ is supported, the templates are adapted from the (also incorrect) release notes of CPython 3.5: https://docs.python.org/3/whatsnew/3.5.html#build-and-c-api-changes

Examples for 64-bit on CPython 3.6m: Linux: foobar.cpython-36m-x86_64-linux-gnu.so Windows: foobar.cp36-win_amd64.pyd Mac: foobar.cpython-36m-darwin.so FreeBSD: foobar.cpython-36m.so

For pypy3, we read importlib.machinery.EXTENSION_SUFFIXES[0].

Checks whether the given command is a python interpreter and returns a PythonInterpreter if that is the case

Construct a PythonInterpreter from a sysconfig and target

Find all available python interpreters for a given target

Tries to find all installed python versions using the heuristic for the given platform

Checks that given list of executables are all valid python interpreters, determines the abiflags and versions of those interpreters and returns them as PythonInterpreter

Run a python script using this Python interpreter.

Whether this Python interpreter support portable manylinux/musllinux wheels

Returns true if we can not decide

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The resulting type after dereferencing.
Dereferences the value.
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
The number of items that this chain link consists of.
Append the elements in this link to the chain.
An iterator over the items within this container, by value.
Iterate over the elements of the container (using internal iteration because GATs are unstable).
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more