1.1.2.1. pmpm.core module#
pmpm core classes.
It should implements the command line of the package manager, as well as its main logic.
- class pmpm.core.CondaOnlyEnvironment(prefix: ~pathlib.Path, file: ~pathlib.Path | None = None, conda_channels: list[str] = <factory>, conda_dependencies: list[str] = <factory>, pip_dependencies: list[str] = <factory>, dependencies: list[str] = <factory>, python_version: str = '3.10', conda_prefix_name: str = '', compile_prefix_name: str = '', download_prefix_name: str = 'git', conda: str = 'mamba', sub_platform: str = '', skip_test: bool = False, skip_conda: bool = False, fast_update: bool = False, install_ipykernel: bool = True, update: bool | None = None, arch: str = 'x86-64-v3', tune: str = 'generic')[source]#
Bases:
InstallEnvironment
Using only the stack provided by conda to compile.
- Parameters:
prefix – the prefix path of the environment.
file – the YAML file of the environment definition.
conda_channels – conda channels for packages to be searched in.
conda_dependencies – dependencies install via conda.
pip_dependencies – dependencies install via pip.
dependencies – dependencies install via pmpm.
python_version – Python version to be installed.
conda_prefix_name – the subdirectory within prefix for conda.
compile_prefix_name – the subdirectory within prefix for compiled packages from dependencies.
download_prefix_name – the subdirectory within prefix for downloaded source codes from dependencies.
conda – executable name for conda solver, can be mamba, conda.
sub_platform – such as ubuntu, arch, macports, homebrew, etc.
skip_test – skip test if specified.
skip_conda – skip installing/updating conda.
fast_update – assume minimal change to source of compiled package and perform fast update.
install_ipykernel – install this environment as an ipykernel.
update – if updating all packages. If neither –update nor –no-update is provided, determine automatically.
arch – -march for compilation, for example, native or x86-64-v3
tune – -mtune for compilation, for example, native or generic
- compile_prefix_name: str = ''#
- conda_prefix_name: str = ''#
- property environ: dict[str, str]#
Return a dictionary of environment variables.
- property environ_with_all_paths: dict[str, str]#
Return a dictionary of environment variables with all prefixes prepended to PATH.
- property environ_with_compile_path: dict[str, str]#
Return a dictionary of environment variables with compile prefix prepended to PATH.
- property environ_with_conda_path: dict[str, str]#
Return a dictionary of environment variables with conda prefix prepended to PATH.
- environment_variable: ClassVar[tuple[str, ...]] = ('CONDA_EXE', 'CONDA_PREFIX', 'HOME', 'TERM')#
- sanitized_path: ClassVar[tuple[str, ...]] = ('/bin', '/usr/bin')#
- class pmpm.core.InstallEnvironment(prefix: ~pathlib.Path, file: ~pathlib.Path | None = None, conda_channels: list[str] = <factory>, conda_dependencies: list[str] = <factory>, pip_dependencies: list[str] = <factory>, dependencies: list[str] = <factory>, python_version: str = '3.10', conda_prefix_name: str = 'conda', compile_prefix_name: str = 'compile', download_prefix_name: str = 'git', conda: str = 'mamba', sub_platform: str = '', skip_test: bool = False, skip_conda: bool = False, fast_update: bool = False, install_ipykernel: bool = True, update: bool | None = None, arch: str = 'x86-64-v3', tune: str = 'generic')[source]#
Bases:
object
A Generic install environment.
- Parameters:
prefix – the prefix path of the environment.
file – the YAML file of the environment definition.
conda_channels – conda channels for packages to be searched in.
conda_dependencies – dependencies install via conda.
pip_dependencies – dependencies install via pip.
dependencies – dependencies install via pmpm.
python_version – Python version to be installed.
conda_prefix_name – the subdirectory within prefix for conda.
compile_prefix_name – the subdirectory within prefix for compiled packages from dependencies.
download_prefix_name – the subdirectory within prefix for downloaded source codes from dependencies.
conda – executable name for conda solver, can be mamba, conda.
sub_platform – such as ubuntu, arch, macports, homebrew, etc.
skip_test – skip test if specified.
skip_conda – skip installing/updating conda.
fast_update – assume minimal change to source of compiled package and perform fast update.
install_ipykernel – install this environment as an ipykernel.
update – if updating all packages. If neither –update nor –no-update is provided, determine automatically.
arch – -march for compilation, for example, native or x86-64-v3
tune – -mtune for compilation, for example, native or generic
- arch: str = 'x86-64-v3'#
- property compile_prefix: Path#
Path to the prefix for the compiled stack by pmpm.
- compile_prefix_name: str = 'compile'#
- conda: str = 'mamba'#
- property conda_bin: Path#
Path to the conda binary.
- conda_channels: list[str]#
- conda_dependencies: list[str]#
- conda_environment_filename: ClassVar[str] = 'environment.yml'#
- property conda_environment_path: Path#
Path to the YAML file of the environment definition.
- property conda_prefix: Path#
Path to the prefix for conda.
- conda_prefix_name: str = 'conda'#
- property conda_root_prefix: Path#
Path to the root prefix of conda.
- cpu_count: ClassVar[int] = 2#
- dependencies: list[str]#
- property dependencies_versioned: dict[str, str | None]#
Return a dictionary of dependencies with version.
- download_prefix_name: str = 'git'#
- property downoad_prefix: Path#
Path to the prefix for the downloaded source codes by pmpm.
- property environ: dict[str, str]#
Return a dictionary of environment variables.
- property environ_with_all_paths: dict[str, str]#
Return a dictionary of environment variables with all prefixes prepended to PATH.
- property environ_with_compile_path: dict[str, str]#
Return a dictionary of environment variables with compile prefix prepended to PATH.
- property environ_with_conda_path: dict[str, str]#
Return a dictionary of environment variables with conda prefix prepended to PATH.
- fast_update: bool = False#
- file: Path | None = None#
- classmethod from_dict(data: PMPM_YAML_SPEC) InstallEnvironment [source]#
Construct an environment from a dictionary.
- install_ipykernel: bool = True#
- property is_darwin: bool#
Return True if the system is macOS.
- property is_linux: bool#
Return True if the system is Linux.
- property mamba_bin: Path#
Path to the mamba binary.
- property name: str#
Return the name of the environment.
- pip_dependencies: list[str]#
- prefix: Path#
- python_version: str = '3.10'#
- skip_conda: bool = False#
- skip_test: bool = False#
- sub_platform: str = ''#
- supported_systems: ClassVar[tuple[str, ...]] = ('Linux', 'Darwin')#
- system: ClassVar[str] = 'Linux'#
- property to_dict: PMPM_YAML_SPEC#
Return a dictionary representation of the environment.
- tune: str = 'generic'#
- update: bool | None = None#