runway.dependency_managers package¶
Classes for interacting with dependency managers using subprocesses.
- class runway.dependency_managers.Pip[source]¶
Bases:
DependencyManager
pip CLI interface.
- classmethod dir_is_project(directory: StrPath, **kwargs: Any) bool [source]¶
Determine if the directory contains a project for this dependency manager.
- Parameters:
directory – Directory to check.
**kwargs – Arbitrary keyword arguments.
- classmethod generate_command(command: list[str] | str, **kwargs: bool | Iterable[str] | str | None) list[str] [source]¶
Generate command to be executed and log it.
- Parameters:
command – Command to run.
args – Additional args to pass to the command.
**kwargs – Arbitrary keyword arguments.
- Returns:
The full command to be passed into a subprocess.
- classmethod generate_install_command(*, cache_dir: StrPath | None = None, no_cache_dir: bool = False, no_deps: bool = False, requirements: StrPath, target: StrPath) list[str] [source]¶
Generate the command that when run will install dependencies.
This method is exposed to easily format the command to be run by with a subprocess or within a Docker container.
- Parameters:
cache_dir – Store the cache data in the provided directory.
no_cache_dir – Disable the cache.
no_deps – Don’t install package dependencies.
requirements – Path to a
requirements.txt
file.target – Path to a directory where dependencies will be installed.
- install(*, cache_dir: StrPath | None = None, extend_args: list[str] | None = None, no_cache_dir: bool = False, no_deps: bool = False, requirements: StrPath, target: StrPath) Path [source]¶
Install dependencies to a target directory.
- Parameters:
cache_dir – Store the cache data in the provided directory.
extend_args – Optional list of extra arguments to pass to
pip install
. This value will not be parsed or sanitized in any way - it will be used as is. It is the user’s responsibility to ensure that there are no overlapping arguments between this list and the arguments that are automatically generated.no_cache_dir – Disable the cache.
no_deps – Don’t install package dependencies.
requirements – Path to a
requirements.txt
file.target – Path to a directory where dependencies will be installed.
- Raises:
PipInstallFailedError – The subprocess used to run the commend exited with an error.
- property python_version: Version¶
Python version where pip is installed (
<major>.<minor>
only).
- property version: Version¶
pip version.
- exception runway.dependency_managers.PipInstallFailedError[source]¶
Bases:
RunwayError
Pip install failed.
- class runway.dependency_managers.Pipenv[source]¶
Bases:
DependencyManager
Pipenv dependency manager.
- CONFIG_FILES: ClassVar[tuple[str, ...]] = ('Pipfile', 'Pipfile.lock')¶
Configuration files used by pipenv.
- classmethod dir_is_project(directory: StrPath, **_Pipenv__kwargs: Any) bool [source]¶
Determine if the directory contains a project for this dependency manager.
- Parameters:
directory – Directory to check.
- export(*, dev: bool = False, output: StrPath) Path [source]¶
Export the lock file to other formats (requirements.txt only).
The underlying command being executed by this method is
pipenv requirements
.- Parameters:
dev – Include development dependencies.
output – Path to the output file.
- property version: Version¶
pipenv version.
- exception runway.dependency_managers.PipenvExportFailedError[source]¶
Bases:
RunwayError
Pipenv export failed to produce a
requirements.txt
file.
- exception runway.dependency_managers.PipenvNotFoundError[source]¶
Bases:
RunwayError
Pipenv not installed or found in $PATH.
- class runway.dependency_managers.Poetry[source]¶
Bases:
DependencyManager
Poetry dependency manager.
- CONFIG_FILES: ClassVar[tuple[str, ...]] = ('poetry.lock', 'pyproject.toml')¶
Configuration files used by poetry.
- classmethod dir_is_project(directory: StrPath, **_Poetry__kwargs: Any) bool [source]¶
Determine if the directory contains a project for this dependency manager.
- Parameters:
directory – Directory to check.
- export(*, dev: bool = False, extras: list[str] | None = None, output: StrPath, output_format: str = 'requirements.txt', with_credentials: bool = True, without_hashes: bool = True) Path [source]¶
Export the lock file to other formats.
- Parameters:
dev – Include development dependencies.
extras – Extra sets of dependencies to include.
output – Path to the output file.
output_format – The format to export to.
with_credentials – Include credentials for extra indices.
without_hashes – Exclude hashes from the exported file.
- Returns:
Path to the output file.
- property version: Version¶
poetry version.
- exception runway.dependency_managers.PoetryExportFailedError[source]¶
Bases:
RunwayError
Poetry export failed to produce a
requirements.txt
file.
- exception runway.dependency_managers.PoetryNotFoundError[source]¶
Bases:
RunwayError
Poetry not installed or found in $PATH.