The venv-retarget Python API
Commonly-used functions
venv_retarget.detect_path(cfg, venvdir, *, use_prefix=False)
Examine a virtual environment, determine the path it thinks it is at.
Source code in src/venv_retarget/detect.py
venv_retarget.retarget(cfg, venvdir, *, venvsrc=None, venvdst=None)
Modify the files within the virtual environment to prepare it for moving.
Source code in src/venv_retarget/impl.py
Commonly-used data structures
venv_retarget.defs.Config
dataclass
Runtime configuration for the venv-retarget library.
Source code in src/venv_retarget/defs.py
log: logging.Logger
instance-attribute
The logger to send diagnostic, informational, and error messages to.
verbose: bool
instance-attribute
Verbose operation; display diagnostic output.
Errors
venv_retarget.defs.Error
dataclass
Bases: Exception
An error that occurred while examining or processing a virtual environment.
Source code in src/venv_retarget/defs.py
venvdir: pathlib.Path
instance-attribute
The virtual environment that we tried to examine or process.
venv_retarget.detect.DetectError
dataclass
Bases: Error
An error that occurred while examining a virtual environment.
Source code in src/venv_retarget/detect.py
venv_retarget.detect.NoPathsError
dataclass
Bases: DetectError
The virtual environment does not seem to know where it is at.
Source code in src/venv_retarget/detect.py
venv_retarget.detect.ConflictingPathsError
dataclass
Bases: DetectError
The virtual environment seems to be confused about where it is at.
Source code in src/venv_retarget/detect.py
paths: list[pathlib.Path]
instance-attribute
The paths that the virtual environment thinks it is at, at the same time.
__str__()
Provide a human-readable description of the error.
venv_retarget.impl.ProcessError
dataclass
Bases: Error
An error that occurred while processing the virtual environment.
Source code in src/venv_retarget/impl.py
venv_retarget.impl.SameSrcDstError
dataclass
Bases: ProcessError
Neither a from- nor a to-path was specified.
Source code in src/venv_retarget/impl.py
src: pathlib.Path
instance-attribute
The source that appears to be the same as the destination.
__str__()
venv_retarget.impl.NotAbsolutePathError
dataclass
Bases: ProcessError
The source and destination paths must be absolute.
Source code in src/venv_retarget/impl.py
path: pathlib.Path
instance-attribute
The non-absolute path that was specified.
Miscellaneous
venv_retarget.defs.VERSION: Final = '0.1.0'
module-attribute
The venv-retarget library version, semver-like.
venv_retarget.detect.detect_python_properties(cfg, venvdir)
cached
Query the virtual environment's Python interpreter for its settings.