packing_packages.pack.yaml package
Packing packages for distribution and installation.
This module provides functionality to pack conda environments and their dependencies into a specified directory.
$ python -m packing_packages pack yaml --help
or
$ packing-packages pack yaml --help
- packing_packages.pack.yaml.packing_packages_from_yaml(filepath_yaml: PathLike | str, *, platform: Literal['win-64', 'win-32', 'linux-64', 'linux-aarch64', 'linux-ppc64le', 'linux-s390x', 'osx-64', 'osx-arm64'] | None = None, dirpath_target: PathLike | str = '.', dry_run: bool = False, encoding: str | None = None) None
Package Python dependencies from a YAML file for a specific platform.
- Parameters:
filepath_yaml (str or os.PathLike) – Path to the YAML file containing package specifications.
platform ({"win-64", "win-32", "linux-64", "linux-aarch64", "linux-ppc64le", "linux-s390x", "osx-64", "osx-arm64"}, optional) – Target platform for which packages should be downloaded. If None, the current platform is used.
dirpath_target (str or os.PathLike, default=".") – Path to the directory where the downloaded package files will be saved.
dry_run (bool, default=False) – If True, simulate the download process without actually downloading any files.
encoding (str, optional) – File encoding used to read the YAML file. If None, the system default encoding is used.
Examples
>>> packing_packages_from_yaml("env.yaml", platform="linux-64", dry_run=True) # Prints or logs the list of packages that would be downloaded for Linux 64-bit.
>>> packing_packages_from_yaml("env.yaml", dirpath_target="./downloads") # Downloads packages into ./downloads based on the current platform.
Submodules
packing_packages.pack.yaml.constants module
- packing_packages.pack.yaml.constants.PLATFORM_MAP = {'linux-64': {'conda': 'linux-64', 'pypi': 'manylinux2014_x86_64'}, 'linux-aarch64': {'conda': 'linux-aarch64', 'pypi': 'manylinux2014_aarch64'}, 'linux-ppc64le': {'conda': 'linux-ppc64le', 'pypi': 'manylinux2014_ppc64le'}, 'linux-s390x': {'conda': 'linux-s390x', 'pypi': 'manylinux2014_s390x'}, 'osx-64': {'conda': 'osx-64', 'pypi': 'macosx_10_9_x86_64'}, 'osx-arm64': {'conda': 'osx-arm64', 'pypi': 'macosx_11_0_arm64'}, 'win-32': {'conda': 'win-32', 'pypi': 'win32'}, 'win-64': {'conda': 'win-64', 'pypi': 'win_amd64'}}
This dictionary PLATFORM_MAP maps platform identifiers used in package management to corresponding platform strings for PyPI and Conda repositories.
Keys represent platform identifiers typically used in package distribution: - ‘win-64’: Windows 64-bit - ‘win-32’: Windows 32-bit - ‘linux-64’: Linux 64-bit - ‘linux-aarch64’: Linux ARM 64-bit - ‘linux-ppc64le’: Linux PowerPC 64-bit little-endian - ‘linux-s390x’: Linux IBM Z (s390x) - ‘osx-64’: macOS 64-bit (x86_64) - ‘osx-arm64’: macOS ARM 64-bit (arm64)
For each platform, the dictionary provides mappings for: - ‘pypi’: PyPI platform string - ‘conda’: Conda platform string
Examples of usage: - To obtain the PyPI platform string for Windows 64-bit:
PLATFORM_MAP[‘win-64’][‘pypi’] returns ‘win_amd64’
To obtain the Conda platform string for macOS ARM 64-bit: PLATFORM_MAP[‘osx-arm64’][‘conda’] returns ‘osx-arm64’