s3pathlib
s3pathlib is the python package provides the Pythonic objective oriented programming (OOP) interface to manipulate AWS S3 object / directory. The api is similar to the pathlib standard library and very intuitive for human.
What it is and what it does
s3pathlib wraps boto3 with a pathlib-inspired API so you work with S3 objects and directories using familiar Python path operations. Instead of calling boto3 client methods directly, you construct S3Path objects from bucket and key components (or S3 URIs and ARNs), then call methods like write_text(), read_text(), open(), and delete() as if they were local filesystem paths.
The package handles the complexity of S3's flat object model and pagination limits by providing recursive folder operations (upload_dir, copy_to, delete), object filtering by size/extension/etag/mtime, and file-like I/O for streaming large objects. It maintains a context object that holds your boto3 session, so you configure credentials once and reuse them across all S3Path instances.
Use it for:
- Upload entire local directory trees to S3 with pattern matching (e.g., all .py files) without manual pagination.
- Copy or delete S3 folders recursively in a single call, avoiding manual list-and-delete loops.
- Stream large S3 objects line-by-line or into pandas DataFrames using context-manager syntax.
- Filter S3 objects by size, extension, or modification time before processing, reducing unnecessary data transfer.
- Inspect S3 object metadata (etag, size, human-readable size) and folder statistics (object count, total size) with simple method calls.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
s3pathlib provides a pathlib-like object-oriented interface to AWS S3, letting you construct, query, and manipulate S3 objects and directories using familiar Python path syntax.
Yes, if you work regularly with S3 and prefer a Pythonic path-like interface over raw boto3 calls. The low install friction and permissive license make it a safe add. Caveat: maintenance is aging (last release 367 days ago), so verify it still works with your boto3 version and check for any open issues matching your use case before committing to production.
Install
s3pathlib on PyPI
pip
pip install s3pathlibuv
uv add s3pathlibpoetry
poetry add s3pathlibInstalling s3pathlib
Before you install
Low install friction; pure Python wheel with six runtime dependencies (boto3, boto_session_manager, func_args, iterproxy, pathlib_mate, smart_open). Last release was 367 days ago; repo is not archived but maintenance signal is aging.
License in practice
Apache-2.0 permissive license; you may use, modify, and distribute freely in commercial and private projects with minimal restrictions.
Quickstart
from s3pathlib import S3Path
import boto3
from s3pathlib import context
context.attach_boto_session(boto3.session.Session(region_name="us-east-1"))
p = S3Path("bucket", "folder", "file.txt")
p.write_text("data")
print(p.etag, p.size)
Requires valid AWS credentials configured in your boto3 session (via environment, config file, or explicit profile).
Verify before relying
- Whether the package handles concurrent S3 operations safely or has thread-safety guarantees.
- Performance characteristics when iterating over buckets with millions of objects.
- Compatibility with S3-compatible services (MinIO, LocalStack) beyond AWS S3.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4.0,>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — boto3, boto_session_manager, func_args, iterproxy, pathlib_mate, smart_open |
| Maintenance | aging — 367 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 902,567/month — #4,768 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: s3pathlib-2.3.6-py3-none-any.whl
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
s3pathS3Path provides a pathlib-like interface for…
permissive · top 5,000 on PyPI
cloudpathlibProvides pathlib-style classes for reading,…
permissive · top 1,000 on PyPI
s3fss3fs provides a Python filesystem interface to…
permissive · top 100 on PyPI
pathyPathy provides a pathlib-compatible interface…
permissive · top 5,000 on PyPI
universal-pathlibUniversal Pathlib provides a pathlib.Path-like…
permissive · top 1,000 on PyPI
aws-cdk.aws-s3Defines AWS S3 buckets and related resources as…
permissive · top 15,000 on PyPI
fs-s3fsS3FS provides a PyFilesystem interface to…
permissive · top 15,000 on PyPI
git-remote-s3Enables Git to use Amazon S3 as a remote…
permissive · top 15,000 on PyPI
s3urlsParse and build Amazon S3 URLs in multiple…
permissive · top 15,000 on PyPI
s3transfers3transfer manages concurrent uploads and…
permissive · top 100 on PyPI