Skip to main content

Securely copy files to multiple destinations using source and destination verification.

Project description

o/COPY

PyPI version PyPI version GitHub license Code style: black codecov

A multi destination copy tool / library with source and destination verification using xxHash.

Installation / Update

With pip

If you have Python 3 installed you can just use pip:

pip3 install -U ocopy

Usage

CLI

cli

Python

import tempfile
from pathlib import Path
from time import sleep

from ocopy.verified_copy import CopyJob


def simple_example():
    # For the sake of this example we will create temporary directory.
    # You will not be doing this in your code.
    with tempfile.TemporaryDirectory() as tmp:
        tmp = Path(tmp)

        # Define source and destination directories
        source = tmp / "source"
        destinations = [tmp / "destination_1", tmp / "destination_2", tmp / "destination_3"]

        # Create some test content
        source.mkdir(parents=True, exist_ok=True)
        (source / "testfile").write_text("Some test content")

        # Create the copy job and wait until it is finished
        job = CopyJob(source, destinations, overwrite=True, verify=True)
        while job.finished is not True:
            sleep(0.1)

        # Print errors
        for error in job.errors:
            print(f"Failed to copy {error.source.name}:\n{error.error_message}")

        # Show content of the mhl file
        mhl_file_content = list(destinations[0].glob("**/*.mhl"))[0].read_text()
        print(mhl_file_content)


if __name__ == "__main__":
    simple_example()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ocopy-0.7.2.tar.gz (40.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocopy-0.7.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file ocopy-0.7.2.tar.gz.

File metadata

  • Download URL: ocopy-0.7.2.tar.gz
  • Upload date:
  • Size: 40.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ocopy-0.7.2.tar.gz
Algorithm Hash digest
SHA256 0f209ea6f2c5e8c7519c661eea594d0bda220b5549a4e8794de8128d44224c00
MD5 cc7f6a1bd50bc602567e4e6ab1953ac5
BLAKE2b-256 4f4a70567403269a78219a979018f9ad5c4229e9f5b360e2e7295a233a527039

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocopy-0.7.2.tar.gz:

Publisher: release.yml on ottomatic-io/ocopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ocopy-0.7.2-py3-none-any.whl.

File metadata

  • Download URL: ocopy-0.7.2-py3-none-any.whl
  • Upload date:
  • Size: 24.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ocopy-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb0be4e129e2b58ba7601b9684a4b9e0a0a1a5cbb5e274ecb33f955f77eae5bf
MD5 a7bcce08bae0f87197a8713f8261be94
BLAKE2b-256 a49ddc3686d27a8709f75d90ef3a3f06855289279c6d696a38d0221b119b003f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocopy-0.7.2-py3-none-any.whl:

Publisher: release.yml on ottomatic-io/ocopy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page