Skip to main content

⚓ Minato

Actions Status Python version License pypi version

A Unified File I/O Library for Python

Minato is a Python library that provides a unified and simple interface to work with local and remote files, as well as compressed and archived files. With Minato, you can seamlessly read and write files from various sources like local filesystem, HTTP(S), Amazon S3, Google Cloud Storage, and Hugging Fase Hub. It also supports reading and writing compressed files such as gzip, bz2, and lzma, as well as directly accessing files inside archives like zip and tar.

One of Minato's key features is its built-in caching mechanism, which allows you to cache remote files locally, and manage the cache with a provided CLI. The cache is automatically updated based on ETag headers, ensuring that you always work with the latest version of the files.

Features

  • Unified file I/O for local and remote files (HTTP(S), S3, GCP, Hugging Face Hub)
  • Support for reading and writing compressed files (gzip, bz2, lzma)
  • Direct access to files inside archives (zip, tar)
  • Local caching of remote files with cache management CLI
  • Automatic cache updates based on ETag headers

Installation

Install Minato using pip:

pip install minato                   # minimal installation for only local/http(s) file I/O
pip install minato[s3]               # for Amazon S3
pip install minato[gcs]              # for Google Cloud Storage
pip install minato[huggingface-hub]  # for Hugging Face Hub
pip install minato[all]              # for all supported file I/O

Usage

Quick Start

Here's a simple example demonstrating how to read and write files on online storage:

import minato

# Write a file to an S3 bucket
s3_path = "s3://your_bucket/path/to/file"
with minato.open(s3_path, "w") as f:
    f.write("Create a new file on AWS S3!")

Access cached online resources in local storage:

# Cache a remote file and get its local path
remote_path = "http://example.com/path/to/archive.zip!inner/path/to/file"
local_filename = minato.cached_path(remote_path)

Access files inside archives like zip by connecting the archive path and inner file path with an exclamation mark (!) like above.

Automatically decompress files with gzip / lzma / bz2 compression:

with minato.open("data.txt.gz", "rt", decompress=True) as f:
    content = f.read()

In the example above, Minato will automatically detect the file format based on the file's content or filename and decompress the file accordingly.

Cache Management

❯ poetry run minato --help
usage: minato

positional arguments:
  {cache,list,remove,update}
    cache               cache remote file and return cached local file path
    list                show list of cached files
    remove              remove cached files
    update              update cached files

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit

Metadata

Release files for minato 0.12.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minato 0.12.3
File Size Uploaded Provenance Actions
minato-0.12.3.tar.gz 24.2 kB Without provenance Details for minato-0.12.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for minato 0.12.3
File Interpreter ABI Platform Actions
minato-0.12.3-py3-none-any.whl Python 3 none any Details for minato-0.12.3-py3-none-any.whl

Total release size: 59.0 kB

Release files / minato-0.12.3.tar.gz

Download URL minato-0.12.3.tar.gz
Size 24.2 kB
Tags Source
SHA-256 checksum
How to use checksums
a9a3ad53215f9d9055001f1cc813c1f745a7712dd5da700d51c04a52fab508a4
BLAKE2b-256 checksum
How to use checksums
597bba513b8cd22d0c16938f4dece0bbcf16146b2d52536d3422158bd9cb3b46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.1 Linux/6.5.0-1025-azure

Release files / minato-0.12.3-py3-none-any.whl

Download URL minato-0.12.3-py3-none-any.whl
Size 34.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f63368ec0d5ff49107fd8e919f49b1502b2618a60c475339787e9a5e80e7f819
BLAKE2b-256 checksum
How to use checksums
9d2122cd19fbceb8b5d31d64914c1f5c1ac41294259348c1a0eb70b239fc975f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.1 Linux/6.5.0-1025-azure

Security for minato 0.12.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page