Skip to main content

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

Project description

o/COPY

CI PyPI version GitHub license Ruff codecov

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

Installation / Update

With pip

If you have Python 3.10 or newer installed you can just use pip:

pip3 install -U ocopy

Development

This project uses uv for dependency management, Ruff for linting and formatting, and ty for type checking.

# Create the virtual environment and install runtime + dev dependencies
uv sync

# Run tests
uv run pytest

# Lint, format, and type check
uv run ruff check .
uv run ruff format .
uv run ty check

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.4.tar.gz (80.5 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.4-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ocopy-0.7.4.tar.gz
  • Upload date:
  • Size: 80.5 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.4.tar.gz
Algorithm Hash digest
SHA256 a482ba641593912b565c91b6f95b0d31fa6eff35e0cabb9ea708373ee978f7d9
MD5 63e52c9d2c6c51ca52f2068f14add706
BLAKE2b-256 633ad9d788798fc6f6165bc378667ca785df186c4232fab07cf2bdd321a15894

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ocopy-0.7.4-py3-none-any.whl
  • Upload date:
  • Size: 17.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a5c2795dba949f63cb3d697fa336fb0c33473bc62f83f8491d578b74ddfa4e21
MD5 f44f3a0f3204f15dac7fa6f81a69c72a
BLAKE2b-256 c8fe31cb32c309e21272e97bbb7269ffe3291a06a09de08d3a6dfa2e258a81a1

See more details on using hashes here.

Provenance

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