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.3.tar.gz (40.8 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.3-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocopy-0.7.3.tar.gz
  • Upload date:
  • Size: 40.8 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.3.tar.gz
Algorithm Hash digest
SHA256 4ee857b7986ad6ddfb911ca9fe7b1d6a2a95e32c2c91ecbd8e5918f94c6ec1f9
MD5 9c08f740b3f04aacda8ee977c86d4c47
BLAKE2b-256 5c7ac63fc5dbf6c16dc709913cbd69fe4d402b8ba47b8d9682f16aa8bd9b3bf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocopy-0.7.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: ocopy-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 24.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 04d3909da9fde902f8703aeceb34b671e0360eac687e078db3ab45387a486117
MD5 15f1443523688f95867d3284189a96ee
BLAKE2b-256 76864e0f7c32bcd63a87579b95d5e3f9b8bc27d6c4d455a3bb249169cbfac097

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocopy-0.7.3-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