Mirror#

Description#

Take package name and version, and copy it from the source repository to the destination repository.

When working with multiple servers, it might make sense to transfer created packages (or rather specific versions of these) into the .packages folder on another server so install operations on that server are fast and don’t need to specify the source server as a repository.

This is what the mirror operation is built for - it will copy a package version from one server’s .packages directory into another server’s .packages directory.

For usage examples, see the Tutorial. For CLI options, run wrapp mirror --help.

Python API Reference#

async wrapp.mirror(
package_name: str,
version: str,
source_repo: str,
destination_repo: str,
tags: bool = False,
resume: bool = False,
template_version: str | None = None,
*,
redirect_dependencies: bool = False,
context: CommandParameters = CommandParameters(debug=False, verbose=False, dry_run=False, log_file=None, hash_cache_file=None),
scheduler: SchedulerContext | None = None,
) None#

Take package name and version, and copy it from the source repository to the destination repository.

Parameters:
  • package_name – Name of the package to copy

  • version – Version of the package to copy

  • source_repo – Specify the URL of the source repository, excluding the .packages directory

  • destination_repo – Specify the URL of the target repository, again excluding the .packages directory name

  • tags – Set this to create the tags in the target repository.

  • resume – Set this flag to make a differential copy by first cataloging the target repository package directory and then doing a differential copy

  • template_version – Optionally specify a directory to copy into the place first. This can accelerate creation if the template is on the same server and can be reused.

  • redirect_dependencies – Set this to rewrite dependencies in the package mirrored to point to the destination repository (no check for existance is done!)

  • context – Global configuration parameters

  • scheduler – Optionally pre-constructed SchedulerContext. When calling many functions in a row make sure to pre-construct the scheduler.

Raises:
  • FailedCommand – When prerequisites not matched

  • StorageOperationError – Raised when network or file operations fail

async wrapp.mirror_with_dependencies(
package_name: str,
version: str,
source_repo: str,
destination_repo: str | Callable[[UniquePackageLocation], Awaitable[str]],
tags: bool = False,
resume: bool = False,
max_concurrent_single_package_mirror_ops: int = 20,
*,
context: CommandParameters = CommandParameters(debug=False, verbose=False, dry_run=False, log_file=None, hash_cache_file=None),
scheduler: SchedulerContext | None = None,
) None#

Mirror a package with all its dependencies from a source to a destination repository (or several).

Parameters:
  • package_name – Name of the package to copy

  • version – Version of the package to copy

  • source_repo – Specify the URL of the source repository, excluding the .packages directory

  • destination_repo – Either the URL of the target repository for the source package and all its dependencies. Or an async callback function that returns the target repository URL for all mirrored packages and all their dependencies. The callback function must return for the mirrored package and all its recursive dependencies a valid repository URL. To not mirror a package, return its current repository URL from the UniquePackageLocation.

  • tags – Set this to create the tags in the target repository.

  • resume – Set this flag to make a differential copy by first cataloging the target repository package directory and then doing a differential copy

  • max_concurrent_single_package_mirror_ops – The maximum number of concurrent single-package mirroring operations. A lower number means more packages are completed if the operation is interrupted, and a follow-up “mirror –resume” is faster. A higher number means the packages are transferred more optimal, particular if the mirrored packages are small, because more files can be transferred concurrently.

  • context – Global configuration parameters

  • scheduler – Optionally pre-constructed SchedulerContext. When calling many functions in a row make sure to pre-construct the scheduler.

Raises:
  • FailedCommand – When prerequisites not matched

  • StorageOperationError – Raised when network or file operations fail