pub enum PythonVersionSource {
ConfigFile(PythonVersionFileSource),
ScriptMetadata(Span),
PyvenvCfgFile(PythonVersionFileSource),
InstallationDirectoryLayout {
site_packages_parent_dir: Box<str>,
source: Option<PythonVersionFileSource>,
},
Cli,
Editor,
UvWorkspace,
Default,
}Expand description
The source of the Python version.
Variants§
ConfigFile(PythonVersionFileSource)
Value loaded from a project’s configuration file.
ScriptMetadata(Span)
Value configured in a standalone script’s inline metadata.
PyvenvCfgFile(PythonVersionFileSource)
Value loaded from the pyvenv.cfg file of the virtual environment.
The virtual environment might have been configured, activated or inferred.
InstallationDirectoryLayout
Value inferred from the layout of the Python installation.
This only ever applies on Unix. On Unix, the site-packages directory
will always be at sys.prefix/lib/pythonX.Y/site-packages,
so we can infer the Python version from the parent directory of site-packages.
Cli
The value comes from a CLI argument, while it’s left open if specified using a short argument,
long argument (--extra-paths) or --config key=value.
Editor
The value comes from the user’s editor, while it’s left open if specified as a setting or if the value was auto-discovered by the editor (e.g., the Python environment)
UvWorkspace
The value was provided by uv workspace metadata.
Default
We fell back to a default value because the value was not specified via the CLI or a config file.
Trait Implementations§
Source§impl Clone for PythonVersionSource
impl Clone for PythonVersionSource
Source§fn clone(&self) -> PythonVersionSource
fn clone(&self) -> PythonVersionSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PythonVersionSource
impl Debug for PythonVersionSource
Source§impl Default for PythonVersionSource
impl Default for PythonVersionSource
Source§fn default() -> PythonVersionSource
fn default() -> PythonVersionSource
impl Eq for PythonVersionSource
Source§impl GetSize for PythonVersionSource
impl GetSize for PythonVersionSource
Source§fn get_heap_size(&self) -> usize
fn get_heap_size(&self) -> usize
Source§fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>(
&self,
tracker: TRACKER,
) -> (usize, TRACKER)
fn get_heap_size_with_tracker<TRACKER: GetSizeTracker>( &self, tracker: TRACKER, ) -> (usize, TRACKER)
tracker. Read moreSource§fn get_stack_size() -> usize
fn get_stack_size() -> usize
Source§fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
fn get_size_with_tracker<T>(&self, tracker: T) -> (usize, T)where
T: GetSizeTracker,
tracker. Read moreSource§impl Hash for PythonVersionSource
impl Hash for PythonVersionSource
Source§impl PartialEq for PythonVersionSource
impl PartialEq for PythonVersionSource
impl StructuralPartialEq for PythonVersionSource
Auto Trait Implementations§
impl Freeze for PythonVersionSource
impl RefUnwindSafe for PythonVersionSource
impl Send for PythonVersionSource
impl Sync for PythonVersionSource
impl Unpin for PythonVersionSource
impl UnsafeUnpin for PythonVersionSource
impl UnwindSafe for PythonVersionSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> HashEqLike<&T> for T
impl<T> HashEqLike<&T> for T
Source§impl<T> HashEqLike<Cow<'_, T>> for T
impl<T> HashEqLike<Cow<'_, T>> for T
Source§impl<T> HashEqLike<T> for T
impl<T> HashEqLike<T> for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more