pub struct Venv;Expand description
Adapter for standard Python venv projects.
Trait Implementations§
Source§impl PackageManager for Venv
impl PackageManager for Venv
Source§fn detect(&self, path: &Path) -> bool
fn detect(&self, path: &Path) -> bool
Detect a plain-venv project:
requirements.txtmust exist (otherwise it’s probably not a managed venv project)- At least one directory with
pyvenv.cfgmust exist in the repo root uv.lockmust NOT exist (uv adapter takes priority)
uv’s precedence is also enforced centrally in adapters::detect_adapters, which
covers uv projects declared only through [tool.uv] in pyproject.toml.
Source§fn bloat_dirs(&self, path: &Path) -> Vec<BloatDir>
fn bloat_dirs(&self, path: &Path) -> Vec<BloatDir>
Return all venv directories (any folder containing pyvenv.cfg) as bloat dirs.
Source§fn enforce_lockfile(&self, path: &Path, _policy: EnforcePolicy) -> Result<()>
fn enforce_lockfile(&self, path: &Path, _policy: EnforcePolicy) -> Result<()>
Pure inspection: reads requirements.txt and runs nothing, so neither half of
EnforcePolicy applies.
Source§fn restore(&self, path: &Path, timeout: Duration) -> Result<()>
fn restore(&self, path: &Path, timeout: Duration) -> Result<()>
Recreate the environment in .venv — the name used when nothing recorded the
original one. devp restore --last-run knows better and calls
PackageManager::restore_named with the folder name the prune deleted.
Source§fn runtime_tag(&self, path: &Path, dir_name: &str) -> Option<String>
fn runtime_tag(&self, path: &Path, dir_name: &str) -> Option<String>
The interpreter this environment was built with, so a restore can rebuild on it.
Source§fn restore_named(
&self,
path: &Path,
dir_name: &str,
runtime: Option<&str>,
timeout: Duration,
) -> Result<()>
fn restore_named( &self, path: &Path, dir_name: &str, runtime: Option<&str>, timeout: Duration, ) -> Result<()>
Recreate the environment under the folder name it had before the prune, so activate scripts and IDE interpreter paths keep pointing at something real.
Source§fn lockfiles(&self) -> &'static [&'static str]
fn lockfiles(&self) -> &'static [&'static str]
Not a lockfile in the strict sense — requirements.txt pins whatever its author
pinned — but it is the file this adapter verifies and rebuilds from, which is what
the caller wants to be told about.
Source§fn drift(&self, path: &Path) -> Vec<DriftReport>
fn drift(&self, path: &Path) -> Vec<DriftReport>
The comparison enforce_lockfile refuses on, as data: per venv, the installed
distributions unreachable from anything requirements.txt pins.
Auto Trait Implementations§
impl Freeze for Venv
impl RefUnwindSafe for Venv
impl Send for Venv
impl Sync for Venv
impl Unpin for Venv
impl UnsafeUnpin for Venv
impl UnwindSafe for Venv
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> 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