Skip to main content

Helper functions for interacting with s3.

Project description

s3async

Helper functions for interacting with s3. Provides synchronous and asynchronous functions and CLI-entrypoints.

Public asynchronous functions are differentiated from synchronous ones with the suffix _async. Typically one can find a non-suffixed version of the same function which wraps the async call in a sync function (e.g. for CLI usage).

Batch operations such as sync, listing keys, and recursive copy/delete operations will always do the bulk of their work asynchronously.

Command line interface

Commands:
  cp    Copy S3 object
  hash  Computes a MD5 digest of a file
  ls    List s3 object paths
  meta  Get object metadata information
  rm    Delete S3 object
  sync  Sync objects between local and S3 path or two S3 paths
  tag   Set and get object tags

Notes on syncing

Default sync is non-recursive, i.e. it only copies the current folder to the provided prefix or vice-versa. For recursive behaviour one needs to use option --recursive which will then compare paths relative to working directory/prefix and sync to matching relative path.

There are three options for comparing whether a file should be synced or not:

  • etag - Automatically computed ETag which is "usually" a MD5 hash of the content will be compared against local file content MD5 hash
  • hash - Comparison will be made against a custom tag called hash, which should contain the MD5 hash of the content. Use this if you can't trust ETag to be correct for your files. If selected, the tag will be set automatically by sync.
  • timestamp - Last modified timestamp; will sync if target_timestamp < source_timestamp with the resolution of one second. Local timestamps will be set to match the S3 timestamps but the opposite is not possible.

Testing

Tests are ran against minio which implements the S3 specification.

Minio is automatically ran in a docker container by pytest-docker. The docker-compose file that sets up the minio is located in ./tests/docker-compose.yml.

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

s3async-1.0.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

s3async-1.0.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file s3async-1.0.0.tar.gz.

File metadata

  • Download URL: s3async-1.0.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for s3async-1.0.0.tar.gz
Algorithm Hash digest
SHA256 384ac5226370d6857c542a1c428dbbee8a51b0680c18ca273b68cd6254e5be89
MD5 b74738e755234d6d90c9d6bc0d2ea9c8
BLAKE2b-256 7672218c5fcc023163ece49d8ead6b7b5ee2e74fa2cda93f42f11371b64c0b1d

See more details on using hashes here.

File details

Details for the file s3async-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: s3async-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for s3async-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09c42edf2f2cc110e160ed93a29a36fffb1279b994a25cc5dd077b138b4ee597
MD5 995b00883f8d29ca318f8971644f55c3
BLAKE2b-256 8137746ca51cd0cdb280a229f100d28e0052532344878d4d8e11d5579ec40907

See more details on using hashes here.

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